Update CI references to 0.0.122
[ldk-java] / ts / bindings.c
1 #define LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
3 #include "js-wasm.h"
4 #include <stdatomic.h>
5 #include <lightning.h>
6
7 // These should be provided...somehow...
8 void *memset(void *s, int c, size_t n);
9 void *memcpy(void *dest, const void *src, size_t n);
10 int memcmp(const void *s1, const void *s2, size_t n);
11
12 extern void __attribute__((noreturn)) abort(void);
13 static inline void assert(bool expression) {
14         if (!expression) { abort(); }
15 }
16
17 uint32_t __attribute__((export_name("test_bigint_pass_deadbeef0badf00d"))) test_bigint_pass_deadbeef0badf00d(uint64_t val) {
18         return val == 0xdeadbeef0badf00dULL;
19 }
20
21
22 void *malloc(size_t size);
23 void free(void *ptr);
24
25 #define MALLOC(a, _) malloc(a)
26 #define do_MALLOC(a, _b, _c) malloc(a)
27 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
28 #define DO_ASSERT(a) (void)(a)
29 #define CHECK(a)
30 #define CHECK_ACCESS(p)
31 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
32
33 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
34 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
35 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
36 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
37
38 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
39
40 #define DECL_ARR_TYPE(ty, name) \
41         struct name##array { \
42                 uint64_t arr_len; /* uint32_t would suffice but we want to align uint64_ts as well */ \
43                 ty elems[]; \
44         }; \
45         typedef struct name##array * name##Array; \
46         static inline name##Array init_##name##Array(size_t arr_len, int lineno) { \
47                 name##Array arr = (name##Array)do_MALLOC(arr_len * sizeof(ty) + sizeof(uint64_t), #name" array init", lineno); \
48                 arr->arr_len = arr_len; \
49                 return arr; \
50         }
51
52 DECL_ARR_TYPE(int64_t, int64_t);
53 DECL_ARR_TYPE(uint64_t, uint64_t);
54 DECL_ARR_TYPE(int8_t, int8_t);
55 DECL_ARR_TYPE(int16_t, int16_t);
56 DECL_ARR_TYPE(uint32_t, uint32_t);
57 DECL_ARR_TYPE(void*, ptr);
58 DECL_ARR_TYPE(char, char);
59 typedef charArray jstring;
60
61 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
62         charArray arr = init_charArray(len, __LINE__);
63         memcpy(arr->elems, chars, len);
64         return arr;
65 }
66 static inline LDKStr str_ref_to_owned_c(const jstring str) {
67         char* newchars = MALLOC(str->arr_len + 1, "String chars");
68         memcpy(newchars, str->elems, str->arr_len);
69         newchars[str->arr_len] = 0;
70         LDKStr res = {
71                 .chars = newchars,
72                 .len = str->arr_len,
73                 .chars_is_owned = true
74         };
75         return res;
76 }
77
78 typedef bool jboolean;
79
80 uint32_t __attribute__((export_name("TS_malloc"))) TS_malloc(uint32_t size) {
81         return (uint32_t)MALLOC(size, "JS-Called malloc");
82 }
83 void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) {
84         FREE((void*)ptr);
85 }
86
87 jstring __attribute__((export_name("TS_get_ldk_c_bindings_version"))) TS_get_ldk_c_bindings_version() {
88         const char *res = check_get_ldk_bindings_version();
89         if (res == NULL) return NULL;
90         return str_ref_to_ts(res, strlen(res));
91 }
92 jstring __attribute__((export_name("TS_get_ldk_version"))) get_ldk_version() {
93         const char *res = check_get_ldk_version();
94         if (res == NULL) return NULL;
95         return str_ref_to_ts(res, strlen(res));
96 }
97 #include "version.c"
98 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
99
100 static inline void* untag_ptr(uint64_t ptr) {
101         if (ptr < 4096) return (void*)ptr;
102         if (sizeof(void*) == 4) {
103                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
104                 return (void*)(uintptr_t)ptr;
105         } else {
106                 // For 64-bit systems, assume the top byte is used for tagging, then
107                 // use bit 9 ^ bit 10.
108                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
109                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
110 #ifdef LDK_DEBUG_BUILD
111                 // On debug builds we also use the 11th bit as a debug flag
112                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
113                 CHECK(tenth_bit != eleventh_bit);
114                 p ^= 1ULL << 53;
115 #endif
116                 return (void*)p;
117         }
118 }
119 static inline bool ptr_is_owned(uint64_t ptr) {
120         if(ptr < 4096) return true;
121         if (sizeof(void*) == 4) {
122                 return ptr & (1ULL << 32);
123         } else {
124                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
125                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
126 #ifdef LDK_DEBUG_BUILD
127                 // On debug builds we also use the 11th bit as a debug flag
128                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
129                 CHECK(tenth_bit != eleventh_bit);
130 #endif
131                 return (ninth_bit ^ tenth_bit) ? true : false;
132         }
133 }
134 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
135         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
136         if (sizeof(void*) == 4) {
137                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
138         } else {
139                 CHECK(sizeof(uintptr_t) == 8);
140                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
141                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
142 #ifdef LDK_DEBUG_BUILD
143                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
144                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
145                 CHECK(ninth_bit == tenth_bit);
146                 CHECK(ninth_bit == eleventh_bit);
147                 t ^= 1ULL << 53;
148 #endif
149                 CHECK(ptr_is_owned(t) == is_owned);
150                 CHECK(untag_ptr(t) == ptr);
151                 return t;
152         }
153 }
154
155 static inline LDKBlindedFailure LDKBlindedFailure_from_js(int32_t ord) {
156         switch (ord) {
157                 case 0: return LDKBlindedFailure_FromIntroductionNode;
158                 case 1: return LDKBlindedFailure_FromBlindedNode;
159         }
160         abort();
161 }
162 static inline int32_t LDKBlindedFailure_to_js(LDKBlindedFailure val) {
163         switch (val) {
164                 case LDKBlindedFailure_FromIntroductionNode: return 0;
165                 case LDKBlindedFailure_FromBlindedNode: return 1;
166                 default: abort();
167         }
168 }
169 static inline LDKBolt11SemanticError LDKBolt11SemanticError_from_js(int32_t ord) {
170         switch (ord) {
171                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
172                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
173                 case 2: return LDKBolt11SemanticError_NoDescription;
174                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
175                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
176                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
177                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
178                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
179                 case 8: return LDKBolt11SemanticError_InvalidSignature;
180                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
181         }
182         abort();
183 }
184 static inline int32_t LDKBolt11SemanticError_to_js(LDKBolt11SemanticError val) {
185         switch (val) {
186                 case LDKBolt11SemanticError_NoPaymentHash: return 0;
187                 case LDKBolt11SemanticError_MultiplePaymentHashes: return 1;
188                 case LDKBolt11SemanticError_NoDescription: return 2;
189                 case LDKBolt11SemanticError_MultipleDescriptions: return 3;
190                 case LDKBolt11SemanticError_NoPaymentSecret: return 4;
191                 case LDKBolt11SemanticError_MultiplePaymentSecrets: return 5;
192                 case LDKBolt11SemanticError_InvalidFeatures: return 6;
193                 case LDKBolt11SemanticError_InvalidRecoveryId: return 7;
194                 case LDKBolt11SemanticError_InvalidSignature: return 8;
195                 case LDKBolt11SemanticError_ImpreciseAmount: return 9;
196                 default: abort();
197         }
198 }
199 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_js(int32_t ord) {
200         switch (ord) {
201                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
202                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
203                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
204                 case 3: return LDKBolt12SemanticError_MissingAmount;
205                 case 4: return LDKBolt12SemanticError_InvalidAmount;
206                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
207                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
208                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
209                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
210                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
211                 case 10: return LDKBolt12SemanticError_MissingDescription;
212                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
213                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
214                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
215                 case 14: return LDKBolt12SemanticError_MissingQuantity;
216                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
217                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
218                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
219                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
220                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
221                 case 20: return LDKBolt12SemanticError_MissingPayerId;
222                 case 21: return LDKBolt12SemanticError_DuplicatePaymentId;
223                 case 22: return LDKBolt12SemanticError_MissingPaths;
224                 case 23: return LDKBolt12SemanticError_InvalidPayInfo;
225                 case 24: return LDKBolt12SemanticError_MissingCreationTime;
226                 case 25: return LDKBolt12SemanticError_MissingPaymentHash;
227                 case 26: return LDKBolt12SemanticError_MissingSignature;
228         }
229         abort();
230 }
231 static inline int32_t LDKBolt12SemanticError_to_js(LDKBolt12SemanticError val) {
232         switch (val) {
233                 case LDKBolt12SemanticError_AlreadyExpired: return 0;
234                 case LDKBolt12SemanticError_UnsupportedChain: return 1;
235                 case LDKBolt12SemanticError_UnexpectedChain: return 2;
236                 case LDKBolt12SemanticError_MissingAmount: return 3;
237                 case LDKBolt12SemanticError_InvalidAmount: return 4;
238                 case LDKBolt12SemanticError_InsufficientAmount: return 5;
239                 case LDKBolt12SemanticError_UnexpectedAmount: return 6;
240                 case LDKBolt12SemanticError_UnsupportedCurrency: return 7;
241                 case LDKBolt12SemanticError_UnknownRequiredFeatures: return 8;
242                 case LDKBolt12SemanticError_UnexpectedFeatures: return 9;
243                 case LDKBolt12SemanticError_MissingDescription: return 10;
244                 case LDKBolt12SemanticError_MissingSigningPubkey: return 11;
245                 case LDKBolt12SemanticError_InvalidSigningPubkey: return 12;
246                 case LDKBolt12SemanticError_UnexpectedSigningPubkey: return 13;
247                 case LDKBolt12SemanticError_MissingQuantity: return 14;
248                 case LDKBolt12SemanticError_InvalidQuantity: return 15;
249                 case LDKBolt12SemanticError_UnexpectedQuantity: return 16;
250                 case LDKBolt12SemanticError_InvalidMetadata: return 17;
251                 case LDKBolt12SemanticError_UnexpectedMetadata: return 18;
252                 case LDKBolt12SemanticError_MissingPayerMetadata: return 19;
253                 case LDKBolt12SemanticError_MissingPayerId: return 20;
254                 case LDKBolt12SemanticError_DuplicatePaymentId: return 21;
255                 case LDKBolt12SemanticError_MissingPaths: return 22;
256                 case LDKBolt12SemanticError_InvalidPayInfo: return 23;
257                 case LDKBolt12SemanticError_MissingCreationTime: return 24;
258                 case LDKBolt12SemanticError_MissingPaymentHash: return 25;
259                 case LDKBolt12SemanticError_MissingSignature: return 26;
260                 default: abort();
261         }
262 }
263 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
264         switch (ord) {
265                 case 0: return LDKCOption_NoneZ_Some;
266                 case 1: return LDKCOption_NoneZ_None;
267         }
268         abort();
269 }
270 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
271         switch (val) {
272                 case LDKCOption_NoneZ_Some: return 0;
273                 case LDKCOption_NoneZ_None: return 1;
274                 default: abort();
275         }
276 }
277 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_js(int32_t ord) {
278         switch (ord) {
279                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
280                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
281                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
282         }
283         abort();
284 }
285 static inline int32_t LDKChannelMonitorUpdateStatus_to_js(LDKChannelMonitorUpdateStatus val) {
286         switch (val) {
287                 case LDKChannelMonitorUpdateStatus_Completed: return 0;
288                 case LDKChannelMonitorUpdateStatus_InProgress: return 1;
289                 case LDKChannelMonitorUpdateStatus_UnrecoverableError: return 2;
290                 default: abort();
291         }
292 }
293 static inline LDKChannelShutdownState LDKChannelShutdownState_from_js(int32_t ord) {
294         switch (ord) {
295                 case 0: return LDKChannelShutdownState_NotShuttingDown;
296                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
297                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
298                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
299                 case 4: return LDKChannelShutdownState_ShutdownComplete;
300         }
301         abort();
302 }
303 static inline int32_t LDKChannelShutdownState_to_js(LDKChannelShutdownState val) {
304         switch (val) {
305                 case LDKChannelShutdownState_NotShuttingDown: return 0;
306                 case LDKChannelShutdownState_ShutdownInitiated: return 1;
307                 case LDKChannelShutdownState_ResolvingHTLCs: return 2;
308                 case LDKChannelShutdownState_NegotiatingClosingFee: return 3;
309                 case LDKChannelShutdownState_ShutdownComplete: return 4;
310                 default: abort();
311         }
312 }
313 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
314         switch (ord) {
315                 case 0: return LDKConfirmationTarget_OnChainSweep;
316                 case 1: return LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee;
317                 case 2: return LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee;
318                 case 3: return LDKConfirmationTarget_AnchorChannelFee;
319                 case 4: return LDKConfirmationTarget_NonAnchorChannelFee;
320                 case 5: return LDKConfirmationTarget_ChannelCloseMinimum;
321         }
322         abort();
323 }
324 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
325         switch (val) {
326                 case LDKConfirmationTarget_OnChainSweep: return 0;
327                 case LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee: return 1;
328                 case LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee: return 2;
329                 case LDKConfirmationTarget_AnchorChannelFee: return 3;
330                 case LDKConfirmationTarget_NonAnchorChannelFee: return 4;
331                 case LDKConfirmationTarget_ChannelCloseMinimum: return 5;
332                 default: abort();
333         }
334 }
335 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
336         switch (ord) {
337                 case 0: return LDKCreationError_DescriptionTooLong;
338                 case 1: return LDKCreationError_RouteTooLong;
339                 case 2: return LDKCreationError_TimestampOutOfBounds;
340                 case 3: return LDKCreationError_InvalidAmount;
341                 case 4: return LDKCreationError_MissingRouteHints;
342                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
343         }
344         abort();
345 }
346 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
347         switch (val) {
348                 case LDKCreationError_DescriptionTooLong: return 0;
349                 case LDKCreationError_RouteTooLong: return 1;
350                 case LDKCreationError_TimestampOutOfBounds: return 2;
351                 case LDKCreationError_InvalidAmount: return 3;
352                 case LDKCreationError_MissingRouteHints: return 4;
353                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort: return 5;
354                 default: abort();
355         }
356 }
357 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
358         switch (ord) {
359                 case 0: return LDKCurrency_Bitcoin;
360                 case 1: return LDKCurrency_BitcoinTestnet;
361                 case 2: return LDKCurrency_Regtest;
362                 case 3: return LDKCurrency_Simnet;
363                 case 4: return LDKCurrency_Signet;
364         }
365         abort();
366 }
367 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
368         switch (val) {
369                 case LDKCurrency_Bitcoin: return 0;
370                 case LDKCurrency_BitcoinTestnet: return 1;
371                 case LDKCurrency_Regtest: return 2;
372                 case LDKCurrency_Simnet: return 3;
373                 case LDKCurrency_Signet: return 4;
374                 default: abort();
375         }
376 }
377 static inline LDKHTLCClaim LDKHTLCClaim_from_js(int32_t ord) {
378         switch (ord) {
379                 case 0: return LDKHTLCClaim_OfferedTimeout;
380                 case 1: return LDKHTLCClaim_OfferedPreimage;
381                 case 2: return LDKHTLCClaim_AcceptedTimeout;
382                 case 3: return LDKHTLCClaim_AcceptedPreimage;
383                 case 4: return LDKHTLCClaim_Revocation;
384         }
385         abort();
386 }
387 static inline int32_t LDKHTLCClaim_to_js(LDKHTLCClaim val) {
388         switch (val) {
389                 case LDKHTLCClaim_OfferedTimeout: return 0;
390                 case LDKHTLCClaim_OfferedPreimage: return 1;
391                 case LDKHTLCClaim_AcceptedTimeout: return 2;
392                 case LDKHTLCClaim_AcceptedPreimage: return 3;
393                 case LDKHTLCClaim_Revocation: return 4;
394                 default: abort();
395         }
396 }
397 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
398         switch (ord) {
399                 case 0: return LDKIOError_NotFound;
400                 case 1: return LDKIOError_PermissionDenied;
401                 case 2: return LDKIOError_ConnectionRefused;
402                 case 3: return LDKIOError_ConnectionReset;
403                 case 4: return LDKIOError_ConnectionAborted;
404                 case 5: return LDKIOError_NotConnected;
405                 case 6: return LDKIOError_AddrInUse;
406                 case 7: return LDKIOError_AddrNotAvailable;
407                 case 8: return LDKIOError_BrokenPipe;
408                 case 9: return LDKIOError_AlreadyExists;
409                 case 10: return LDKIOError_WouldBlock;
410                 case 11: return LDKIOError_InvalidInput;
411                 case 12: return LDKIOError_InvalidData;
412                 case 13: return LDKIOError_TimedOut;
413                 case 14: return LDKIOError_WriteZero;
414                 case 15: return LDKIOError_Interrupted;
415                 case 16: return LDKIOError_Other;
416                 case 17: return LDKIOError_UnexpectedEof;
417         }
418         abort();
419 }
420 static inline int32_t LDKIOError_to_js(LDKIOError val) {
421         switch (val) {
422                 case LDKIOError_NotFound: return 0;
423                 case LDKIOError_PermissionDenied: return 1;
424                 case LDKIOError_ConnectionRefused: return 2;
425                 case LDKIOError_ConnectionReset: return 3;
426                 case LDKIOError_ConnectionAborted: return 4;
427                 case LDKIOError_NotConnected: return 5;
428                 case LDKIOError_AddrInUse: return 6;
429                 case LDKIOError_AddrNotAvailable: return 7;
430                 case LDKIOError_BrokenPipe: return 8;
431                 case LDKIOError_AlreadyExists: return 9;
432                 case LDKIOError_WouldBlock: return 10;
433                 case LDKIOError_InvalidInput: return 11;
434                 case LDKIOError_InvalidData: return 12;
435                 case LDKIOError_TimedOut: return 13;
436                 case LDKIOError_WriteZero: return 14;
437                 case LDKIOError_Interrupted: return 15;
438                 case LDKIOError_Other: return 16;
439                 case LDKIOError_UnexpectedEof: return 17;
440                 default: abort();
441         }
442 }
443 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
444         switch (ord) {
445                 case 0: return LDKLevel_Gossip;
446                 case 1: return LDKLevel_Trace;
447                 case 2: return LDKLevel_Debug;
448                 case 3: return LDKLevel_Info;
449                 case 4: return LDKLevel_Warn;
450                 case 5: return LDKLevel_Error;
451         }
452         abort();
453 }
454 static inline int32_t LDKLevel_to_js(LDKLevel val) {
455         switch (val) {
456                 case LDKLevel_Gossip: return 0;
457                 case LDKLevel_Trace: return 1;
458                 case LDKLevel_Debug: return 2;
459                 case LDKLevel_Info: return 3;
460                 case LDKLevel_Warn: return 4;
461                 case LDKLevel_Error: return 5;
462                 default: abort();
463         }
464 }
465 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
466         switch (ord) {
467                 case 0: return LDKNetwork_Bitcoin;
468                 case 1: return LDKNetwork_Testnet;
469                 case 2: return LDKNetwork_Regtest;
470                 case 3: return LDKNetwork_Signet;
471         }
472         abort();
473 }
474 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
475         switch (val) {
476                 case LDKNetwork_Bitcoin: return 0;
477                 case LDKNetwork_Testnet: return 1;
478                 case LDKNetwork_Regtest: return 2;
479                 case LDKNetwork_Signet: return 3;
480                 default: abort();
481         }
482 }
483 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_js(int32_t ord) {
484         switch (ord) {
485                 case 0: return LDKPaymentFailureReason_RecipientRejected;
486                 case 1: return LDKPaymentFailureReason_UserAbandoned;
487                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
488                 case 3: return LDKPaymentFailureReason_PaymentExpired;
489                 case 4: return LDKPaymentFailureReason_RouteNotFound;
490                 case 5: return LDKPaymentFailureReason_UnexpectedError;
491         }
492         abort();
493 }
494 static inline int32_t LDKPaymentFailureReason_to_js(LDKPaymentFailureReason val) {
495         switch (val) {
496                 case LDKPaymentFailureReason_RecipientRejected: return 0;
497                 case LDKPaymentFailureReason_UserAbandoned: return 1;
498                 case LDKPaymentFailureReason_RetriesExhausted: return 2;
499                 case LDKPaymentFailureReason_PaymentExpired: return 3;
500                 case LDKPaymentFailureReason_RouteNotFound: return 4;
501                 case LDKPaymentFailureReason_UnexpectedError: return 5;
502                 default: abort();
503         }
504 }
505 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
506         switch (ord) {
507                 case 0: return LDKRecipient_Node;
508                 case 1: return LDKRecipient_PhantomNode;
509         }
510         abort();
511 }
512 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
513         switch (val) {
514                 case LDKRecipient_Node: return 0;
515                 case LDKRecipient_PhantomNode: return 1;
516                 default: abort();
517         }
518 }
519 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_js(int32_t ord) {
520         switch (ord) {
521                 case 0: return LDKRetryableSendFailure_PaymentExpired;
522                 case 1: return LDKRetryableSendFailure_RouteNotFound;
523                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
524         }
525         abort();
526 }
527 static inline int32_t LDKRetryableSendFailure_to_js(LDKRetryableSendFailure val) {
528         switch (val) {
529                 case LDKRetryableSendFailure_PaymentExpired: return 0;
530                 case LDKRetryableSendFailure_RouteNotFound: return 1;
531                 case LDKRetryableSendFailure_DuplicatePayment: return 2;
532                 default: abort();
533         }
534 }
535 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
536         switch (ord) {
537                 case 0: return LDKSecp256k1Error_IncorrectSignature;
538                 case 1: return LDKSecp256k1Error_InvalidMessage;
539                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
540                 case 3: return LDKSecp256k1Error_InvalidSignature;
541                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
542                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
543                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
544                 case 7: return LDKSecp256k1Error_InvalidTweak;
545                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
546                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
547                 case 10: return LDKSecp256k1Error_InvalidParityValue;
548         }
549         abort();
550 }
551 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
552         switch (val) {
553                 case LDKSecp256k1Error_IncorrectSignature: return 0;
554                 case LDKSecp256k1Error_InvalidMessage: return 1;
555                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
556                 case LDKSecp256k1Error_InvalidSignature: return 3;
557                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
558                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
559                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
560                 case LDKSecp256k1Error_InvalidTweak: return 7;
561                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
562                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
563                 case LDKSecp256k1Error_InvalidParityValue: return 10;
564                 default: abort();
565         }
566 }
567 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
568         switch (ord) {
569                 case 0: return LDKSiPrefix_Milli;
570                 case 1: return LDKSiPrefix_Micro;
571                 case 2: return LDKSiPrefix_Nano;
572                 case 3: return LDKSiPrefix_Pico;
573         }
574         abort();
575 }
576 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
577         switch (val) {
578                 case LDKSiPrefix_Milli: return 0;
579                 case LDKSiPrefix_Micro: return 1;
580                 case LDKSiPrefix_Nano: return 2;
581                 case LDKSiPrefix_Pico: return 3;
582                 default: abort();
583         }
584 }
585 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_js(int32_t ord) {
586         switch (ord) {
587                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
588                 case 1: return LDKSocketAddressParseError_InvalidInput;
589                 case 2: return LDKSocketAddressParseError_InvalidPort;
590                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
591         }
592         abort();
593 }
594 static inline int32_t LDKSocketAddressParseError_to_js(LDKSocketAddressParseError val) {
595         switch (val) {
596                 case LDKSocketAddressParseError_SocketAddrParse: return 0;
597                 case LDKSocketAddressParseError_InvalidInput: return 1;
598                 case LDKSocketAddressParseError_InvalidPort: return 2;
599                 case LDKSocketAddressParseError_InvalidOnionV3: return 3;
600                 default: abort();
601         }
602 }
603 static inline LDKUtxoLookupError LDKUtxoLookupError_from_js(int32_t ord) {
604         switch (ord) {
605                 case 0: return LDKUtxoLookupError_UnknownChain;
606                 case 1: return LDKUtxoLookupError_UnknownTx;
607         }
608         abort();
609 }
610 static inline int32_t LDKUtxoLookupError_to_js(LDKUtxoLookupError val) {
611         switch (val) {
612                 case LDKUtxoLookupError_UnknownChain: return 0;
613                 case LDKUtxoLookupError_UnknownTx: return 1;
614                 default: abort();
615         }
616 }
617 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
618         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
619         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
620         return ret;
621 }
622 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
623         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
624         return ret;
625 }
626 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
627         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
628         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
629         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
630         return ret_arr;
631 }
632
633 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
634 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
635         if (!ptr_is_owned(thing)) return;
636         void* thing_ptr = untag_ptr(thing);
637         CHECK_ACCESS(thing_ptr);
638         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
639         FREE(untag_ptr(thing));
640         BigEndianScalar_free(thing_conv);
641 }
642
643 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
644         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
645         switch(obj->tag) {
646                 case LDKBech32Error_MissingSeparator: return 0;
647                 case LDKBech32Error_InvalidChecksum: return 1;
648                 case LDKBech32Error_InvalidLength: return 2;
649                 case LDKBech32Error_InvalidChar: return 3;
650                 case LDKBech32Error_InvalidData: return 4;
651                 case LDKBech32Error_InvalidPadding: return 5;
652                 case LDKBech32Error_MixedCase: return 6;
653                 default: abort();
654         }
655 }
656 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
657         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
658         assert(obj->tag == LDKBech32Error_InvalidChar);
659         int32_t invalid_char_conv = obj->invalid_char;
660         return invalid_char_conv;
661 }
662 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
663         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
664         assert(obj->tag == LDKBech32Error_InvalidData);
665         int8_t invalid_data_conv = obj->invalid_data;
666         return invalid_data_conv;
667 }
668 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
669         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
670         switch(obj->tag) {
671                 case LDKCOption_u64Z_Some: return 0;
672                 case LDKCOption_u64Z_None: return 1;
673                 default: abort();
674         }
675 }
676 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
677         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
678         assert(obj->tag == LDKCOption_u64Z_Some);
679         int64_t some_conv = obj->some;
680         return some_conv;
681 }
682 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
683         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
684         for (size_t i = 0; i < ret.datalen; i++) {
685                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
686         }
687         return ret;
688 }
689 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
690         LDKRefund ret = *owner->contents.result;
691         ret.is_owned = false;
692         return ret;
693 }
694 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_ok"))) TS_CResult_RefundBolt12ParseErrorZ_get_ok(uint64_t owner) {
695         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
696         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
697         uint64_t ret_ref = 0;
698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
700         return ret_ref;
701 }
702
703 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
704         LDKBolt12ParseError ret = *owner->contents.err;
705         ret.is_owned = false;
706         return ret;
707 }
708 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_err"))) TS_CResult_RefundBolt12ParseErrorZ_get_err(uint64_t owner) {
709         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
710         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
711         uint64_t ret_ref = 0;
712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
714         return ret_ref;
715 }
716
717 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
718         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
719         switch(obj->tag) {
720                 case LDKRetry_Attempts: return 0;
721                 default: abort();
722         }
723 }
724 int32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
725         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
726         assert(obj->tag == LDKRetry_Attempts);
727         int32_t attempts_conv = obj->attempts;
728         return attempts_conv;
729 }
730 uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) {
731         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
732         switch(obj->tag) {
733                 case LDKDecodeError_UnknownVersion: return 0;
734                 case LDKDecodeError_UnknownRequiredFeature: return 1;
735                 case LDKDecodeError_InvalidValue: return 2;
736                 case LDKDecodeError_ShortRead: return 3;
737                 case LDKDecodeError_BadLengthDescriptor: return 4;
738                 case LDKDecodeError_Io: return 5;
739                 case LDKDecodeError_UnsupportedCompression: return 6;
740                 default: abort();
741         }
742 }
743 uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecodeError_Io_get_io(uint64_t ptr) {
744         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
745         assert(obj->tag == LDKDecodeError_Io);
746         uint32_t io_conv = LDKIOError_to_js(obj->io);
747         return io_conv;
748 }
749 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
750 CHECK(owner->result_ok);
751         return Retry_clone(&*owner->contents.result);
752 }
753 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_get_ok"))) TS_CResult_RetryDecodeErrorZ_get_ok(uint64_t owner) {
754         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
755         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
756         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
757         uint64_t ret_ref = tag_ptr(ret_copy, true);
758         return ret_ref;
759 }
760
761 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
762 CHECK(!owner->result_ok);
763         return DecodeError_clone(&*owner->contents.err);
764 }
765 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_get_err"))) TS_CResult_RetryDecodeErrorZ_get_err(uint64_t owner) {
766         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
767         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
768         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
769         uint64_t ret_ref = tag_ptr(ret_copy, true);
770         return ret_ref;
771 }
772
773 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
774         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
775         switch(obj->tag) {
776                 case LDKAPIError_APIMisuseError: return 0;
777                 case LDKAPIError_FeeRateTooHigh: return 1;
778                 case LDKAPIError_InvalidRoute: return 2;
779                 case LDKAPIError_ChannelUnavailable: return 3;
780                 case LDKAPIError_MonitorUpdateInProgress: return 4;
781                 case LDKAPIError_IncompatibleShutdownScript: return 5;
782                 default: abort();
783         }
784 }
785 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
786         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
787         assert(obj->tag == LDKAPIError_APIMisuseError);
788         LDKStr err_str = obj->api_misuse_error.err;
789                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
790         return err_conv;
791 }
792 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
793         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
794         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
795         LDKStr err_str = obj->fee_rate_too_high.err;
796                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
797         return err_conv;
798 }
799 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
800         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
801         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
802         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
803         return feerate_conv;
804 }
805 jstring __attribute__((export_name("TS_LDKAPIError_InvalidRoute_get_err"))) TS_LDKAPIError_InvalidRoute_get_err(uint64_t ptr) {
806         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
807         assert(obj->tag == LDKAPIError_InvalidRoute);
808         LDKStr err_str = obj->invalid_route.err;
809                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
810         return err_conv;
811 }
812 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
813         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
814         assert(obj->tag == LDKAPIError_ChannelUnavailable);
815         LDKStr err_str = obj->channel_unavailable.err;
816                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
817         return err_conv;
818 }
819 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
820         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
821         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
822         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
823                         uint64_t script_ref = 0;
824                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
825                         script_ref = tag_ptr(script_var.inner, false);
826         return script_ref;
827 }
828 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
829 CHECK(owner->result_ok);
830         return *owner->contents.result;
831 }
832 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
833         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
834         CResult_NoneAPIErrorZ_get_ok(owner_conv);
835 }
836
837 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
838 CHECK(!owner->result_ok);
839         return APIError_clone(&*owner->contents.err);
840 }
841 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
842         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
843         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
844         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
845         uint64_t ret_ref = tag_ptr(ret_copy, true);
846         return ret_ref;
847 }
848
849 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
850         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
851         for (size_t i = 0; i < ret.datalen; i++) {
852                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
853         }
854         return ret;
855 }
856 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
857         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
858         for (size_t i = 0; i < ret.datalen; i++) {
859                 ret.data[i] = APIError_clone(&orig->data[i]);
860         }
861         return ret;
862 }
863 uint32_t __attribute__((export_name("TS_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr"))) TS_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr(uint64_t ptr) {
864         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
865         switch(obj->tag) {
866                 case LDKCOption_ThirtyTwoBytesZ_Some: return 0;
867                 case LDKCOption_ThirtyTwoBytesZ_None: return 1;
868                 default: abort();
869         }
870 }
871 int8_tArray __attribute__((export_name("TS_LDKCOption_ThirtyTwoBytesZ_Some_get_some"))) TS_LDKCOption_ThirtyTwoBytesZ_Some_get_some(uint64_t ptr) {
872         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
873         assert(obj->tag == LDKCOption_ThirtyTwoBytesZ_Some);
874         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
875         memcpy(some_arr->elems, obj->some.data, 32);
876         return some_arr;
877 }
878 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_ty_from_ptr"))) TS_LDKCOption_CVec_u8ZZ_ty_from_ptr(uint64_t ptr) {
879         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
880         switch(obj->tag) {
881                 case LDKCOption_CVec_u8ZZ_Some: return 0;
882                 case LDKCOption_CVec_u8ZZ_None: return 1;
883                 default: abort();
884         }
885 }
886 int8_tArray __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_Some_get_some"))) TS_LDKCOption_CVec_u8ZZ_Some_get_some(uint64_t ptr) {
887         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
888         assert(obj->tag == LDKCOption_CVec_u8ZZ_Some);
889         LDKCVec_u8Z some_var = obj->some;
890                         int8_tArray some_arr = init_int8_tArray(some_var.datalen, __LINE__);
891                         memcpy(some_arr->elems, some_var.data, some_var.datalen);
892         return some_arr;
893 }
894 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
895         LDKRecipientOnionFields ret = *owner->contents.result;
896         ret.is_owned = false;
897         return ret;
898 }
899 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(uint64_t owner) {
900         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
901         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
902         uint64_t ret_ref = 0;
903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
905         return ret_ref;
906 }
907
908 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
909 CHECK(!owner->result_ok);
910         return DecodeError_clone(&*owner->contents.err);
911 }
912 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err(uint64_t owner) {
913         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
914         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
915         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
916         uint64_t ret_ref = tag_ptr(ret_copy, true);
917         return ret_ref;
918 }
919
920 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
921         return owner->a;
922 }
923 int64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_get_a"))) TS_C2Tuple_u64CVec_u8ZZ_get_a(uint64_t owner) {
924         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
925         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
926         return ret_conv;
927 }
928
929 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
930         return CVec_u8Z_clone(&owner->b);
931 }
932 int8_tArray  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_get_b"))) TS_C2Tuple_u64CVec_u8ZZ_get_b(uint64_t owner) {
933         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
934         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
935         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
936         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
937         CVec_u8Z_free(ret_var);
938         return ret_arr;
939 }
940
941 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
942         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
943         for (size_t i = 0; i < ret.datalen; i++) {
944                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
945         }
946         return ret;
947 }
948 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
949         LDKRecipientOnionFields ret = *owner->contents.result;
950         ret.is_owned = false;
951         return ret;
952 }
953 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_get_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_get_ok(uint64_t owner) {
954         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
955         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
956         uint64_t ret_ref = 0;
957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
959         return ret_ref;
960 }
961
962 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
963 CHECK(!owner->result_ok);
964         return *owner->contents.err;
965 }
966 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_get_err"))) TS_CResult_RecipientOnionFieldsNoneZ_get_err(uint64_t owner) {
967         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
968         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
969 }
970
971 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
972         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
973         for (size_t i = 0; i < ret.datalen; i++) {
974                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
975         }
976         return ret;
977 }
978 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr"))) TS_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr(uint64_t ptr) {
979         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
980         switch(obj->tag) {
981                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: return 0;
982                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: return 1;
983                 default: abort();
984         }
985 }
986 ptrArray __attribute__((export_name("TS_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some"))) TS_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some(uint64_t ptr) {
987         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
988         assert(obj->tag == LDKCOption_CVec_ThirtyTwoBytesZZ_Some);
989         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
990                         ptrArray some_arr = NULL;
991                         some_arr = init_ptrArray(some_var.datalen, __LINE__);
992                         int8_tArray *some_arr_ptr = (int8_tArray*)(((uint8_t*)some_arr) + 8);
993                         for (size_t m = 0; m < some_var.datalen; m++) {
994                                 int8_tArray some_conv_12_arr = init_int8_tArray(32, __LINE__);
995                                 memcpy(some_conv_12_arr->elems, some_var.data[m].data, 32);
996                                 some_arr_ptr[m] = some_conv_12_arr;
997                         }
998                         
999         return some_arr;
1000 }
1001 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1002 CHECK(owner->result_ok);
1003         return ThirtyTwoBytes_clone(&*owner->contents.result);
1004 }
1005 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_get_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_get_ok(uint64_t owner) {
1006         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1007         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1008         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data, 32);
1009         return ret_arr;
1010 }
1011
1012 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1013 CHECK(!owner->result_ok);
1014         return *owner->contents.err;
1015 }
1016 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_get_err"))) TS_CResult_ThirtyTwoBytesNoneZ_get_err(uint64_t owner) {
1017         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1018         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
1019 }
1020
1021 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1022         LDKBlindedPayInfo ret = *owner->contents.result;
1023         ret.is_owned = false;
1024         return ret;
1025 }
1026 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok(uint64_t owner) {
1027         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1028         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
1029         uint64_t ret_ref = 0;
1030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1032         return ret_ref;
1033 }
1034
1035 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1036 CHECK(!owner->result_ok);
1037         return DecodeError_clone(&*owner->contents.err);
1038 }
1039 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_err(uint64_t owner) {
1040         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1041         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1042         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
1043         uint64_t ret_ref = tag_ptr(ret_copy, true);
1044         return ret_ref;
1045 }
1046
1047 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1048         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
1049         ret.is_owned = false;
1050         return ret;
1051 }
1052 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1053         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1054         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1055         uint64_t ret_ref = 0;
1056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1058         return ret_ref;
1059 }
1060
1061 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1062 CHECK(!owner->result_ok);
1063         return DecodeError_clone(&*owner->contents.err);
1064 }
1065 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1066         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1067         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1068         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1069         uint64_t ret_ref = tag_ptr(ret_copy, true);
1070         return ret_ref;
1071 }
1072
1073 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1074         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
1075         ret.is_owned = false;
1076         return ret;
1077 }
1078 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1079         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1080         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1081         uint64_t ret_ref = 0;
1082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1084         return ret_ref;
1085 }
1086
1087 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1088 CHECK(!owner->result_ok);
1089         return DecodeError_clone(&*owner->contents.err);
1090 }
1091 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1092         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1093         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1094         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1095         uint64_t ret_ref = tag_ptr(ret_copy, true);
1096         return ret_ref;
1097 }
1098
1099 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1100         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1101         switch(obj->tag) {
1102                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1103                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1104                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1105                 default: abort();
1106         }
1107 }
1108 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1109         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1110         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1111         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1112                         uint64_t outpoint_ref = 0;
1113                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1114                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1115         return outpoint_ref;
1116 }
1117 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1118         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1119         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1120         LDKTxOut* output_ref = &obj->static_output.output;
1121         return tag_ptr(output_ref, false);
1122 }
1123 int8_tArray __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_channel_keys_id"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_channel_keys_id(uint64_t ptr) {
1124         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1125         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1126         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
1127         memcpy(channel_keys_id_arr->elems, obj->static_output.channel_keys_id.data, 32);
1128         return channel_keys_id_arr;
1129 }
1130 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1131         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1132         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1133         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1134                         uint64_t delayed_payment_output_ref = 0;
1135                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1136                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1137         return delayed_payment_output_ref;
1138 }
1139 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1140         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1141         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1142         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1143                         uint64_t static_payment_output_ref = 0;
1144                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1145                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1146         return static_payment_output_ref;
1147 }
1148 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1149 CHECK(owner->result_ok);
1150         return SpendableOutputDescriptor_clone(&*owner->contents.result);
1151 }
1152 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1153         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1154         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
1155         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1156         uint64_t ret_ref = tag_ptr(ret_copy, true);
1157         return ret_ref;
1158 }
1159
1160 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1161 CHECK(!owner->result_ok);
1162         return DecodeError_clone(&*owner->contents.err);
1163 }
1164 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1165         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1166         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1167         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1168         uint64_t ret_ref = tag_ptr(ret_copy, true);
1169         return ret_ref;
1170 }
1171
1172 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1173         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1174         for (size_t i = 0; i < ret.datalen; i++) {
1175                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1176         }
1177         return ret;
1178 }
1179 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
1180         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
1181         for (size_t i = 0; i < ret.datalen; i++) {
1182                 ret.data[i] = TxOut_clone(&orig->data[i]);
1183         }
1184         return ret;
1185 }
1186 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
1187         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1188         switch(obj->tag) {
1189                 case LDKCOption_u32Z_Some: return 0;
1190                 case LDKCOption_u32Z_None: return 1;
1191                 default: abort();
1192         }
1193 }
1194 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
1195         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1196         assert(obj->tag == LDKCOption_u32Z_Some);
1197         int32_t some_conv = obj->some;
1198         return some_conv;
1199 }
1200 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8Zu64Z_get_a(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
1201         return CVec_u8Z_clone(&owner->a);
1202 }
1203 int8_tArray  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_get_a"))) TS_C2Tuple_CVec_u8Zu64Z_get_a(uint64_t owner) {
1204         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
1205         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8Zu64Z_get_a(owner_conv);
1206         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1207         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1208         CVec_u8Z_free(ret_var);
1209         return ret_arr;
1210 }
1211
1212 static inline uint64_t C2Tuple_CVec_u8Zu64Z_get_b(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
1213         return owner->b;
1214 }
1215 int64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_get_b"))) TS_C2Tuple_CVec_u8Zu64Z_get_b(uint64_t owner) {
1216         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
1217         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_get_b(owner_conv);
1218         return ret_conv;
1219 }
1220
1221 static inline struct LDKC2Tuple_CVec_u8Zu64Z CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
1222 CHECK(owner->result_ok);
1223         return C2Tuple_CVec_u8Zu64Z_clone(&*owner->contents.result);
1224 }
1225 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(uint64_t owner) {
1226         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
1227         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
1228         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(owner_conv);
1229         return tag_ptr(ret_conv, true);
1230 }
1231
1232 static inline void CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
1233 CHECK(!owner->result_ok);
1234         return *owner->contents.err;
1235 }
1236 void  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(uint64_t owner) {
1237         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
1238         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(owner_conv);
1239 }
1240
1241 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1242         LDKChannelDerivationParameters ret = *owner->contents.result;
1243         ret.is_owned = false;
1244         return ret;
1245 }
1246 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(uint64_t owner) {
1247         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1248         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
1249         uint64_t ret_ref = 0;
1250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1252         return ret_ref;
1253 }
1254
1255 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1256 CHECK(!owner->result_ok);
1257         return DecodeError_clone(&*owner->contents.err);
1258 }
1259 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_err(uint64_t owner) {
1260         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1261         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1262         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
1263         uint64_t ret_ref = tag_ptr(ret_copy, true);
1264         return ret_ref;
1265 }
1266
1267 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1268         LDKHTLCDescriptor ret = *owner->contents.result;
1269         ret.is_owned = false;
1270         return ret;
1271 }
1272 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_get_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1273         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1274         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
1275         uint64_t ret_ref = 0;
1276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1278         return ret_ref;
1279 }
1280
1281 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1282 CHECK(!owner->result_ok);
1283         return DecodeError_clone(&*owner->contents.err);
1284 }
1285 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_get_err"))) TS_CResult_HTLCDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1286         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1287         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1288         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
1289         uint64_t ret_ref = tag_ptr(ret_copy, true);
1290         return ret_ref;
1291 }
1292
1293 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1294 CHECK(owner->result_ok);
1295         return *owner->contents.result;
1296 }
1297 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
1298         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1299         CResult_NoneNoneZ_get_ok(owner_conv);
1300 }
1301
1302 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1303 CHECK(!owner->result_ok);
1304         return *owner->contents.err;
1305 }
1306 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
1307         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1308         CResult_NoneNoneZ_get_err(owner_conv);
1309 }
1310
1311 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1312 CHECK(owner->result_ok);
1313         return *owner->contents.result;
1314 }
1315 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_ok"))) TS_CResult_PublicKeyNoneZ_get_ok(uint64_t owner) {
1316         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1317         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1318         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
1319         return ret_arr;
1320 }
1321
1322 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1323 CHECK(!owner->result_ok);
1324         return *owner->contents.err;
1325 }
1326 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_err"))) TS_CResult_PublicKeyNoneZ_get_err(uint64_t owner) {
1327         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1328         CResult_PublicKeyNoneZ_get_err(owner_conv);
1329 }
1330
1331 uint32_t __attribute__((export_name("TS_LDKCOption_BigEndianScalarZ_ty_from_ptr"))) TS_LDKCOption_BigEndianScalarZ_ty_from_ptr(uint64_t ptr) {
1332         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1333         switch(obj->tag) {
1334                 case LDKCOption_BigEndianScalarZ_Some: return 0;
1335                 case LDKCOption_BigEndianScalarZ_None: return 1;
1336                 default: abort();
1337         }
1338 }
1339 uint64_t __attribute__((export_name("TS_LDKCOption_BigEndianScalarZ_Some_get_some"))) TS_LDKCOption_BigEndianScalarZ_Some_get_some(uint64_t ptr) {
1340         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1341         assert(obj->tag == LDKCOption_BigEndianScalarZ_Some);
1342         LDKBigEndianScalar* some_ref = &obj->some;
1343         return tag_ptr(some_ref, false);
1344 }
1345 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1346 CHECK(owner->result_ok);
1347         return *owner->contents.result;
1348 }
1349 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
1350         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1351         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
1352         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
1353         return ret_arr;
1354 }
1355
1356 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1357 CHECK(!owner->result_ok);
1358         return *owner->contents.err;
1359 }
1360 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
1361         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1362         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
1363 }
1364
1365 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1366 CHECK(owner->result_ok);
1367         return *owner->contents.result;
1368 }
1369 int8_tArray  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_get_ok"))) TS_CResult_SchnorrSignatureNoneZ_get_ok(uint64_t owner) {
1370         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1371         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1372         memcpy(ret_arr->elems, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1373         return ret_arr;
1374 }
1375
1376 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1377 CHECK(!owner->result_ok);
1378         return *owner->contents.err;
1379 }
1380 void  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_get_err"))) TS_CResult_SchnorrSignatureNoneZ_get_err(uint64_t owner) {
1381         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1382         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
1383 }
1384
1385 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1386 CHECK(owner->result_ok);
1387         return *owner->contents.result;
1388 }
1389 int8_tArray  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_get_ok"))) TS_CResult_ECDSASignatureNoneZ_get_ok(uint64_t owner) {
1390         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1391         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1392         memcpy(ret_arr->elems, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1393         return ret_arr;
1394 }
1395
1396 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1397 CHECK(!owner->result_ok);
1398         return *owner->contents.err;
1399 }
1400 void  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_get_err"))) TS_CResult_ECDSASignatureNoneZ_get_err(uint64_t owner) {
1401         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1402         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
1403 }
1404
1405 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1406         return owner->a;
1407 }
1408 int8_tArray  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(uint64_t owner) {
1409         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1410         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1411         memcpy(ret_arr->elems, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form, 64);
1412         return ret_arr;
1413 }
1414
1415 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1416         return owner->b;
1417 }
1418 ptrArray  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(uint64_t owner) {
1419         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1420         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
1421         ptrArray ret_arr = NULL;
1422         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
1423         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1424         for (size_t m = 0; m < ret_var.datalen; m++) {
1425                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
1426                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1427                 ret_arr_ptr[m] = ret_conv_12_arr;
1428         }
1429         
1430         return ret_arr;
1431 }
1432
1433 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1434 CHECK(owner->result_ok);
1435         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
1436 }
1437 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(uint64_t owner) {
1438         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1439         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
1440         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
1441         return tag_ptr(ret_conv, true);
1442 }
1443
1444 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1445 CHECK(!owner->result_ok);
1446         return *owner->contents.err;
1447 }
1448 void  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(uint64_t owner) {
1449         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1450         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
1451 }
1452
1453 typedef struct LDKChannelSigner_JCalls {
1454         atomic_size_t refcnt;
1455         uint32_t instance_ptr;
1456 } LDKChannelSigner_JCalls;
1457 static void LDKChannelSigner_JCalls_free(void* this_arg) {
1458         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1459         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1460                 FREE(j_calls);
1461         }
1462 }
1463 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1464         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1465         int64_t idx_conv = idx;
1466         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 0, idx_conv, 0, 0, 0, 0, 0);
1467         LDKPublicKey ret_ref;
1468         CHECK(ret->arr_len == 33);
1469         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
1470         return ret_ref;
1471 }
1472 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1473         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1474         int64_t idx_conv = idx;
1475         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 1, idx_conv, 0, 0, 0, 0, 0);
1476         LDKThirtyTwoBytes ret_ref;
1477         CHECK(ret->arr_len == 32);
1478         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1479         return ret_ref;
1480 }
1481 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
1482         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1483         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1484         uint64_t holder_tx_ref = 0;
1485         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
1486         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1487         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
1488         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
1489         ptrArray outbound_htlc_preimages_arr = NULL;
1490         outbound_htlc_preimages_arr = init_ptrArray(outbound_htlc_preimages_var.datalen, __LINE__);
1491         int8_tArray *outbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)outbound_htlc_preimages_arr) + 8);
1492         for (size_t m = 0; m < outbound_htlc_preimages_var.datalen; m++) {
1493                 int8_tArray outbound_htlc_preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1494                 memcpy(outbound_htlc_preimages_conv_12_arr->elems, outbound_htlc_preimages_var.data[m].data, 32);
1495                 outbound_htlc_preimages_arr_ptr[m] = outbound_htlc_preimages_conv_12_arr;
1496         }
1497         
1498         FREE(outbound_htlc_preimages_var.data);
1499         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 2, holder_tx_ref, (uint32_t)outbound_htlc_preimages_arr, 0, 0, 0, 0);
1500         void* ret_ptr = untag_ptr(ret);
1501         CHECK_ACCESS(ret_ptr);
1502         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1503         FREE(untag_ptr(ret));
1504         return ret_conv;
1505 }
1506 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1507         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1508         int64_t idx_conv = idx;
1509         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
1510         memcpy(secret_arr->elems, *secret, 32);
1511         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 3, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
1512         void* ret_ptr = untag_ptr(ret);
1513         CHECK_ACCESS(ret_ptr);
1514         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1515         FREE(untag_ptr(ret));
1516         return ret_conv;
1517 }
1518 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
1519         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1520         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 4, 0, 0, 0, 0, 0, 0);
1521         LDKThirtyTwoBytes ret_ref;
1522         CHECK(ret->arr_len == 32);
1523         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1524         return ret_ref;
1525 }
1526 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1527         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1528         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1529         uint64_t channel_parameters_ref = 0;
1530         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
1531         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
1532         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
1533         js_invoke_function_buuuuu(j_calls->instance_ptr, 5, channel_parameters_ref, 0, 0, 0, 0, 0);
1534 }
1535 static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) {
1536         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg;
1537         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1538 }
1539 static inline LDKChannelSigner LDKChannelSigner_init (JSValue o, uint64_t pubkeys) {
1540         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
1541         atomic_init(&calls->refcnt, 1);
1542         calls->instance_ptr = o;
1543
1544         LDKChannelPublicKeys pubkeys_conv;
1545         pubkeys_conv.inner = untag_ptr(pubkeys);
1546         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1547         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1548
1549         LDKChannelSigner ret = {
1550                 .this_arg = (void*) calls,
1551                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
1552                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
1553                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
1554                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKChannelSigner_jcall,
1555                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
1556                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
1557                 .free = LDKChannelSigner_JCalls_free,
1558                 .pubkeys = pubkeys_conv,
1559                 .set_pubkeys = NULL,
1560         };
1561         return ret;
1562 }
1563 uint64_t  __attribute__((export_name("TS_LDKChannelSigner_new"))) TS_LDKChannelSigner_new(JSValue o, uint64_t pubkeys) {
1564         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
1565         *res_ptr = LDKChannelSigner_init(o, pubkeys);
1566         return tag_ptr(res_ptr, true);
1567 }
1568 int8_tArray  __attribute__((export_name("TS_ChannelSigner_get_per_commitment_point"))) TS_ChannelSigner_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
1569         void* this_arg_ptr = untag_ptr(this_arg);
1570         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1571         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1572         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1573         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1574         return ret_arr;
1575 }
1576
1577 int8_tArray  __attribute__((export_name("TS_ChannelSigner_release_commitment_secret"))) TS_ChannelSigner_release_commitment_secret(uint64_t this_arg, int64_t idx) {
1578         void* this_arg_ptr = untag_ptr(this_arg);
1579         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1580         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1581         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1582         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1583         return ret_arr;
1584 }
1585
1586 uint64_t  __attribute__((export_name("TS_ChannelSigner_validate_holder_commitment"))) TS_ChannelSigner_validate_holder_commitment(uint64_t this_arg, uint64_t holder_tx, ptrArray outbound_htlc_preimages) {
1587         void* this_arg_ptr = untag_ptr(this_arg);
1588         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1589         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1590         LDKHolderCommitmentTransaction holder_tx_conv;
1591         holder_tx_conv.inner = untag_ptr(holder_tx);
1592         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
1593         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
1594         holder_tx_conv.is_owned = false;
1595         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
1596         outbound_htlc_preimages_constr.datalen = outbound_htlc_preimages->arr_len;
1597         if (outbound_htlc_preimages_constr.datalen > 0)
1598                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
1599         else
1600                 outbound_htlc_preimages_constr.data = NULL;
1601         int8_tArray* outbound_htlc_preimages_vals = (void*) outbound_htlc_preimages->elems;
1602         for (size_t m = 0; m < outbound_htlc_preimages_constr.datalen; m++) {
1603                 int8_tArray outbound_htlc_preimages_conv_12 = outbound_htlc_preimages_vals[m];
1604                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_12_ref;
1605                 CHECK(outbound_htlc_preimages_conv_12->arr_len == 32);
1606                 memcpy(outbound_htlc_preimages_conv_12_ref.data, outbound_htlc_preimages_conv_12->elems, 32); FREE(outbound_htlc_preimages_conv_12);
1607                 outbound_htlc_preimages_constr.data[m] = outbound_htlc_preimages_conv_12_ref;
1608         }
1609         FREE(outbound_htlc_preimages);
1610         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1611         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, outbound_htlc_preimages_constr);
1612         return tag_ptr(ret_conv, true);
1613 }
1614
1615 uint64_t  __attribute__((export_name("TS_ChannelSigner_validate_counterparty_revocation"))) TS_ChannelSigner_validate_counterparty_revocation(uint64_t this_arg, int64_t idx, int8_tArray secret) {
1616         void* this_arg_ptr = untag_ptr(this_arg);
1617         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1618         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1619         uint8_t secret_arr[32];
1620         CHECK(secret->arr_len == 32);
1621         memcpy(secret_arr, secret->elems, 32); FREE(secret);
1622         uint8_t (*secret_ref)[32] = &secret_arr;
1623         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1624         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
1625         return tag_ptr(ret_conv, true);
1626 }
1627
1628 int8_tArray  __attribute__((export_name("TS_ChannelSigner_channel_keys_id"))) TS_ChannelSigner_channel_keys_id(uint64_t this_arg) {
1629         void* this_arg_ptr = untag_ptr(this_arg);
1630         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1631         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1632         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1633         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1634         return ret_arr;
1635 }
1636
1637 void  __attribute__((export_name("TS_ChannelSigner_provide_channel_parameters"))) TS_ChannelSigner_provide_channel_parameters(uint64_t this_arg, uint64_t channel_parameters) {
1638         void* this_arg_ptr = untag_ptr(this_arg);
1639         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1640         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1641         LDKChannelTransactionParameters channel_parameters_conv;
1642         channel_parameters_conv.inner = untag_ptr(channel_parameters);
1643         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
1644         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
1645         channel_parameters_conv.is_owned = false;
1646         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
1647 }
1648
1649 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
1650         if (this_arg->set_pubkeys != NULL)
1651                 this_arg->set_pubkeys(this_arg);
1652         return this_arg->pubkeys;
1653 }
1654 uint64_t  __attribute__((export_name("TS_ChannelSigner_get_pubkeys"))) TS_ChannelSigner_get_pubkeys(uint64_t this_arg) {
1655         void* this_arg_ptr = untag_ptr(this_arg);
1656         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1657         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1658         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
1659         uint64_t ret_ref = 0;
1660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1662         return ret_ref;
1663 }
1664
1665 typedef struct LDKEcdsaChannelSigner_JCalls {
1666         atomic_size_t refcnt;
1667         uint32_t instance_ptr;
1668         LDKChannelSigner_JCalls* ChannelSigner;
1669 } LDKEcdsaChannelSigner_JCalls;
1670 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
1671         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1672         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1673                 FREE(j_calls);
1674         }
1675 }
1676 LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
1677         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1678         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1679         uint64_t commitment_tx_ref = 0;
1680         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
1681         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1682         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1683         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_var = inbound_htlc_preimages;
1684         ptrArray inbound_htlc_preimages_arr = NULL;
1685         inbound_htlc_preimages_arr = init_ptrArray(inbound_htlc_preimages_var.datalen, __LINE__);
1686         int8_tArray *inbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)inbound_htlc_preimages_arr) + 8);
1687         for (size_t m = 0; m < inbound_htlc_preimages_var.datalen; m++) {
1688                 int8_tArray inbound_htlc_preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1689                 memcpy(inbound_htlc_preimages_conv_12_arr->elems, inbound_htlc_preimages_var.data[m].data, 32);
1690                 inbound_htlc_preimages_arr_ptr[m] = inbound_htlc_preimages_conv_12_arr;
1691         }
1692         
1693         FREE(inbound_htlc_preimages_var.data);
1694         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
1695         ptrArray outbound_htlc_preimages_arr = NULL;
1696         outbound_htlc_preimages_arr = init_ptrArray(outbound_htlc_preimages_var.datalen, __LINE__);
1697         int8_tArray *outbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)outbound_htlc_preimages_arr) + 8);
1698         for (size_t m = 0; m < outbound_htlc_preimages_var.datalen; m++) {
1699                 int8_tArray outbound_htlc_preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1700                 memcpy(outbound_htlc_preimages_conv_12_arr->elems, outbound_htlc_preimages_var.data[m].data, 32);
1701                 outbound_htlc_preimages_arr_ptr[m] = outbound_htlc_preimages_conv_12_arr;
1702         }
1703         
1704         FREE(outbound_htlc_preimages_var.data);
1705         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 6, commitment_tx_ref, (uint32_t)inbound_htlc_preimages_arr, (uint32_t)outbound_htlc_preimages_arr, 0, 0, 0);
1706         void* ret_ptr = untag_ptr(ret);
1707         CHECK_ACCESS(ret_ptr);
1708         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
1709         FREE(untag_ptr(ret));
1710         return ret_conv;
1711 }
1712 LDKCResult_ECDSASignatureNoneZ sign_holder_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1713         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1714         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1715         uint64_t commitment_tx_ref = 0;
1716         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
1717         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1718         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1719         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, commitment_tx_ref, 0, 0, 0, 0, 0);
1720         void* ret_ptr = untag_ptr(ret);
1721         CHECK_ACCESS(ret_ptr);
1722         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1723         FREE(untag_ptr(ret));
1724         return ret_conv;
1725 }
1726 LDKCResult_ECDSASignatureNoneZ sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) {
1727         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1728         LDKTransaction justice_tx_var = justice_tx;
1729         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1730         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1731         Transaction_free(justice_tx_var);
1732         uint32_t input_conv = input;
1733         int64_t amount_conv = amount;
1734         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1735         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1736         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);
1737         void* ret_ptr = untag_ptr(ret);
1738         CHECK_ACCESS(ret_ptr);
1739         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1740         FREE(untag_ptr(ret));
1741         return ret_conv;
1742 }
1743 LDKCResult_ECDSASignatureNoneZ sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
1744         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1745         LDKTransaction justice_tx_var = justice_tx;
1746         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1747         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1748         Transaction_free(justice_tx_var);
1749         uint32_t input_conv = input;
1750         int64_t amount_conv = amount;
1751         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1752         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1753         LDKHTLCOutputInCommitment htlc_var = *htlc;
1754         uint64_t htlc_ref = 0;
1755         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
1756         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1757         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
1758         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);
1759         void* ret_ptr = untag_ptr(ret);
1760         CHECK_ACCESS(ret_ptr);
1761         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1762         FREE(untag_ptr(ret));
1763         return ret_conv;
1764 }
1765 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
1766         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1767         LDKTransaction htlc_tx_var = htlc_tx;
1768         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
1769         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
1770         Transaction_free(htlc_tx_var);
1771         uint32_t input_conv = input;
1772         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
1773         uint64_t htlc_descriptor_ref = 0;
1774         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
1775         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
1776         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
1777         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);
1778         void* ret_ptr = untag_ptr(ret);
1779         CHECK_ACCESS(ret_ptr);
1780         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1781         FREE(untag_ptr(ret));
1782         return ret_conv;
1783 }
1784 LDKCResult_ECDSASignatureNoneZ sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
1785         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1786         LDKTransaction htlc_tx_var = htlc_tx;
1787         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
1788         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
1789         Transaction_free(htlc_tx_var);
1790         uint32_t input_conv = input;
1791         int64_t amount_conv = amount;
1792         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
1793         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
1794         LDKHTLCOutputInCommitment htlc_var = *htlc;
1795         uint64_t htlc_ref = 0;
1796         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
1797         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1798         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
1799         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);
1800         void* ret_ptr = untag_ptr(ret);
1801         CHECK_ACCESS(ret_ptr);
1802         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1803         FREE(untag_ptr(ret));
1804         return ret_conv;
1805 }
1806 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
1807         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1808         LDKClosingTransaction closing_tx_var = *closing_tx;
1809         uint64_t closing_tx_ref = 0;
1810         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
1811         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
1812         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
1813         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0);
1814         void* ret_ptr = untag_ptr(ret);
1815         CHECK_ACCESS(ret_ptr);
1816         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1817         FREE(untag_ptr(ret));
1818         return ret_conv;
1819 }
1820 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
1821         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1822         LDKTransaction anchor_tx_var = anchor_tx;
1823         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
1824         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
1825         Transaction_free(anchor_tx_var);
1826         uint32_t input_conv = input;
1827         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 13, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0);
1828         void* ret_ptr = untag_ptr(ret);
1829         CHECK_ACCESS(ret_ptr);
1830         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1831         FREE(untag_ptr(ret));
1832         return ret_conv;
1833 }
1834 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1835         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1836         LDKUnsignedChannelAnnouncement msg_var = *msg;
1837         uint64_t msg_ref = 0;
1838         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
1839         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1840         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
1841         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 14, msg_ref, 0, 0, 0, 0, 0);
1842         void* ret_ptr = untag_ptr(ret);
1843         CHECK_ACCESS(ret_ptr);
1844         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1845         FREE(untag_ptr(ret));
1846         return ret_conv;
1847 }
1848 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
1849         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
1850         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1851         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
1852 }
1853 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
1854         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
1855         atomic_init(&calls->refcnt, 1);
1856         calls->instance_ptr = o;
1857
1858         LDKChannelPublicKeys pubkeys_conv;
1859         pubkeys_conv.inner = untag_ptr(pubkeys);
1860         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1861         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1862
1863         LDKEcdsaChannelSigner ret = {
1864                 .this_arg = (void*) calls,
1865                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
1866                 .sign_holder_commitment = sign_holder_commitment_LDKEcdsaChannelSigner_jcall,
1867                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
1868                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
1869                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
1870                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
1871                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
1872                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
1873                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
1874                 .free = LDKEcdsaChannelSigner_JCalls_free,
1875                 .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys),
1876         };
1877         calls->ChannelSigner = ret.ChannelSigner.this_arg;
1878         return ret;
1879 }
1880 uint64_t  __attribute__((export_name("TS_LDKEcdsaChannelSigner_new"))) TS_LDKEcdsaChannelSigner_new(JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
1881         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
1882         *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys);
1883         return tag_ptr(res_ptr, true);
1884 }
1885 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_counterparty_commitment"))) TS_EcdsaChannelSigner_sign_counterparty_commitment(uint64_t this_arg, uint64_t commitment_tx, ptrArray inbound_htlc_preimages, ptrArray outbound_htlc_preimages) {
1886         void* this_arg_ptr = untag_ptr(this_arg);
1887         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1888         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1889         LDKCommitmentTransaction commitment_tx_conv;
1890         commitment_tx_conv.inner = untag_ptr(commitment_tx);
1891         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
1892         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
1893         commitment_tx_conv.is_owned = false;
1894         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_constr;
1895         inbound_htlc_preimages_constr.datalen = inbound_htlc_preimages->arr_len;
1896         if (inbound_htlc_preimages_constr.datalen > 0)
1897                 inbound_htlc_preimages_constr.data = MALLOC(inbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
1898         else
1899                 inbound_htlc_preimages_constr.data = NULL;
1900         int8_tArray* inbound_htlc_preimages_vals = (void*) inbound_htlc_preimages->elems;
1901         for (size_t m = 0; m < inbound_htlc_preimages_constr.datalen; m++) {
1902                 int8_tArray inbound_htlc_preimages_conv_12 = inbound_htlc_preimages_vals[m];
1903                 LDKThirtyTwoBytes inbound_htlc_preimages_conv_12_ref;
1904                 CHECK(inbound_htlc_preimages_conv_12->arr_len == 32);
1905                 memcpy(inbound_htlc_preimages_conv_12_ref.data, inbound_htlc_preimages_conv_12->elems, 32); FREE(inbound_htlc_preimages_conv_12);
1906                 inbound_htlc_preimages_constr.data[m] = inbound_htlc_preimages_conv_12_ref;
1907         }
1908         FREE(inbound_htlc_preimages);
1909         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
1910         outbound_htlc_preimages_constr.datalen = outbound_htlc_preimages->arr_len;
1911         if (outbound_htlc_preimages_constr.datalen > 0)
1912                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
1913         else
1914                 outbound_htlc_preimages_constr.data = NULL;
1915         int8_tArray* outbound_htlc_preimages_vals = (void*) outbound_htlc_preimages->elems;
1916         for (size_t m = 0; m < outbound_htlc_preimages_constr.datalen; m++) {
1917                 int8_tArray outbound_htlc_preimages_conv_12 = outbound_htlc_preimages_vals[m];
1918                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_12_ref;
1919                 CHECK(outbound_htlc_preimages_conv_12->arr_len == 32);
1920                 memcpy(outbound_htlc_preimages_conv_12_ref.data, outbound_htlc_preimages_conv_12->elems, 32); FREE(outbound_htlc_preimages_conv_12);
1921                 outbound_htlc_preimages_constr.data[m] = outbound_htlc_preimages_conv_12_ref;
1922         }
1923         FREE(outbound_htlc_preimages);
1924         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
1925         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, inbound_htlc_preimages_constr, outbound_htlc_preimages_constr);
1926         return tag_ptr(ret_conv, true);
1927 }
1928
1929 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_holder_commitment"))) TS_EcdsaChannelSigner_sign_holder_commitment(uint64_t this_arg, uint64_t commitment_tx) {
1930         void* this_arg_ptr = untag_ptr(this_arg);
1931         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1932         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1933         LDKHolderCommitmentTransaction commitment_tx_conv;
1934         commitment_tx_conv.inner = untag_ptr(commitment_tx);
1935         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
1936         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
1937         commitment_tx_conv.is_owned = false;
1938         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1939         *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1940         return tag_ptr(ret_conv, true);
1941 }
1942
1943 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) {
1944         void* this_arg_ptr = untag_ptr(this_arg);
1945         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1946         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1947         LDKTransaction justice_tx_ref;
1948         justice_tx_ref.datalen = justice_tx->arr_len;
1949         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1950         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
1951         justice_tx_ref.data_is_owned = true;
1952         uint8_t per_commitment_key_arr[32];
1953         CHECK(per_commitment_key->arr_len == 32);
1954         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
1955         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1956         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1957         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
1958         return tag_ptr(ret_conv, true);
1959 }
1960
1961 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) {
1962         void* this_arg_ptr = untag_ptr(this_arg);
1963         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1964         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1965         LDKTransaction justice_tx_ref;
1966         justice_tx_ref.datalen = justice_tx->arr_len;
1967         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1968         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
1969         justice_tx_ref.data_is_owned = true;
1970         uint8_t per_commitment_key_arr[32];
1971         CHECK(per_commitment_key->arr_len == 32);
1972         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
1973         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1974         LDKHTLCOutputInCommitment htlc_conv;
1975         htlc_conv.inner = untag_ptr(htlc);
1976         htlc_conv.is_owned = ptr_is_owned(htlc);
1977         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
1978         htlc_conv.is_owned = false;
1979         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1980         *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);
1981         return tag_ptr(ret_conv, true);
1982 }
1983
1984 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) {
1985         void* this_arg_ptr = untag_ptr(this_arg);
1986         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1987         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1988         LDKTransaction htlc_tx_ref;
1989         htlc_tx_ref.datalen = htlc_tx->arr_len;
1990         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1991         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
1992         htlc_tx_ref.data_is_owned = true;
1993         LDKHTLCDescriptor htlc_descriptor_conv;
1994         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
1995         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
1996         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
1997         htlc_descriptor_conv.is_owned = false;
1998         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1999         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
2000         return tag_ptr(ret_conv, true);
2001 }
2002
2003 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) {
2004         void* this_arg_ptr = untag_ptr(this_arg);
2005         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2006         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2007         LDKTransaction htlc_tx_ref;
2008         htlc_tx_ref.datalen = htlc_tx->arr_len;
2009         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2010         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2011         htlc_tx_ref.data_is_owned = true;
2012         LDKPublicKey per_commitment_point_ref;
2013         CHECK(per_commitment_point->arr_len == 33);
2014         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
2015         LDKHTLCOutputInCommitment htlc_conv;
2016         htlc_conv.inner = untag_ptr(htlc);
2017         htlc_conv.is_owned = ptr_is_owned(htlc);
2018         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2019         htlc_conv.is_owned = false;
2020         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2021         *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);
2022         return tag_ptr(ret_conv, true);
2023 }
2024
2025 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_closing_transaction"))) TS_EcdsaChannelSigner_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
2026         void* this_arg_ptr = untag_ptr(this_arg);
2027         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2028         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2029         LDKClosingTransaction closing_tx_conv;
2030         closing_tx_conv.inner = untag_ptr(closing_tx);
2031         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
2032         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2033         closing_tx_conv.is_owned = false;
2034         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2035         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2036         return tag_ptr(ret_conv, true);
2037 }
2038
2039 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) {
2040         void* this_arg_ptr = untag_ptr(this_arg);
2041         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2042         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2043         LDKTransaction anchor_tx_ref;
2044         anchor_tx_ref.datalen = anchor_tx->arr_len;
2045         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
2046         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
2047         anchor_tx_ref.data_is_owned = true;
2048         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2049         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
2050         return tag_ptr(ret_conv, true);
2051 }
2052
2053 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) {
2054         void* this_arg_ptr = untag_ptr(this_arg);
2055         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2056         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2057         LDKUnsignedChannelAnnouncement msg_conv;
2058         msg_conv.inner = untag_ptr(msg);
2059         msg_conv.is_owned = ptr_is_owned(msg);
2060         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2061         msg_conv.is_owned = false;
2062         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2063         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
2064         return tag_ptr(ret_conv, true);
2065 }
2066
2067 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
2068         atomic_size_t refcnt;
2069         uint32_t instance_ptr;
2070         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
2071         LDKChannelSigner_JCalls* ChannelSigner;
2072 } LDKWriteableEcdsaChannelSigner_JCalls;
2073 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
2074         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2075         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2076                 FREE(j_calls);
2077         }
2078 }
2079 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
2080         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2081         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 15, 0, 0, 0, 0, 0, 0);
2082         LDKCVec_u8Z ret_ref;
2083         ret_ref.datalen = ret->arr_len;
2084         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2085         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
2086         return ret_ref;
2087 }
2088 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
2089         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2090         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2091         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
2092         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
2093 }
2094 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2095         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
2096         atomic_init(&calls->refcnt, 1);
2097         calls->instance_ptr = o;
2098
2099         LDKChannelPublicKeys pubkeys_conv;
2100         pubkeys_conv.inner = untag_ptr(pubkeys);
2101         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2102         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2103
2104         LDKWriteableEcdsaChannelSigner ret = {
2105                 .this_arg = (void*) calls,
2106                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
2107                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
2108                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
2109                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys),
2110         };
2111         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
2112         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
2113         return ret;
2114 }
2115 uint64_t  __attribute__((export_name("TS_LDKWriteableEcdsaChannelSigner_new"))) TS_LDKWriteableEcdsaChannelSigner_new(JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2116         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2117         *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys);
2118         return tag_ptr(res_ptr, true);
2119 }
2120 int8_tArray  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_write"))) TS_WriteableEcdsaChannelSigner_write(uint64_t this_arg) {
2121         void* this_arg_ptr = untag_ptr(this_arg);
2122         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2123         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
2124         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2125         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2126         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2127         CVec_u8Z_free(ret_var);
2128         return ret_arr;
2129 }
2130
2131 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2132 CHECK(owner->result_ok);
2133         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
2134 }
2135 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(uint64_t owner) {
2136         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2137         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2138         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
2139         return tag_ptr(ret_ret, true);
2140 }
2141
2142 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2143 CHECK(!owner->result_ok);
2144         return DecodeError_clone(&*owner->contents.err);
2145 }
2146 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(uint64_t owner) {
2147         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2148         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2149         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
2150         uint64_t ret_ref = tag_ptr(ret_copy, true);
2151         return ret_ref;
2152 }
2153
2154 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2155 CHECK(owner->result_ok);
2156         return CVec_u8Z_clone(&*owner->contents.result);
2157 }
2158 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_get_ok"))) TS_CResult_CVec_u8ZNoneZ_get_ok(uint64_t owner) {
2159         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2160         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
2161         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2162         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2163         CVec_u8Z_free(ret_var);
2164         return ret_arr;
2165 }
2166
2167 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2168 CHECK(!owner->result_ok);
2169         return *owner->contents.err;
2170 }
2171 void  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_get_err"))) TS_CResult_CVec_u8ZNoneZ_get_err(uint64_t owner) {
2172         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2173         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
2174 }
2175
2176 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2177         LDKShutdownScript ret = *owner->contents.result;
2178         ret.is_owned = false;
2179         return ret;
2180 }
2181 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_ok"))) TS_CResult_ShutdownScriptNoneZ_get_ok(uint64_t owner) {
2182         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2183         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
2184         uint64_t ret_ref = 0;
2185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2187         return ret_ref;
2188 }
2189
2190 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2191 CHECK(!owner->result_ok);
2192         return *owner->contents.err;
2193 }
2194 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_err"))) TS_CResult_ShutdownScriptNoneZ_get_err(uint64_t owner) {
2195         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2196         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
2197 }
2198
2199 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
2200         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2201         switch(obj->tag) {
2202                 case LDKCOption_u16Z_Some: return 0;
2203                 case LDKCOption_u16Z_None: return 1;
2204                 default: abort();
2205         }
2206 }
2207 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
2208         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2209         assert(obj->tag == LDKCOption_u16Z_Some);
2210         int16_t some_conv = obj->some;
2211         return some_conv;
2212 }
2213 uint32_t __attribute__((export_name("TS_LDKCOption_boolZ_ty_from_ptr"))) TS_LDKCOption_boolZ_ty_from_ptr(uint64_t ptr) {
2214         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2215         switch(obj->tag) {
2216                 case LDKCOption_boolZ_Some: return 0;
2217                 case LDKCOption_boolZ_None: return 1;
2218                 default: abort();
2219         }
2220 }
2221 jboolean __attribute__((export_name("TS_LDKCOption_boolZ_Some_get_some"))) TS_LDKCOption_boolZ_Some_get_some(uint64_t ptr) {
2222         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2223         assert(obj->tag == LDKCOption_boolZ_Some);
2224         jboolean some_conv = obj->some;
2225         return some_conv;
2226 }
2227 static inline struct LDKWitness CResult_WitnessNoneZ_get_ok(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
2228 CHECK(owner->result_ok);
2229         return Witness_clone(&*owner->contents.result);
2230 }
2231 int8_tArray  __attribute__((export_name("TS_CResult_WitnessNoneZ_get_ok"))) TS_CResult_WitnessNoneZ_get_ok(uint64_t owner) {
2232         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
2233         LDKWitness ret_var = CResult_WitnessNoneZ_get_ok(owner_conv);
2234         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2235         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2236         Witness_free(ret_var);
2237         return ret_arr;
2238 }
2239
2240 static inline void CResult_WitnessNoneZ_get_err(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
2241 CHECK(!owner->result_ok);
2242         return *owner->contents.err;
2243 }
2244 void  __attribute__((export_name("TS_CResult_WitnessNoneZ_get_err"))) TS_CResult_WitnessNoneZ_get_err(uint64_t owner) {
2245         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
2246         CResult_WitnessNoneZ_get_err(owner_conv);
2247 }
2248
2249 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2250         LDKInMemorySigner ret = *owner->contents.result;
2251         ret.is_owned = false;
2252         return ret;
2253 }
2254 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
2255         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2256         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
2257         uint64_t ret_ref = 0;
2258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2260         return ret_ref;
2261 }
2262
2263 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2264 CHECK(!owner->result_ok);
2265         return DecodeError_clone(&*owner->contents.err);
2266 }
2267 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
2268         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2269         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2270         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
2271         uint64_t ret_ref = tag_ptr(ret_copy, true);
2272         return ret_ref;
2273 }
2274
2275 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2276 CHECK(owner->result_ok);
2277         return *owner->contents.result;
2278 }
2279 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
2280         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2281         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
2282         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2283         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2284         return ret_arr;
2285 }
2286
2287 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2288 CHECK(!owner->result_ok);
2289         return *owner->contents.err;
2290 }
2291 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
2292         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2293         CResult_TransactionNoneZ_get_err(owner_conv);
2294 }
2295
2296 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2297         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2298         for (size_t i = 0; i < ret.datalen; i++) {
2299                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2300         }
2301         return ret;
2302 }
2303 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2304         LDKRoute ret = *owner->contents.result;
2305         ret.is_owned = false;
2306         return ret;
2307 }
2308 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
2309         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2310         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
2311         uint64_t ret_ref = 0;
2312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2314         return ret_ref;
2315 }
2316
2317 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2318         LDKLightningError ret = *owner->contents.err;
2319         ret.is_owned = false;
2320         return ret;
2321 }
2322 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
2323         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2324         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
2325         uint64_t ret_ref = 0;
2326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2328         return ret_ref;
2329 }
2330
2331 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2332         LDKBlindedPayInfo ret = owner->a;
2333         ret.is_owned = false;
2334         return ret;
2335 }
2336 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a(uint64_t owner) {
2337         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2338         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
2339         uint64_t ret_ref = 0;
2340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2342         return ret_ref;
2343 }
2344
2345 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2346         LDKBlindedPath ret = owner->b;
2347         ret.is_owned = false;
2348         return ret;
2349 }
2350 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b(uint64_t owner) {
2351         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2352         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
2353         uint64_t ret_ref = 0;
2354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2356         return ret_ref;
2357 }
2358
2359 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
2360         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
2361         for (size_t i = 0; i < ret.datalen; i++) {
2362                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
2363         }
2364         return ret;
2365 }
2366 static inline struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
2367 CHECK(owner->result_ok);
2368         return CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(&*owner->contents.result);
2369 }
2370 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(uint64_t owner) {
2371         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
2372         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret_var = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(owner_conv);
2373         uint64_tArray ret_arr = NULL;
2374         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2375         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2376         for (size_t l = 0; l < ret_var.datalen; l++) {
2377                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
2378                 *ret_conv_37_conv = ret_var.data[l];
2379                 ret_arr_ptr[l] = tag_ptr(ret_conv_37_conv, true);
2380         }
2381         
2382         FREE(ret_var.data);
2383         return ret_arr;
2384 }
2385
2386 static inline void CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
2387 CHECK(!owner->result_ok);
2388         return *owner->contents.err;
2389 }
2390 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(uint64_t owner) {
2391         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
2392         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(owner_conv);
2393 }
2394
2395 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
2396         LDKOnionMessagePath ret = *owner->contents.result;
2397         ret.is_owned = false;
2398         return ret;
2399 }
2400 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_ok"))) TS_CResult_OnionMessagePathNoneZ_get_ok(uint64_t owner) {
2401         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
2402         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
2403         uint64_t ret_ref = 0;
2404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2406         return ret_ref;
2407 }
2408
2409 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
2410 CHECK(!owner->result_ok);
2411         return *owner->contents.err;
2412 }
2413 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_err"))) TS_CResult_OnionMessagePathNoneZ_get_err(uint64_t owner) {
2414         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
2415         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
2416 }
2417
2418 static inline struct LDKCVec_BlindedPathZ CResult_CVec_BlindedPathZNoneZ_get_ok(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
2419 CHECK(owner->result_ok);
2420         return CVec_BlindedPathZ_clone(&*owner->contents.result);
2421 }
2422 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_get_ok"))) TS_CResult_CVec_BlindedPathZNoneZ_get_ok(uint64_t owner) {
2423         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
2424         LDKCVec_BlindedPathZ ret_var = CResult_CVec_BlindedPathZNoneZ_get_ok(owner_conv);
2425         uint64_tArray ret_arr = NULL;
2426         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2427         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2428         for (size_t n = 0; n < ret_var.datalen; n++) {
2429                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
2430                 uint64_t ret_conv_13_ref = 0;
2431                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
2432                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
2433                 ret_arr_ptr[n] = ret_conv_13_ref;
2434         }
2435         
2436         FREE(ret_var.data);
2437         return ret_arr;
2438 }
2439
2440 static inline void CResult_CVec_BlindedPathZNoneZ_get_err(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
2441 CHECK(!owner->result_ok);
2442         return *owner->contents.err;
2443 }
2444 void  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_get_err"))) TS_CResult_CVec_BlindedPathZNoneZ_get_err(uint64_t owner) {
2445         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
2446         CResult_CVec_BlindedPathZNoneZ_get_err(owner_conv);
2447 }
2448
2449 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2450         LDKInFlightHtlcs ret = *owner->contents.result;
2451         ret.is_owned = false;
2452         return ret;
2453 }
2454 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
2455         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2456         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
2457         uint64_t ret_ref = 0;
2458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2460         return ret_ref;
2461 }
2462
2463 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2464 CHECK(!owner->result_ok);
2465         return DecodeError_clone(&*owner->contents.err);
2466 }
2467 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
2468         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2469         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2470         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
2471         uint64_t ret_ref = tag_ptr(ret_copy, true);
2472         return ret_ref;
2473 }
2474
2475 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2476         LDKRouteHop ret = *owner->contents.result;
2477         ret.is_owned = false;
2478         return ret;
2479 }
2480 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
2481         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2482         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
2483         uint64_t ret_ref = 0;
2484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2486         return ret_ref;
2487 }
2488
2489 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2490 CHECK(!owner->result_ok);
2491         return DecodeError_clone(&*owner->contents.err);
2492 }
2493 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
2494         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2495         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2496         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
2497         uint64_t ret_ref = tag_ptr(ret_copy, true);
2498         return ret_ref;
2499 }
2500
2501 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
2502         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
2503         for (size_t i = 0; i < ret.datalen; i++) {
2504                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
2505         }
2506         return ret;
2507 }
2508 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2509         LDKBlindedTail ret = *owner->contents.result;
2510         ret.is_owned = false;
2511         return ret;
2512 }
2513 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_ok"))) TS_CResult_BlindedTailDecodeErrorZ_get_ok(uint64_t owner) {
2514         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2515         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
2516         uint64_t ret_ref = 0;
2517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2519         return ret_ref;
2520 }
2521
2522 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2523 CHECK(!owner->result_ok);
2524         return DecodeError_clone(&*owner->contents.err);
2525 }
2526 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_err"))) TS_CResult_BlindedTailDecodeErrorZ_get_err(uint64_t owner) {
2527         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2528         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2529         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
2530         uint64_t ret_ref = tag_ptr(ret_copy, true);
2531         return ret_ref;
2532 }
2533
2534 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
2535         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
2536         for (size_t i = 0; i < ret.datalen; i++) {
2537                 ret.data[i] = RouteHop_clone(&orig->data[i]);
2538         }
2539         return ret;
2540 }
2541 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
2542         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
2543         for (size_t i = 0; i < ret.datalen; i++) {
2544                 ret.data[i] = Path_clone(&orig->data[i]);
2545         }
2546         return ret;
2547 }
2548 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2549         LDKRoute ret = *owner->contents.result;
2550         ret.is_owned = false;
2551         return ret;
2552 }
2553 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
2554         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2555         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
2556         uint64_t ret_ref = 0;
2557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2559         return ret_ref;
2560 }
2561
2562 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2563 CHECK(!owner->result_ok);
2564         return DecodeError_clone(&*owner->contents.err);
2565 }
2566 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
2567         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2568         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2569         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
2570         uint64_t ret_ref = tag_ptr(ret_copy, true);
2571         return ret_ref;
2572 }
2573
2574 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2575         LDKRouteParameters ret = *owner->contents.result;
2576         ret.is_owned = false;
2577         return ret;
2578 }
2579 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
2580         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2581         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
2582         uint64_t ret_ref = 0;
2583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2585         return ret_ref;
2586 }
2587
2588 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2589 CHECK(!owner->result_ok);
2590         return DecodeError_clone(&*owner->contents.err);
2591 }
2592 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
2593         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2594         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2595         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
2596         uint64_t ret_ref = tag_ptr(ret_copy, true);
2597         return ret_ref;
2598 }
2599
2600 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2601         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2602         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2603         return ret;
2604 }
2605 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2606         LDKPaymentParameters ret = *owner->contents.result;
2607         ret.is_owned = false;
2608         return ret;
2609 }
2610 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
2611         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2612         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
2613         uint64_t ret_ref = 0;
2614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2616         return ret_ref;
2617 }
2618
2619 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2620 CHECK(!owner->result_ok);
2621         return DecodeError_clone(&*owner->contents.err);
2622 }
2623 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
2624         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2625         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2626         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
2627         uint64_t ret_ref = tag_ptr(ret_copy, true);
2628         return ret_ref;
2629 }
2630
2631 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2632         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2633         for (size_t i = 0; i < ret.datalen; i++) {
2634                 ret.data[i] = RouteHint_clone(&orig->data[i]);
2635         }
2636         return ret;
2637 }
2638 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
2639         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
2640         for (size_t i = 0; i < ret.datalen; i++) {
2641                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
2642         }
2643         return ret;
2644 }
2645 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2646         LDKRouteHint ret = *owner->contents.result;
2647         ret.is_owned = false;
2648         return ret;
2649 }
2650 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
2651         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2652         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
2653         uint64_t ret_ref = 0;
2654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2656         return ret_ref;
2657 }
2658
2659 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2660 CHECK(!owner->result_ok);
2661         return DecodeError_clone(&*owner->contents.err);
2662 }
2663 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
2664         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2665         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2666         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
2667         uint64_t ret_ref = tag_ptr(ret_copy, true);
2668         return ret_ref;
2669 }
2670
2671 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2672         LDKRouteHintHop ret = *owner->contents.result;
2673         ret.is_owned = false;
2674         return ret;
2675 }
2676 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
2677         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2678         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
2679         uint64_t ret_ref = 0;
2680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2682         return ret_ref;
2683 }
2684
2685 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2686 CHECK(!owner->result_ok);
2687         return DecodeError_clone(&*owner->contents.err);
2688 }
2689 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
2690         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2691         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2692         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
2693         uint64_t ret_ref = tag_ptr(ret_copy, true);
2694         return ret_ref;
2695 }
2696
2697 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2698         LDKFixedPenaltyScorer ret = *owner->contents.result;
2699         ret.is_owned = false;
2700         return ret;
2701 }
2702 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
2703         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2704         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2705         uint64_t ret_ref = 0;
2706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2708         return ret_ref;
2709 }
2710
2711 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2712 CHECK(!owner->result_ok);
2713         return DecodeError_clone(&*owner->contents.err);
2714 }
2715 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
2716         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2717         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2718         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2719         uint64_t ret_ref = tag_ptr(ret_copy, true);
2720         return ret_ref;
2721 }
2722
2723 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
2724         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
2725         for (size_t i = 0; i < ret.datalen; i++) {
2726                 ret.data[i] = NodeId_clone(&orig->data[i]);
2727         }
2728         return ret;
2729 }
2730 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2731         return owner->a;
2732 }
2733 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
2734         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2735         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2736         return ret_conv;
2737 }
2738
2739 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2740         return owner->b;
2741 }
2742 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
2743         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2744         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2745         return ret_conv;
2746 }
2747
2748 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
2749         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2750         switch(obj->tag) {
2751                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2752                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2753                 default: abort();
2754         }
2755 }
2756 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
2757         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2758         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2759         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2760         *some_conv = obj->some;
2761                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2762         return tag_ptr(some_conv, true);
2763 }
2764 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
2765         return owner->a;
2766 }
2767 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_a"))) TS_C2Tuple_Z_get_a(uint64_t owner) {
2768         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2769         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2770         memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 32 * 2);
2771         return ret_arr;
2772 }
2773
2774 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
2775         return owner->b;
2776 }
2777 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_b"))) TS_C2Tuple_Z_get_b(uint64_t owner) {
2778         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2779         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2780         memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 32 * 2);
2781         return ret_arr;
2782 }
2783
2784 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
2785         return owner->a;
2786 }
2787 int16_tArray  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_get_a"))) TS_C2Tuple__u1632_u1632Z_get_a(uint64_t owner) {
2788         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
2789         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2790         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_a(owner_conv).data, 32 * 2);
2791         return ret_arr;
2792 }
2793
2794 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
2795         return owner->b;
2796 }
2797 int16_tArray  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_get_b"))) TS_C2Tuple__u1632_u1632Z_get_b(uint64_t owner) {
2798         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
2799         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2800         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_b(owner_conv).data, 32 * 2);
2801         return ret_arr;
2802 }
2803
2804 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr(uint64_t ptr) {
2805         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
2806         switch(obj->tag) {
2807                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: return 0;
2808                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: return 1;
2809                 default: abort();
2810         }
2811 }
2812 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some(uint64_t ptr) {
2813         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
2814         assert(obj->tag == LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some);
2815         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
2816                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
2817         return tag_ptr(some_conv, false);
2818 }
2819 uint32_t __attribute__((export_name("TS_LDKCOption_f64Z_ty_from_ptr"))) TS_LDKCOption_f64Z_ty_from_ptr(uint64_t ptr) {
2820         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
2821         switch(obj->tag) {
2822                 case LDKCOption_f64Z_Some: return 0;
2823                 case LDKCOption_f64Z_None: return 1;
2824                 default: abort();
2825         }
2826 }
2827 double __attribute__((export_name("TS_LDKCOption_f64Z_Some_get_some"))) TS_LDKCOption_f64Z_Some_get_some(uint64_t ptr) {
2828         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
2829         assert(obj->tag == LDKCOption_f64Z_Some);
2830         double some_conv = obj->some;
2831         return some_conv;
2832 }
2833 typedef struct LDKLogger_JCalls {
2834         atomic_size_t refcnt;
2835         uint32_t instance_ptr;
2836 } LDKLogger_JCalls;
2837 static void LDKLogger_JCalls_free(void* this_arg) {
2838         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2839         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2840                 FREE(j_calls);
2841         }
2842 }
2843 void log_LDKLogger_jcall(const void* this_arg, LDKRecord record) {
2844         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2845         LDKRecord record_var = record;
2846         uint64_t record_ref = 0;
2847         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
2848         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
2849         js_invoke_function_buuuuu(j_calls->instance_ptr, 16, record_ref, 0, 0, 0, 0, 0);
2850 }
2851 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2852         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2853         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2854 }
2855 static inline LDKLogger LDKLogger_init (JSValue o) {
2856         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2857         atomic_init(&calls->refcnt, 1);
2858         calls->instance_ptr = o;
2859
2860         LDKLogger ret = {
2861                 .this_arg = (void*) calls,
2862                 .log = log_LDKLogger_jcall,
2863                 .free = LDKLogger_JCalls_free,
2864         };
2865         return ret;
2866 }
2867 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
2868         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2869         *res_ptr = LDKLogger_init(o);
2870         return tag_ptr(res_ptr, true);
2871 }
2872 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2873         LDKProbabilisticScorer ret = *owner->contents.result;
2874         ret.is_owned = false;
2875         return ret;
2876 }
2877 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
2878         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2879         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
2880         uint64_t ret_ref = 0;
2881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2883         return ret_ref;
2884 }
2885
2886 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2887 CHECK(!owner->result_ok);
2888         return DecodeError_clone(&*owner->contents.err);
2889 }
2890 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
2891         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2892         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2893         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
2894         uint64_t ret_ref = tag_ptr(ret_copy, true);
2895         return ret_ref;
2896 }
2897
2898 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2899         return owner->a;
2900 }
2901 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
2902         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2903         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2904         return ret_conv;
2905 }
2906
2907 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2908         return owner->b;
2909 }
2910 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
2911         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2912         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2913         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2914         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2915         return ret_arr;
2916 }
2917
2918 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2919         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2920         for (size_t i = 0; i < ret.datalen; i++) {
2921                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2922         }
2923         return ret;
2924 }
2925 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
2926         return ThirtyTwoBytes_clone(&owner->a);
2927 }
2928 int8_tArray  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(uint64_t owner) {
2929         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
2930         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2931         memcpy(ret_arr->elems, C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(owner_conv).data, 32);
2932         return ret_arr;
2933 }
2934
2935 static inline uint32_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
2936         return owner->b;
2937 }
2938 int32_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(uint64_t owner) {
2939         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
2940         int32_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(owner_conv);
2941         return ret_conv;
2942 }
2943
2944 static inline struct LDKCOption_ThirtyTwoBytesZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
2945         return COption_ThirtyTwoBytesZ_clone(&owner->c);
2946 }
2947 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(uint64_t owner) {
2948         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
2949         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
2950         *ret_copy = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(owner_conv);
2951         uint64_t ret_ref = tag_ptr(ret_copy, true);
2952         return ret_ref;
2953 }
2954
2955 static inline LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ *orig) {
2956         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
2957         for (size_t i = 0; i < ret.datalen; i++) {
2958                 ret.data[i] = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
2959         }
2960         return ret;
2961 }
2962 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
2963 CHECK(owner->result_ok);
2964         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
2965 }
2966 uint32_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(uint64_t owner) {
2967         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
2968         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
2969         return ret_conv;
2970 }
2971
2972 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
2973 CHECK(!owner->result_ok);
2974         return *owner->contents.err;
2975 }
2976 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_err"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_err(uint64_t owner) {
2977         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
2978         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
2979 }
2980
2981 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
2982         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2983         switch(obj->tag) {
2984                 case LDKMonitorEvent_HTLCEvent: return 0;
2985                 case LDKMonitorEvent_HolderForceClosed: return 1;
2986                 case LDKMonitorEvent_Completed: return 2;
2987                 default: abort();
2988         }
2989 }
2990 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
2991         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2992         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2993         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2994                         uint64_t htlc_event_ref = 0;
2995                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2996                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
2997         return htlc_event_ref;
2998 }
2999 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed"))) TS_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed(uint64_t ptr) {
3000         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3001         assert(obj->tag == LDKMonitorEvent_HolderForceClosed);
3002         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
3003                         uint64_t holder_force_closed_ref = 0;
3004                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
3005                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
3006         return holder_force_closed_ref;
3007 }
3008 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_funding_txo"))) TS_LDKMonitorEvent_Completed_get_funding_txo(uint64_t ptr) {
3009         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3010         assert(obj->tag == LDKMonitorEvent_Completed);
3011         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
3012                         uint64_t funding_txo_ref = 0;
3013                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
3014                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
3015         return funding_txo_ref;
3016 }
3017 int64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_monitor_update_id"))) TS_LDKMonitorEvent_Completed_get_monitor_update_id(uint64_t ptr) {
3018         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3019         assert(obj->tag == LDKMonitorEvent_Completed);
3020         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
3021         return monitor_update_id_conv;
3022 }
3023 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
3024         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
3025         for (size_t i = 0; i < ret.datalen; i++) {
3026                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
3027         }
3028         return ret;
3029 }
3030 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3031         LDKOutPoint ret = owner->a;
3032         ret.is_owned = false;
3033         return ret;
3034 }
3035 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
3036         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3037         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
3038         uint64_t ret_ref = 0;
3039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3041         return ret_ref;
3042 }
3043
3044 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3045         return CVec_MonitorEventZ_clone(&owner->b);
3046 }
3047 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
3048         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3049         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
3050         uint64_tArray ret_arr = NULL;
3051         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
3052         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
3053         for (size_t o = 0; o < ret_var.datalen; o++) {
3054                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3055                 *ret_conv_14_copy = ret_var.data[o];
3056                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
3057                 ret_arr_ptr[o] = ret_conv_14_ref;
3058         }
3059         
3060         FREE(ret_var.data);
3061         return ret_arr;
3062 }
3063
3064 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3065         return owner->c;
3066 }
3067 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
3068         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3069         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3070         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
3071         return ret_arr;
3072 }
3073
3074 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
3075         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
3076         for (size_t i = 0; i < ret.datalen; i++) {
3077                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
3078         }
3079         return ret;
3080 }
3081 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3082         LDKInitFeatures ret = *owner->contents.result;
3083         ret.is_owned = false;
3084         return ret;
3085 }
3086 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3087         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3088         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3089         uint64_t ret_ref = 0;
3090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3092         return ret_ref;
3093 }
3094
3095 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3096 CHECK(!owner->result_ok);
3097         return DecodeError_clone(&*owner->contents.err);
3098 }
3099 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3100         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3101         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3102         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3103         uint64_t ret_ref = tag_ptr(ret_copy, true);
3104         return ret_ref;
3105 }
3106
3107 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3108         LDKChannelFeatures ret = *owner->contents.result;
3109         ret.is_owned = false;
3110         return ret;
3111 }
3112 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3113         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3114         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3115         uint64_t ret_ref = 0;
3116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3118         return ret_ref;
3119 }
3120
3121 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3122 CHECK(!owner->result_ok);
3123         return DecodeError_clone(&*owner->contents.err);
3124 }
3125 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3126         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3127         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3128         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3129         uint64_t ret_ref = tag_ptr(ret_copy, true);
3130         return ret_ref;
3131 }
3132
3133 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3134         LDKNodeFeatures ret = *owner->contents.result;
3135         ret.is_owned = false;
3136         return ret;
3137 }
3138 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3139         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3140         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3141         uint64_t ret_ref = 0;
3142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3144         return ret_ref;
3145 }
3146
3147 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3148 CHECK(!owner->result_ok);
3149         return DecodeError_clone(&*owner->contents.err);
3150 }
3151 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3152         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3153         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3154         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3155         uint64_t ret_ref = tag_ptr(ret_copy, true);
3156         return ret_ref;
3157 }
3158
3159 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3160         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
3161         ret.is_owned = false;
3162         return ret;
3163 }
3164 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3165         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3166         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3167         uint64_t ret_ref = 0;
3168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3170         return ret_ref;
3171 }
3172
3173 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3174 CHECK(!owner->result_ok);
3175         return DecodeError_clone(&*owner->contents.err);
3176 }
3177 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3178         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3179         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3180         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3181         uint64_t ret_ref = tag_ptr(ret_copy, true);
3182         return ret_ref;
3183 }
3184
3185 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3186         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
3187         ret.is_owned = false;
3188         return ret;
3189 }
3190 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3191         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3192         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3193         uint64_t ret_ref = 0;
3194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3196         return ret_ref;
3197 }
3198
3199 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3200 CHECK(!owner->result_ok);
3201         return DecodeError_clone(&*owner->contents.err);
3202 }
3203 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3204         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3205         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3206         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3207         uint64_t ret_ref = tag_ptr(ret_copy, true);
3208         return ret_ref;
3209 }
3210
3211 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3212         LDKBlindedHopFeatures ret = *owner->contents.result;
3213         ret.is_owned = false;
3214         return ret;
3215 }
3216 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3217         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3218         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
3219         uint64_t ret_ref = 0;
3220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3222         return ret_ref;
3223 }
3224
3225 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3226 CHECK(!owner->result_ok);
3227         return DecodeError_clone(&*owner->contents.err);
3228 }
3229 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3230         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3231         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3232         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
3233         uint64_t ret_ref = tag_ptr(ret_copy, true);
3234         return ret_ref;
3235 }
3236
3237 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3238         LDKChannelTypeFeatures ret = *owner->contents.result;
3239         ret.is_owned = false;
3240         return ret;
3241 }
3242 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3243         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3244         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3245         uint64_t ret_ref = 0;
3246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3248         return ret_ref;
3249 }
3250
3251 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3252 CHECK(!owner->result_ok);
3253         return DecodeError_clone(&*owner->contents.err);
3254 }
3255 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3256         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3257         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3258         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3259         uint64_t ret_ref = tag_ptr(ret_copy, true);
3260         return ret_ref;
3261 }
3262
3263 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3264         LDKOffer ret = *owner->contents.result;
3265         ret.is_owned = false;
3266         return ret;
3267 }
3268 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_ok"))) TS_CResult_OfferBolt12ParseErrorZ_get_ok(uint64_t owner) {
3269         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3270         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
3271         uint64_t ret_ref = 0;
3272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3274         return ret_ref;
3275 }
3276
3277 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3278         LDKBolt12ParseError ret = *owner->contents.err;
3279         ret.is_owned = false;
3280         return ret;
3281 }
3282 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_err"))) TS_CResult_OfferBolt12ParseErrorZ_get_err(uint64_t owner) {
3283         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3284         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
3285         uint64_t ret_ref = 0;
3286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3288         return ret_ref;
3289 }
3290
3291 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3292 CHECK(owner->result_ok);
3293         return *owner->contents.result;
3294 }
3295 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_get_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_get_ok(uint64_t owner) {
3296         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3297         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3298         memcpy(ret_arr->elems, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form, 33);
3299         return ret_arr;
3300 }
3301
3302 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3303 CHECK(!owner->result_ok);
3304         return *owner->contents.err;
3305 }
3306 uint32_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_get_err"))) TS_CResult_PublicKeySecp256k1ErrorZ_get_err(uint64_t owner) {
3307         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3308         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
3309         return ret_conv;
3310 }
3311
3312 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3313         LDKNodeId ret = *owner->contents.result;
3314         ret.is_owned = false;
3315         return ret;
3316 }
3317 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
3318         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3319         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3320         uint64_t ret_ref = 0;
3321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3323         return ret_ref;
3324 }
3325
3326 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3327 CHECK(!owner->result_ok);
3328         return DecodeError_clone(&*owner->contents.err);
3329 }
3330 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
3331         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3332         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3333         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3334         uint64_t ret_ref = tag_ptr(ret_copy, true);
3335         return ret_ref;
3336 }
3337
3338 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
3339         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3340         switch(obj->tag) {
3341                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
3342                 case LDKNetworkUpdate_ChannelFailure: return 1;
3343                 case LDKNetworkUpdate_NodeFailure: return 2;
3344                 default: abort();
3345         }
3346 }
3347 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
3348         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3349         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
3350         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
3351                         uint64_t msg_ref = 0;
3352                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3353                         msg_ref = tag_ptr(msg_var.inner, false);
3354         return msg_ref;
3355 }
3356 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
3357         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3358         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3359         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
3360         return short_channel_id_conv;
3361 }
3362 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
3363         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3364         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3365         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
3366         return is_permanent_conv;
3367 }
3368 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
3369         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3370         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3371         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3372         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
3373         return node_id_arr;
3374 }
3375 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
3376         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3377         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3378         jboolean is_permanent_conv = obj->node_failure.is_permanent;
3379         return is_permanent_conv;
3380 }
3381 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
3382         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3383         switch(obj->tag) {
3384                 case LDKCOption_NetworkUpdateZ_Some: return 0;
3385                 case LDKCOption_NetworkUpdateZ_None: return 1;
3386                 default: abort();
3387         }
3388 }
3389 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
3390         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3391         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
3392         uint64_t some_ref = tag_ptr(&obj->some, false);
3393         return some_ref;
3394 }
3395 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3396 CHECK(owner->result_ok);
3397         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3398 }
3399 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
3400         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3401         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3402         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3403         uint64_t ret_ref = tag_ptr(ret_copy, true);
3404         return ret_ref;
3405 }
3406
3407 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3408 CHECK(!owner->result_ok);
3409         return DecodeError_clone(&*owner->contents.err);
3410 }
3411 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
3412         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3413         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3414         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3415         uint64_t ret_ref = tag_ptr(ret_copy, true);
3416         return ret_ref;
3417 }
3418
3419 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3420 CHECK(owner->result_ok);
3421         return TxOut_clone(&*owner->contents.result);
3422 }
3423 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_get_ok(uint64_t owner) {
3424         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3425         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3426         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
3427         return tag_ptr(ret_ref, true);
3428 }
3429
3430 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3431 CHECK(!owner->result_ok);
3432         return UtxoLookupError_clone(&*owner->contents.err);
3433 }
3434 uint32_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_err"))) TS_CResult_TxOutUtxoLookupErrorZ_get_err(uint64_t owner) {
3435         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3436         uint32_t ret_conv = LDKUtxoLookupError_to_js(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
3437         return ret_conv;
3438 }
3439
3440 uint32_t __attribute__((export_name("TS_LDKUtxoResult_ty_from_ptr"))) TS_LDKUtxoResult_ty_from_ptr(uint64_t ptr) {
3441         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3442         switch(obj->tag) {
3443                 case LDKUtxoResult_Sync: return 0;
3444                 case LDKUtxoResult_Async: return 1;
3445                 default: abort();
3446         }
3447 }
3448 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Sync_get_sync"))) TS_LDKUtxoResult_Sync_get_sync(uint64_t ptr) {
3449         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3450         assert(obj->tag == LDKUtxoResult_Sync);
3451         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
3452         *sync_conv = obj->sync;
3453                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
3454         return tag_ptr(sync_conv, true);
3455 }
3456 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Async_get_async"))) TS_LDKUtxoResult_Async_get_async(uint64_t ptr) {
3457         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3458         assert(obj->tag == LDKUtxoResult_Async);
3459         LDKUtxoFuture async_var = obj->async;
3460                         uint64_t async_ref = 0;
3461                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
3462                         async_ref = tag_ptr(async_var.inner, false);
3463         return async_ref;
3464 }
3465 typedef struct LDKUtxoLookup_JCalls {
3466         atomic_size_t refcnt;
3467         uint32_t instance_ptr;
3468 } LDKUtxoLookup_JCalls;
3469 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
3470         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3471         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3472                 FREE(j_calls);
3473         }
3474 }
3475 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* chain_hash)[32], uint64_t short_channel_id) {
3476         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3477         int8_tArray chain_hash_arr = init_int8_tArray(32, __LINE__);
3478         memcpy(chain_hash_arr->elems, *chain_hash, 32);
3479         int64_t short_channel_id_conv = short_channel_id;
3480         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 17, (uint32_t)chain_hash_arr, short_channel_id_conv, 0, 0, 0, 0);
3481         void* ret_ptr = untag_ptr(ret);
3482         CHECK_ACCESS(ret_ptr);
3483         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
3484         FREE(untag_ptr(ret));
3485         return ret_conv;
3486 }
3487 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
3488         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
3489         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3490 }
3491 static inline LDKUtxoLookup LDKUtxoLookup_init (JSValue o) {
3492         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
3493         atomic_init(&calls->refcnt, 1);
3494         calls->instance_ptr = o;
3495
3496         LDKUtxoLookup ret = {
3497                 .this_arg = (void*) calls,
3498                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
3499                 .free = LDKUtxoLookup_JCalls_free,
3500         };
3501         return ret;
3502 }
3503 uint64_t  __attribute__((export_name("TS_LDKUtxoLookup_new"))) TS_LDKUtxoLookup_new(JSValue o) {
3504         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3505         *res_ptr = LDKUtxoLookup_init(o);
3506         return tag_ptr(res_ptr, true);
3507 }
3508 uint64_t  __attribute__((export_name("TS_UtxoLookup_get_utxo"))) TS_UtxoLookup_get_utxo(uint64_t this_arg, int8_tArray chain_hash, int64_t short_channel_id) {
3509         void* this_arg_ptr = untag_ptr(this_arg);
3510         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3511         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
3512         uint8_t chain_hash_arr[32];
3513         CHECK(chain_hash->arr_len == 32);
3514         memcpy(chain_hash_arr, chain_hash->elems, 32); FREE(chain_hash);
3515         uint8_t (*chain_hash_ref)[32] = &chain_hash_arr;
3516         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
3517         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, chain_hash_ref, short_channel_id);
3518         uint64_t ret_ref = tag_ptr(ret_copy, true);
3519         return ret_ref;
3520 }
3521
3522 uint32_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_ty_from_ptr"))) TS_LDKCOption_UtxoLookupZ_ty_from_ptr(uint64_t ptr) {
3523         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3524         switch(obj->tag) {
3525                 case LDKCOption_UtxoLookupZ_Some: return 0;
3526                 case LDKCOption_UtxoLookupZ_None: return 1;
3527                 default: abort();
3528         }
3529 }
3530 uint64_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_Some_get_some"))) TS_LDKCOption_UtxoLookupZ_Some_get_some(uint64_t ptr) {
3531         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3532         assert(obj->tag == LDKCOption_UtxoLookupZ_Some);
3533         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3534         *some_ret = obj->some;
3535                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3536                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
3537                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3538                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
3539                         }
3540         return tag_ptr(some_ret, true);
3541 }
3542 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3543 CHECK(owner->result_ok);
3544         return *owner->contents.result;
3545 }
3546 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
3547         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3548         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3549 }
3550
3551 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3552         LDKLightningError ret = *owner->contents.err;
3553         ret.is_owned = false;
3554         return ret;
3555 }
3556 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
3557         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3558         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3559         uint64_t ret_ref = 0;
3560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3562         return ret_ref;
3563 }
3564
3565 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3566 CHECK(owner->result_ok);
3567         return *owner->contents.result;
3568 }
3569 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
3570         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3571         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3572         return ret_conv;
3573 }
3574
3575 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3576         LDKLightningError ret = *owner->contents.err;
3577         ret.is_owned = false;
3578         return ret;
3579 }
3580 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
3581         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3582         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3583         uint64_t ret_ref = 0;
3584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3586         return ret_ref;
3587 }
3588
3589 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3590         LDKChannelAnnouncement ret = owner->a;
3591         ret.is_owned = false;
3592         return ret;
3593 }
3594 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
3595         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3596         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3597         uint64_t ret_ref = 0;
3598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3600         return ret_ref;
3601 }
3602
3603 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3604         LDKChannelUpdate ret = owner->b;
3605         ret.is_owned = false;
3606         return ret;
3607 }
3608 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
3609         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3610         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3611         uint64_t ret_ref = 0;
3612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3614         return ret_ref;
3615 }
3616
3617 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3618         LDKChannelUpdate ret = owner->c;
3619         ret.is_owned = false;
3620         return ret;
3621 }
3622 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
3623         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3624         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3625         uint64_t ret_ref = 0;
3626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3628         return ret_ref;
3629 }
3630
3631 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
3632         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3633         switch(obj->tag) {
3634                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
3635                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
3636                 default: abort();
3637         }
3638 }
3639 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
3640         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3641         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
3642         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3643         *some_conv = obj->some;
3644                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
3645         return tag_ptr(some_conv, true);
3646 }
3647 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
3648         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3649         switch(obj->tag) {
3650                 case LDKErrorAction_DisconnectPeer: return 0;
3651                 case LDKErrorAction_DisconnectPeerWithWarning: return 1;
3652                 case LDKErrorAction_IgnoreError: return 2;
3653                 case LDKErrorAction_IgnoreAndLog: return 3;
3654                 case LDKErrorAction_IgnoreDuplicateGossip: return 4;
3655                 case LDKErrorAction_SendErrorMessage: return 5;
3656                 case LDKErrorAction_SendWarningMessage: return 6;
3657                 default: abort();
3658         }
3659 }
3660 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
3661         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3662         assert(obj->tag == LDKErrorAction_DisconnectPeer);
3663         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
3664                         uint64_t msg_ref = 0;
3665                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3666                         msg_ref = tag_ptr(msg_var.inner, false);
3667         return msg_ref;
3668 }
3669 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg"))) TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg(uint64_t ptr) {
3670         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3671         assert(obj->tag == LDKErrorAction_DisconnectPeerWithWarning);
3672         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
3673                         uint64_t msg_ref = 0;
3674                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3675                         msg_ref = tag_ptr(msg_var.inner, false);
3676         return msg_ref;
3677 }
3678 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
3679         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3680         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
3681         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
3682         return ignore_and_log_conv;
3683 }
3684 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
3685         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3686         assert(obj->tag == LDKErrorAction_SendErrorMessage);
3687         LDKErrorMessage msg_var = obj->send_error_message.msg;
3688                         uint64_t msg_ref = 0;
3689                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3690                         msg_ref = tag_ptr(msg_var.inner, false);
3691         return msg_ref;
3692 }
3693 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
3694         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3695         assert(obj->tag == LDKErrorAction_SendWarningMessage);
3696         LDKWarningMessage msg_var = obj->send_warning_message.msg;
3697                         uint64_t msg_ref = 0;
3698                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3699                         msg_ref = tag_ptr(msg_var.inner, false);
3700         return msg_ref;
3701 }
3702 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
3703         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3704         assert(obj->tag == LDKErrorAction_SendWarningMessage);
3705         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
3706         return log_level_conv;
3707 }
3708 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
3709         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3710         switch(obj->tag) {
3711                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
3712                 case LDKMessageSendEvent_SendAcceptChannelV2: return 1;
3713                 case LDKMessageSendEvent_SendOpenChannel: return 2;
3714                 case LDKMessageSendEvent_SendOpenChannelV2: return 3;
3715                 case LDKMessageSendEvent_SendFundingCreated: return 4;
3716                 case LDKMessageSendEvent_SendFundingSigned: return 5;
3717                 case LDKMessageSendEvent_SendStfu: return 6;
3718                 case LDKMessageSendEvent_SendSplice: return 7;
3719                 case LDKMessageSendEvent_SendSpliceAck: return 8;
3720                 case LDKMessageSendEvent_SendSpliceLocked: return 9;
3721                 case LDKMessageSendEvent_SendTxAddInput: return 10;
3722                 case LDKMessageSendEvent_SendTxAddOutput: return 11;
3723                 case LDKMessageSendEvent_SendTxRemoveInput: return 12;
3724                 case LDKMessageSendEvent_SendTxRemoveOutput: return 13;
3725                 case LDKMessageSendEvent_SendTxComplete: return 14;
3726                 case LDKMessageSendEvent_SendTxSignatures: return 15;
3727                 case LDKMessageSendEvent_SendTxInitRbf: return 16;
3728                 case LDKMessageSendEvent_SendTxAckRbf: return 17;
3729                 case LDKMessageSendEvent_SendTxAbort: return 18;
3730                 case LDKMessageSendEvent_SendChannelReady: return 19;
3731                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 20;
3732                 case LDKMessageSendEvent_UpdateHTLCs: return 21;
3733                 case LDKMessageSendEvent_SendRevokeAndACK: return 22;
3734                 case LDKMessageSendEvent_SendClosingSigned: return 23;
3735                 case LDKMessageSendEvent_SendShutdown: return 24;
3736                 case LDKMessageSendEvent_SendChannelReestablish: return 25;
3737                 case LDKMessageSendEvent_SendChannelAnnouncement: return 26;
3738                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 27;
3739                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 28;
3740                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 29;
3741                 case LDKMessageSendEvent_SendChannelUpdate: return 30;
3742                 case LDKMessageSendEvent_HandleError: return 31;
3743                 case LDKMessageSendEvent_SendChannelRangeQuery: return 32;
3744                 case LDKMessageSendEvent_SendShortIdsQuery: return 33;
3745                 case LDKMessageSendEvent_SendReplyChannelRange: return 34;
3746                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 35;
3747                 default: abort();
3748         }
3749 }
3750 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
3751         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3752         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
3753         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3754         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
3755         return node_id_arr;
3756 }
3757 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
3758         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3759         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
3760         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
3761                         uint64_t msg_ref = 0;
3762                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3763                         msg_ref = tag_ptr(msg_var.inner, false);
3764         return msg_ref;
3765 }
3766 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id(uint64_t ptr) {
3767         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3768         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
3769         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3770         memcpy(node_id_arr->elems, obj->send_accept_channel_v2.node_id.compressed_form, 33);
3771         return node_id_arr;
3772 }
3773 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg(uint64_t ptr) {
3774         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3775         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
3776         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
3777                         uint64_t msg_ref = 0;
3778                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3779                         msg_ref = tag_ptr(msg_var.inner, false);
3780         return msg_ref;
3781 }
3782 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
3783         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3784         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
3785         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3786         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
3787         return node_id_arr;
3788 }
3789 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
3790         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3791         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
3792         LDKOpenChannel msg_var = obj->send_open_channel.msg;
3793                         uint64_t msg_ref = 0;
3794                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3795                         msg_ref = tag_ptr(msg_var.inner, false);
3796         return msg_ref;
3797 }
3798 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id(uint64_t ptr) {
3799         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3800         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
3801         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3802         memcpy(node_id_arr->elems, obj->send_open_channel_v2.node_id.compressed_form, 33);
3803         return node_id_arr;
3804 }
3805 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg(uint64_t ptr) {
3806         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3807         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
3808         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
3809                         uint64_t msg_ref = 0;
3810                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3811                         msg_ref = tag_ptr(msg_var.inner, false);
3812         return msg_ref;
3813 }
3814 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
3815         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3816         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
3817         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3818         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
3819         return node_id_arr;
3820 }
3821 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
3822         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3823         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
3824         LDKFundingCreated msg_var = obj->send_funding_created.msg;
3825                         uint64_t msg_ref = 0;
3826                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3827                         msg_ref = tag_ptr(msg_var.inner, false);
3828         return msg_ref;
3829 }
3830 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
3831         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3832         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
3833         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3834         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
3835         return node_id_arr;
3836 }
3837 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
3838         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3839         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
3840         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
3841                         uint64_t msg_ref = 0;
3842                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3843                         msg_ref = tag_ptr(msg_var.inner, false);
3844         return msg_ref;
3845 }
3846 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendStfu_get_node_id"))) TS_LDKMessageSendEvent_SendStfu_get_node_id(uint64_t ptr) {
3847         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3848         assert(obj->tag == LDKMessageSendEvent_SendStfu);
3849         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3850         memcpy(node_id_arr->elems, obj->send_stfu.node_id.compressed_form, 33);
3851         return node_id_arr;
3852 }
3853 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendStfu_get_msg"))) TS_LDKMessageSendEvent_SendStfu_get_msg(uint64_t ptr) {
3854         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3855         assert(obj->tag == LDKMessageSendEvent_SendStfu);
3856         LDKStfu msg_var = obj->send_stfu.msg;
3857                         uint64_t msg_ref = 0;
3858                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3859                         msg_ref = tag_ptr(msg_var.inner, false);
3860         return msg_ref;
3861 }
3862 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendSplice_get_node_id"))) TS_LDKMessageSendEvent_SendSplice_get_node_id(uint64_t ptr) {
3863         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3864         assert(obj->tag == LDKMessageSendEvent_SendSplice);
3865         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3866         memcpy(node_id_arr->elems, obj->send_splice.node_id.compressed_form, 33);
3867         return node_id_arr;
3868 }
3869 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendSplice_get_msg"))) TS_LDKMessageSendEvent_SendSplice_get_msg(uint64_t ptr) {
3870         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3871         assert(obj->tag == LDKMessageSendEvent_SendSplice);
3872         LDKSplice msg_var = obj->send_splice.msg;
3873                         uint64_t msg_ref = 0;
3874                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3875                         msg_ref = tag_ptr(msg_var.inner, false);
3876         return msg_ref;
3877 }
3878 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceAck_get_node_id"))) TS_LDKMessageSendEvent_SendSpliceAck_get_node_id(uint64_t ptr) {
3879         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3880         assert(obj->tag == LDKMessageSendEvent_SendSpliceAck);
3881         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3882         memcpy(node_id_arr->elems, obj->send_splice_ack.node_id.compressed_form, 33);
3883         return node_id_arr;
3884 }
3885 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceAck_get_msg"))) TS_LDKMessageSendEvent_SendSpliceAck_get_msg(uint64_t ptr) {
3886         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3887         assert(obj->tag == LDKMessageSendEvent_SendSpliceAck);
3888         LDKSpliceAck msg_var = obj->send_splice_ack.msg;
3889                         uint64_t msg_ref = 0;
3890                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3891                         msg_ref = tag_ptr(msg_var.inner, false);
3892         return msg_ref;
3893 }
3894 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceLocked_get_node_id"))) TS_LDKMessageSendEvent_SendSpliceLocked_get_node_id(uint64_t ptr) {
3895         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3896         assert(obj->tag == LDKMessageSendEvent_SendSpliceLocked);
3897         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3898         memcpy(node_id_arr->elems, obj->send_splice_locked.node_id.compressed_form, 33);
3899         return node_id_arr;
3900 }
3901 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceLocked_get_msg"))) TS_LDKMessageSendEvent_SendSpliceLocked_get_msg(uint64_t ptr) {
3902         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3903         assert(obj->tag == LDKMessageSendEvent_SendSpliceLocked);
3904         LDKSpliceLocked msg_var = obj->send_splice_locked.msg;
3905                         uint64_t msg_ref = 0;
3906                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3907                         msg_ref = tag_ptr(msg_var.inner, false);
3908         return msg_ref;
3909 }
3910 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddInput_get_node_id(uint64_t ptr) {
3911         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3912         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
3913         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3914         memcpy(node_id_arr->elems, obj->send_tx_add_input.node_id.compressed_form, 33);
3915         return node_id_arr;
3916 }
3917 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddInput_get_msg(uint64_t ptr) {
3918         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3919         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
3920         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
3921                         uint64_t msg_ref = 0;
3922                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3923                         msg_ref = tag_ptr(msg_var.inner, false);
3924         return msg_ref;
3925 }
3926 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id(uint64_t ptr) {
3927         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3928         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
3929         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3930         memcpy(node_id_arr->elems, obj->send_tx_add_output.node_id.compressed_form, 33);
3931         return node_id_arr;
3932 }
3933 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_msg(uint64_t ptr) {
3934         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3935         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
3936         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
3937                         uint64_t msg_ref = 0;
3938                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3939                         msg_ref = tag_ptr(msg_var.inner, false);
3940         return msg_ref;
3941 }
3942 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id(uint64_t ptr) {
3943         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3944         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
3945         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3946         memcpy(node_id_arr->elems, obj->send_tx_remove_input.node_id.compressed_form, 33);
3947         return node_id_arr;
3948 }
3949 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg(uint64_t ptr) {
3950         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3951         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
3952         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
3953                         uint64_t msg_ref = 0;
3954                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3955                         msg_ref = tag_ptr(msg_var.inner, false);
3956         return msg_ref;
3957 }
3958 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id(uint64_t ptr) {
3959         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3960         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
3961         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3962         memcpy(node_id_arr->elems, obj->send_tx_remove_output.node_id.compressed_form, 33);
3963         return node_id_arr;
3964 }
3965 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg(uint64_t ptr) {
3966         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3967         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
3968         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
3969                         uint64_t msg_ref = 0;
3970                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3971                         msg_ref = tag_ptr(msg_var.inner, false);
3972         return msg_ref;
3973 }
3974 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_node_id"))) TS_LDKMessageSendEvent_SendTxComplete_get_node_id(uint64_t ptr) {
3975         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3976         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
3977         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3978         memcpy(node_id_arr->elems, obj->send_tx_complete.node_id.compressed_form, 33);
3979         return node_id_arr;
3980 }
3981 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_msg"))) TS_LDKMessageSendEvent_SendTxComplete_get_msg(uint64_t ptr) {
3982         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3983         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
3984         LDKTxComplete msg_var = obj->send_tx_complete.msg;
3985                         uint64_t msg_ref = 0;
3986                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3987                         msg_ref = tag_ptr(msg_var.inner, false);
3988         return msg_ref;
3989 }
3990 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendTxSignatures_get_node_id(uint64_t ptr) {
3991         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3992         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
3993         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3994         memcpy(node_id_arr->elems, obj->send_tx_signatures.node_id.compressed_form, 33);
3995         return node_id_arr;
3996 }
3997 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_msg"))) TS_LDKMessageSendEvent_SendTxSignatures_get_msg(uint64_t ptr) {
3998         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3999         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
4000         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
4001                         uint64_t msg_ref = 0;
4002                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4003                         msg_ref = tag_ptr(msg_var.inner, false);
4004         return msg_ref;
4005 }
4006 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id(uint64_t ptr) {
4007         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4008         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
4009         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4010         memcpy(node_id_arr->elems, obj->send_tx_init_rbf.node_id.compressed_form, 33);
4011         return node_id_arr;
4012 }
4013 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_msg(uint64_t ptr) {
4014         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4015         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
4016         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
4017                         uint64_t msg_ref = 0;
4018                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4019                         msg_ref = tag_ptr(msg_var.inner, false);
4020         return msg_ref;
4021 }
4022 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id(uint64_t ptr) {
4023         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4024         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
4025         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4026         memcpy(node_id_arr->elems, obj->send_tx_ack_rbf.node_id.compressed_form, 33);
4027         return node_id_arr;
4028 }
4029 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_msg(uint64_t ptr) {
4030         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4031         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
4032         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
4033                         uint64_t msg_ref = 0;
4034                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4035                         msg_ref = tag_ptr(msg_var.inner, false);
4036         return msg_ref;
4037 }
4038 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_node_id"))) TS_LDKMessageSendEvent_SendTxAbort_get_node_id(uint64_t ptr) {
4039         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4040         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
4041         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4042         memcpy(node_id_arr->elems, obj->send_tx_abort.node_id.compressed_form, 33);
4043         return node_id_arr;
4044 }
4045 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_msg"))) TS_LDKMessageSendEvent_SendTxAbort_get_msg(uint64_t ptr) {
4046         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4047         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
4048         LDKTxAbort msg_var = obj->send_tx_abort.msg;
4049                         uint64_t msg_ref = 0;
4050                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4051                         msg_ref = tag_ptr(msg_var.inner, false);
4052         return msg_ref;
4053 }
4054 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
4055         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4056         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
4057         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4058         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
4059         return node_id_arr;
4060 }
4061 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
4062         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4063         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
4064         LDKChannelReady msg_var = obj->send_channel_ready.msg;
4065                         uint64_t msg_ref = 0;
4066                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4067                         msg_ref = tag_ptr(msg_var.inner, false);
4068         return msg_ref;
4069 }
4070 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
4071         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4072         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
4073         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4074         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
4075         return node_id_arr;
4076 }
4077 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
4078         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4079         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
4080         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
4081                         uint64_t msg_ref = 0;
4082                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4083                         msg_ref = tag_ptr(msg_var.inner, false);
4084         return msg_ref;
4085 }
4086 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
4087         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4088         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
4089         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4090         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
4091         return node_id_arr;
4092 }
4093 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
4094         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4095         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
4096         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
4097                         uint64_t updates_ref = 0;
4098                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
4099                         updates_ref = tag_ptr(updates_var.inner, false);
4100         return updates_ref;
4101 }
4102 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
4103         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4104         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
4105         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4106         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
4107         return node_id_arr;
4108 }
4109 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
4110         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4111         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
4112         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
4113                         uint64_t msg_ref = 0;
4114                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4115                         msg_ref = tag_ptr(msg_var.inner, false);
4116         return msg_ref;
4117 }
4118 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
4119         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4120         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
4121         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4122         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
4123         return node_id_arr;
4124 }
4125 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
4126         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4127         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
4128         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
4129                         uint64_t msg_ref = 0;
4130                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4131                         msg_ref = tag_ptr(msg_var.inner, false);
4132         return msg_ref;
4133 }
4134 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
4135         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4136         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
4137         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4138         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
4139         return node_id_arr;
4140 }
4141 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
4142         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4143         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
4144         LDKShutdown msg_var = obj->send_shutdown.msg;
4145                         uint64_t msg_ref = 0;
4146                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4147                         msg_ref = tag_ptr(msg_var.inner, false);
4148         return msg_ref;
4149 }
4150 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
4151         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4152         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
4153         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4154         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
4155         return node_id_arr;
4156 }
4157 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
4158         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4159         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
4160         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
4161                         uint64_t msg_ref = 0;
4162                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4163                         msg_ref = tag_ptr(msg_var.inner, false);
4164         return msg_ref;
4165 }
4166 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
4167         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4168         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4169         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4170         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
4171         return node_id_arr;
4172 }
4173 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
4174         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4175         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4176         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
4177                         uint64_t msg_ref = 0;
4178                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4179                         msg_ref = tag_ptr(msg_var.inner, false);
4180         return msg_ref;
4181 }
4182 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
4183         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4184         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4185         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
4186                         uint64_t update_msg_ref = 0;
4187                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4188                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4189         return update_msg_ref;
4190 }
4191 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
4192         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4193         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4194         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
4195                         uint64_t msg_ref = 0;
4196                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4197                         msg_ref = tag_ptr(msg_var.inner, false);
4198         return msg_ref;
4199 }
4200 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
4201         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4202         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4203         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
4204                         uint64_t update_msg_ref = 0;
4205                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4206                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4207         return update_msg_ref;
4208 }
4209 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
4210         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4211         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
4212         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
4213                         uint64_t msg_ref = 0;
4214                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4215                         msg_ref = tag_ptr(msg_var.inner, false);
4216         return msg_ref;
4217 }
4218 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint64_t ptr) {
4219         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4220         assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
4221         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
4222                         uint64_t msg_ref = 0;
4223                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4224                         msg_ref = tag_ptr(msg_var.inner, false);
4225         return msg_ref;
4226 }
4227 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
4228         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4229         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4230         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4231         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
4232         return node_id_arr;
4233 }
4234 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
4235         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4236         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4237         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
4238                         uint64_t msg_ref = 0;
4239                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4240                         msg_ref = tag_ptr(msg_var.inner, false);
4241         return msg_ref;
4242 }
4243 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
4244         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4245         assert(obj->tag == LDKMessageSendEvent_HandleError);
4246         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4247         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
4248         return node_id_arr;
4249 }
4250 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
4251         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4252         assert(obj->tag == LDKMessageSendEvent_HandleError);
4253         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
4254         return action_ref;
4255 }
4256 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
4257         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4258         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4259         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4260         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
4261         return node_id_arr;
4262 }
4263 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
4264         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4265         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4266         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
4267                         uint64_t msg_ref = 0;
4268                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4269                         msg_ref = tag_ptr(msg_var.inner, false);
4270         return msg_ref;
4271 }
4272 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
4273         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4274         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4275         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4276         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
4277         return node_id_arr;
4278 }
4279 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
4280         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4281         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4282         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
4283                         uint64_t msg_ref = 0;
4284                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4285                         msg_ref = tag_ptr(msg_var.inner, false);
4286         return msg_ref;
4287 }
4288 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
4289         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4290         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4291         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4292         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
4293         return node_id_arr;
4294 }
4295 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
4296         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4297         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4298         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
4299                         uint64_t msg_ref = 0;
4300                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4301                         msg_ref = tag_ptr(msg_var.inner, false);
4302         return msg_ref;
4303 }
4304 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
4305         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4306         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4307         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4308         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
4309         return node_id_arr;
4310 }
4311 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
4312         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4313         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4314         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
4315                         uint64_t msg_ref = 0;
4316                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4317                         msg_ref = tag_ptr(msg_var.inner, false);
4318         return msg_ref;
4319 }
4320 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
4321         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
4322         for (size_t i = 0; i < ret.datalen; i++) {
4323                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
4324         }
4325         return ret;
4326 }
4327 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4328         LDKChannelUpdateInfo ret = *owner->contents.result;
4329         ret.is_owned = false;
4330         return ret;
4331 }
4332 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
4333         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4334         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
4335         uint64_t ret_ref = 0;
4336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4338         return ret_ref;
4339 }
4340
4341 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4342 CHECK(!owner->result_ok);
4343         return DecodeError_clone(&*owner->contents.err);
4344 }
4345 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
4346         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4347         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4348         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
4349         uint64_t ret_ref = tag_ptr(ret_copy, true);
4350         return ret_ref;
4351 }
4352
4353 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4354         LDKChannelInfo ret = *owner->contents.result;
4355         ret.is_owned = false;
4356         return ret;
4357 }
4358 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
4359         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4360         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
4361         uint64_t ret_ref = 0;
4362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4364         return ret_ref;
4365 }
4366
4367 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4368 CHECK(!owner->result_ok);
4369         return DecodeError_clone(&*owner->contents.err);
4370 }
4371 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
4372         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4373         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4374         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
4375         uint64_t ret_ref = tag_ptr(ret_copy, true);
4376         return ret_ref;
4377 }
4378
4379 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4380         LDKRoutingFees ret = *owner->contents.result;
4381         ret.is_owned = false;
4382         return ret;
4383 }
4384 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
4385         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4386         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
4387         uint64_t ret_ref = 0;
4388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4390         return ret_ref;
4391 }
4392
4393 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4394 CHECK(!owner->result_ok);
4395         return DecodeError_clone(&*owner->contents.err);
4396 }
4397 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
4398         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4399         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4400         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
4401         uint64_t ret_ref = tag_ptr(ret_copy, true);
4402         return ret_ref;
4403 }
4404
4405 uint32_t __attribute__((export_name("TS_LDKSocketAddress_ty_from_ptr"))) TS_LDKSocketAddress_ty_from_ptr(uint64_t ptr) {
4406         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4407         switch(obj->tag) {
4408                 case LDKSocketAddress_TcpIpV4: return 0;
4409                 case LDKSocketAddress_TcpIpV6: return 1;
4410                 case LDKSocketAddress_OnionV2: return 2;
4411                 case LDKSocketAddress_OnionV3: return 3;
4412                 case LDKSocketAddress_Hostname: return 4;
4413                 default: abort();
4414         }
4415 }
4416 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_TcpIpV4_get_addr"))) TS_LDKSocketAddress_TcpIpV4_get_addr(uint64_t ptr) {
4417         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4418         assert(obj->tag == LDKSocketAddress_TcpIpV4);
4419         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
4420         memcpy(addr_arr->elems, obj->tcp_ip_v4.addr.data, 4);
4421         return addr_arr;
4422 }
4423 int16_t __attribute__((export_name("TS_LDKSocketAddress_TcpIpV4_get_port"))) TS_LDKSocketAddress_TcpIpV4_get_port(uint64_t ptr) {
4424         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4425         assert(obj->tag == LDKSocketAddress_TcpIpV4);
4426         int16_t port_conv = obj->tcp_ip_v4.port;
4427         return port_conv;
4428 }
4429 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_TcpIpV6_get_addr"))) TS_LDKSocketAddress_TcpIpV6_get_addr(uint64_t ptr) {
4430         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4431         assert(obj->tag == LDKSocketAddress_TcpIpV6);
4432         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
4433         memcpy(addr_arr->elems, obj->tcp_ip_v6.addr.data, 16);
4434         return addr_arr;
4435 }
4436 int16_t __attribute__((export_name("TS_LDKSocketAddress_TcpIpV6_get_port"))) TS_LDKSocketAddress_TcpIpV6_get_port(uint64_t ptr) {
4437         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4438         assert(obj->tag == LDKSocketAddress_TcpIpV6);
4439         int16_t port_conv = obj->tcp_ip_v6.port;
4440         return port_conv;
4441 }
4442 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_OnionV2_get_onion_v2"))) TS_LDKSocketAddress_OnionV2_get_onion_v2(uint64_t ptr) {
4443         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4444         assert(obj->tag == LDKSocketAddress_OnionV2);
4445         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
4446         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
4447         return onion_v2_arr;
4448 }
4449 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKSocketAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
4450         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4451         assert(obj->tag == LDKSocketAddress_OnionV3);
4452         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
4453         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
4454         return ed25519_pubkey_arr;
4455 }
4456 int16_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_checksum"))) TS_LDKSocketAddress_OnionV3_get_checksum(uint64_t ptr) {
4457         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4458         assert(obj->tag == LDKSocketAddress_OnionV3);
4459         int16_t checksum_conv = obj->onion_v3.checksum;
4460         return checksum_conv;
4461 }
4462 int8_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_version"))) TS_LDKSocketAddress_OnionV3_get_version(uint64_t ptr) {
4463         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4464         assert(obj->tag == LDKSocketAddress_OnionV3);
4465         int8_t version_conv = obj->onion_v3.version;
4466         return version_conv;
4467 }
4468 int16_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_port"))) TS_LDKSocketAddress_OnionV3_get_port(uint64_t ptr) {
4469         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4470         assert(obj->tag == LDKSocketAddress_OnionV3);
4471         int16_t port_conv = obj->onion_v3.port;
4472         return port_conv;
4473 }
4474 uint64_t __attribute__((export_name("TS_LDKSocketAddress_Hostname_get_hostname"))) TS_LDKSocketAddress_Hostname_get_hostname(uint64_t ptr) {
4475         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4476         assert(obj->tag == LDKSocketAddress_Hostname);
4477         LDKHostname hostname_var = obj->hostname.hostname;
4478                         uint64_t hostname_ref = 0;
4479                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
4480                         hostname_ref = tag_ptr(hostname_var.inner, false);
4481         return hostname_ref;
4482 }
4483 int16_t __attribute__((export_name("TS_LDKSocketAddress_Hostname_get_port"))) TS_LDKSocketAddress_Hostname_get_port(uint64_t ptr) {
4484         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4485         assert(obj->tag == LDKSocketAddress_Hostname);
4486         int16_t port_conv = obj->hostname.port;
4487         return port_conv;
4488 }
4489 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
4490         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
4491         for (size_t i = 0; i < ret.datalen; i++) {
4492                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
4493         }
4494         return ret;
4495 }
4496 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4497         LDKNodeAnnouncementInfo ret = *owner->contents.result;
4498         ret.is_owned = false;
4499         return ret;
4500 }
4501 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
4502         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4503         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
4504         uint64_t ret_ref = 0;
4505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4507         return ret_ref;
4508 }
4509
4510 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4511 CHECK(!owner->result_ok);
4512         return DecodeError_clone(&*owner->contents.err);
4513 }
4514 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
4515         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4516         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4517         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
4518         uint64_t ret_ref = tag_ptr(ret_copy, true);
4519         return ret_ref;
4520 }
4521
4522 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4523         LDKNodeAlias ret = *owner->contents.result;
4524         ret.is_owned = false;
4525         return ret;
4526 }
4527 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
4528         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4529         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
4530         uint64_t ret_ref = 0;
4531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4533         return ret_ref;
4534 }
4535
4536 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4537 CHECK(!owner->result_ok);
4538         return DecodeError_clone(&*owner->contents.err);
4539 }
4540 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
4541         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4542         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4543         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
4544         uint64_t ret_ref = tag_ptr(ret_copy, true);
4545         return ret_ref;
4546 }
4547
4548 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4549         LDKNodeInfo ret = *owner->contents.result;
4550         ret.is_owned = false;
4551         return ret;
4552 }
4553 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
4554         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4555         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
4556         uint64_t ret_ref = 0;
4557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4559         return ret_ref;
4560 }
4561
4562 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4563 CHECK(!owner->result_ok);
4564         return DecodeError_clone(&*owner->contents.err);
4565 }
4566 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
4567         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4568         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4569         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
4570         uint64_t ret_ref = tag_ptr(ret_copy, true);
4571         return ret_ref;
4572 }
4573
4574 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4575         LDKNetworkGraph ret = *owner->contents.result;
4576         ret.is_owned = false;
4577         return ret;
4578 }
4579 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
4580         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4581         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
4582         uint64_t ret_ref = 0;
4583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4585         return ret_ref;
4586 }
4587
4588 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4589 CHECK(!owner->result_ok);
4590         return DecodeError_clone(&*owner->contents.err);
4591 }
4592 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
4593         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4594         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4595         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
4596         uint64_t ret_ref = tag_ptr(ret_copy, true);
4597         return ret_ref;
4598 }
4599
4600 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr(uint64_t ptr) {
4601         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
4602         switch(obj->tag) {
4603                 case LDKCOption_CVec_SocketAddressZZ_Some: return 0;
4604                 case LDKCOption_CVec_SocketAddressZZ_None: return 1;
4605                 default: abort();
4606         }
4607 }
4608 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_SocketAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_SocketAddressZZ_Some_get_some(uint64_t ptr) {
4609         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
4610         assert(obj->tag == LDKCOption_CVec_SocketAddressZZ_Some);
4611         LDKCVec_SocketAddressZ some_var = obj->some;
4612                         uint64_tArray some_arr = NULL;
4613                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
4614                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
4615                         for (size_t p = 0; p < some_var.datalen; p++) {
4616                                 uint64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
4617                                 some_arr_ptr[p] = some_conv_15_ref;
4618                         }
4619                         
4620         return some_arr;
4621 }
4622 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
4623         LDKPendingHTLCInfo ret = *owner->contents.result;
4624         ret.is_owned = false;
4625         return ret;
4626 }
4627 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(uint64_t owner) {
4628         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
4629         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(owner_conv);
4630         uint64_t ret_ref = 0;
4631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4633         return ret_ref;
4634 }
4635
4636 static inline struct LDKInboundHTLCErr CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
4637         LDKInboundHTLCErr ret = *owner->contents.err;
4638         ret.is_owned = false;
4639         return ret;
4640 }
4641 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_err"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(uint64_t owner) {
4642         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
4643         LDKInboundHTLCErr ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(owner_conv);
4644         uint64_t ret_ref = 0;
4645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4647         return ret_ref;
4648 }
4649
4650 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
4651         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
4652         for (size_t i = 0; i < ret.datalen; i++) {
4653                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
4654         }
4655         return ret;
4656 }
4657 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
4658         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
4659         for (size_t i = 0; i < ret.datalen; i++) {
4660                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
4661         }
4662         return ret;
4663 }
4664 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
4665         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
4666         for (size_t i = 0; i < ret.datalen; i++) {
4667                 ret.data[i] = Utxo_clone(&orig->data[i]);
4668         }
4669         return ret;
4670 }
4671 uint32_t __attribute__((export_name("TS_LDKCOption_TxOutZ_ty_from_ptr"))) TS_LDKCOption_TxOutZ_ty_from_ptr(uint64_t ptr) {
4672         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
4673         switch(obj->tag) {
4674                 case LDKCOption_TxOutZ_Some: return 0;
4675                 case LDKCOption_TxOutZ_None: return 1;
4676                 default: abort();
4677         }
4678 }
4679 uint64_t __attribute__((export_name("TS_LDKCOption_TxOutZ_Some_get_some"))) TS_LDKCOption_TxOutZ_Some_get_some(uint64_t ptr) {
4680         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
4681         assert(obj->tag == LDKCOption_TxOutZ_Some);
4682         LDKTxOut* some_ref = &obj->some;
4683         return tag_ptr(some_ref, false);
4684 }
4685 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
4686         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
4687         for (size_t i = 0; i < ret.datalen; i++) {
4688                 ret.data[i] = Input_clone(&orig->data[i]);
4689         }
4690         return ret;
4691 }
4692 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
4693         LDKCoinSelection ret = *owner->contents.result;
4694         ret.is_owned = false;
4695         return ret;
4696 }
4697 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_ok"))) TS_CResult_CoinSelectionNoneZ_get_ok(uint64_t owner) {
4698         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
4699         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
4700         uint64_t ret_ref = 0;
4701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4703         return ret_ref;
4704 }
4705
4706 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
4707 CHECK(!owner->result_ok);
4708         return *owner->contents.err;
4709 }
4710 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_err"))) TS_CResult_CoinSelectionNoneZ_get_err(uint64_t owner) {
4711         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
4712         CResult_CoinSelectionNoneZ_get_err(owner_conv);
4713 }
4714
4715 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
4716 CHECK(owner->result_ok);
4717         return CVec_UtxoZ_clone(&*owner->contents.result);
4718 }
4719 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_ok"))) TS_CResult_CVec_UtxoZNoneZ_get_ok(uint64_t owner) {
4720         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
4721         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
4722         uint64_tArray ret_arr = NULL;
4723         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
4724         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
4725         for (size_t g = 0; g < ret_var.datalen; g++) {
4726                 LDKUtxo ret_conv_6_var = ret_var.data[g];
4727                 uint64_t ret_conv_6_ref = 0;
4728                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
4729                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
4730                 ret_arr_ptr[g] = ret_conv_6_ref;
4731         }
4732         
4733         FREE(ret_var.data);
4734         return ret_arr;
4735 }
4736
4737 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
4738 CHECK(!owner->result_ok);
4739         return *owner->contents.err;
4740 }
4741 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_err"))) TS_CResult_CVec_UtxoZNoneZ_get_err(uint64_t owner) {
4742         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
4743         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
4744 }
4745
4746 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
4747         return owner->a;
4748 }
4749 int64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_get_a"))) TS_C2Tuple_u64u16Z_get_a(uint64_t owner) {
4750         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
4751         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
4752         return ret_conv;
4753 }
4754
4755 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
4756         return owner->b;
4757 }
4758 int16_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_get_b"))) TS_C2Tuple_u64u16Z_get_b(uint64_t owner) {
4759         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
4760         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
4761         return ret_conv;
4762 }
4763
4764 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr(uint64_t ptr) {
4765         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
4766         switch(obj->tag) {
4767                 case LDKCOption_C2Tuple_u64u16ZZ_Some: return 0;
4768                 case LDKCOption_C2Tuple_u64u16ZZ_None: return 1;
4769                 default: abort();
4770         }
4771 }
4772 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some(uint64_t ptr) {
4773         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
4774         assert(obj->tag == LDKCOption_C2Tuple_u64u16ZZ_Some);
4775         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
4776         *some_conv = obj->some;
4777                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
4778         return tag_ptr(some_conv, true);
4779 }
4780 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr"))) TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr(uint64_t ptr) {
4781         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
4782         switch(obj->tag) {
4783                 case LDKCOption_ChannelShutdownStateZ_Some: return 0;
4784                 case LDKCOption_ChannelShutdownStateZ_None: return 1;
4785                 default: abort();
4786         }
4787 }
4788 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_Some_get_some"))) TS_LDKCOption_ChannelShutdownStateZ_Some_get_some(uint64_t ptr) {
4789         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
4790         assert(obj->tag == LDKCOption_ChannelShutdownStateZ_Some);
4791         uint32_t some_conv = LDKChannelShutdownState_to_js(obj->some);
4792         return some_conv;
4793 }
4794 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
4795 CHECK(owner->result_ok);
4796         return ThirtyTwoBytes_clone(&*owner->contents.result);
4797 }
4798 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_get_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_get_ok(uint64_t owner) {
4799         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
4800         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4801         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data, 32);
4802         return ret_arr;
4803 }
4804
4805 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
4806 CHECK(!owner->result_ok);
4807         return APIError_clone(&*owner->contents.err);
4808 }
4809 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_get_err"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_get_err(uint64_t owner) {
4810         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
4811         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4812         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
4813         uint64_t ret_ref = tag_ptr(ret_copy, true);
4814         return ret_ref;
4815 }
4816
4817 uint32_t __attribute__((export_name("TS_LDKRecentPaymentDetails_ty_from_ptr"))) TS_LDKRecentPaymentDetails_ty_from_ptr(uint64_t ptr) {
4818         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4819         switch(obj->tag) {
4820                 case LDKRecentPaymentDetails_AwaitingInvoice: return 0;
4821                 case LDKRecentPaymentDetails_Pending: return 1;
4822                 case LDKRecentPaymentDetails_Fulfilled: return 2;
4823                 case LDKRecentPaymentDetails_Abandoned: return 3;
4824                 default: abort();
4825         }
4826 }
4827 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id"))) TS_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id(uint64_t ptr) {
4828         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4829         assert(obj->tag == LDKRecentPaymentDetails_AwaitingInvoice);
4830         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4831         memcpy(payment_id_arr->elems, obj->awaiting_invoice.payment_id.data, 32);
4832         return payment_id_arr;
4833 }
4834 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_id"))) TS_LDKRecentPaymentDetails_Pending_get_payment_id(uint64_t ptr) {
4835         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4836         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4837         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4838         memcpy(payment_id_arr->elems, obj->pending.payment_id.data, 32);
4839         return payment_id_arr;
4840 }
4841 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_hash"))) TS_LDKRecentPaymentDetails_Pending_get_payment_hash(uint64_t ptr) {
4842         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4843         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4844         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4845         memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32);
4846         return payment_hash_arr;
4847 }
4848 int64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_total_msat"))) TS_LDKRecentPaymentDetails_Pending_get_total_msat(uint64_t ptr) {
4849         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4850         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4851         int64_t total_msat_conv = obj->pending.total_msat;
4852         return total_msat_conv;
4853 }
4854 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_id"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_id(uint64_t ptr) {
4855         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4856         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
4857         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4858         memcpy(payment_id_arr->elems, obj->fulfilled.payment_id.data, 32);
4859         return payment_id_arr;
4860 }
4861 uint64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(uint64_t ptr) {
4862         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4863         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
4864         uint64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
4865         return payment_hash_ref;
4866 }
4867 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_id"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_id(uint64_t ptr) {
4868         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4869         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
4870         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4871         memcpy(payment_id_arr->elems, obj->abandoned.payment_id.data, 32);
4872         return payment_id_arr;
4873 }
4874 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash(uint64_t ptr) {
4875         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4876         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
4877         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4878         memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32);
4879         return payment_hash_arr;
4880 }
4881 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
4882         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
4883         for (size_t i = 0; i < ret.datalen; i++) {
4884                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
4885         }
4886         return ret;
4887 }
4888 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
4889         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4890         switch(obj->tag) {
4891                 case LDKPaymentSendFailure_ParameterError: return 0;
4892                 case LDKPaymentSendFailure_PathParameterError: return 1;
4893                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
4894                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
4895                 case LDKPaymentSendFailure_PartialFailure: return 4;
4896                 default: abort();
4897         }
4898 }
4899 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
4900         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4901         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
4902         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
4903         return parameter_error_ref;
4904 }
4905 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
4906         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4907         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
4908         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4909                         uint64_tArray path_parameter_error_arr = NULL;
4910                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
4911                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
4912                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4913                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4914                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4915                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4916                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
4917                         }
4918                         
4919         return path_parameter_error_arr;
4920 }
4921 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe"))) TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(uint64_t ptr) {
4922         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4923         assert(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
4924         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
4925                         uint64_tArray all_failed_resend_safe_arr = NULL;
4926                         all_failed_resend_safe_arr = init_uint64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
4927                         uint64_t *all_failed_resend_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
4928                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
4929                                 uint64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
4930                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
4931                         }
4932                         
4933         return all_failed_resend_safe_arr;
4934 }
4935 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
4936         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4937         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4938         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4939                         uint64_tArray results_arr = NULL;
4940                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
4941                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
4942                         for (size_t w = 0; w < results_var.datalen; w++) {
4943                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4944                                 *results_conv_22_conv = results_var.data[w];
4945                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4946                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
4947                         }
4948                         
4949         return results_arr;
4950 }
4951 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
4952         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4953         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4954         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4955                         uint64_t failed_paths_retry_ref = 0;
4956                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4957                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
4958         return failed_paths_retry_ref;
4959 }
4960 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
4961         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4962         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4963         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4964         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
4965         return payment_id_arr;
4966 }
4967 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4968 CHECK(owner->result_ok);
4969         return *owner->contents.result;
4970 }
4971 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
4972         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4973         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4974 }
4975
4976 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4977 CHECK(!owner->result_ok);
4978         return PaymentSendFailure_clone(&*owner->contents.err);
4979 }
4980 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
4981         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4982         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4983         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4984         uint64_t ret_ref = tag_ptr(ret_copy, true);
4985         return ret_ref;
4986 }
4987
4988 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
4989 CHECK(owner->result_ok);
4990         return *owner->contents.result;
4991 }
4992 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_ok"))) TS_CResult_NoneRetryableSendFailureZ_get_ok(uint64_t owner) {
4993         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
4994         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
4995 }
4996
4997 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
4998 CHECK(!owner->result_ok);
4999         return RetryableSendFailure_clone(&*owner->contents.err);
5000 }
5001 uint32_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_err"))) TS_CResult_NoneRetryableSendFailureZ_get_err(uint64_t owner) {
5002         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
5003         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
5004         return ret_conv;
5005 }
5006
5007 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
5008 CHECK(owner->result_ok);
5009         return ThirtyTwoBytes_clone(&*owner->contents.result);
5010 }
5011 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(uint64_t owner) {
5012         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
5013         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5014         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data, 32);
5015         return ret_arr;
5016 }
5017
5018 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
5019 CHECK(!owner->result_ok);
5020         return PaymentSendFailure_clone(&*owner->contents.err);
5021 }
5022 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(uint64_t owner) {
5023         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
5024         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5025         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
5026         uint64_t ret_ref = tag_ptr(ret_copy, true);
5027         return ret_ref;
5028 }
5029
5030 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
5031 CHECK(owner->result_ok);
5032         return ThirtyTwoBytes_clone(&*owner->contents.result);
5033 }
5034 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(uint64_t owner) {
5035         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
5036         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5037         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data, 32);
5038         return ret_arr;
5039 }
5040
5041 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
5042 CHECK(!owner->result_ok);
5043         return RetryableSendFailure_clone(&*owner->contents.err);
5044 }
5045 uint32_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(uint64_t owner) {
5046         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
5047         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
5048         return ret_conv;
5049 }
5050
5051 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
5052         return ThirtyTwoBytes_clone(&owner->a);
5053 }
5054 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(uint64_t owner) {
5055         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
5056         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5057         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data, 32);
5058         return ret_arr;
5059 }
5060
5061 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
5062         return ThirtyTwoBytes_clone(&owner->b);
5063 }
5064 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(uint64_t owner) {
5065         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
5066         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5067         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data, 32);
5068         return ret_arr;
5069 }
5070
5071 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
5072 CHECK(owner->result_ok);
5073         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
5074 }
5075 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(uint64_t owner) {
5076         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
5077         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5078         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
5079         return tag_ptr(ret_conv, true);
5080 }
5081
5082 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
5083 CHECK(!owner->result_ok);
5084         return PaymentSendFailure_clone(&*owner->contents.err);
5085 }
5086 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(uint64_t owner) {
5087         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
5088         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5089         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
5090         uint64_t ret_ref = tag_ptr(ret_copy, true);
5091         return ret_ref;
5092 }
5093
5094 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
5095         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
5096         for (size_t i = 0; i < ret.datalen; i++) {
5097                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
5098         }
5099         return ret;
5100 }
5101 uint32_t __attribute__((export_name("TS_LDKProbeSendFailure_ty_from_ptr"))) TS_LDKProbeSendFailure_ty_from_ptr(uint64_t ptr) {
5102         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
5103         switch(obj->tag) {
5104                 case LDKProbeSendFailure_RouteNotFound: return 0;
5105                 case LDKProbeSendFailure_SendingFailed: return 1;
5106                 default: abort();
5107         }
5108 }
5109 uint64_t __attribute__((export_name("TS_LDKProbeSendFailure_SendingFailed_get_sending_failed"))) TS_LDKProbeSendFailure_SendingFailed_get_sending_failed(uint64_t ptr) {
5110         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
5111         assert(obj->tag == LDKProbeSendFailure_SendingFailed);
5112         uint64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
5113         return sending_failed_ref;
5114 }
5115 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
5116 CHECK(owner->result_ok);
5117         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
5118 }
5119 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(uint64_t owner) {
5120         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
5121         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
5122         uint64_tArray ret_arr = NULL;
5123         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5124         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5125         for (size_t o = 0; o < ret_var.datalen; o++) {
5126                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5127                 *ret_conv_40_conv = ret_var.data[o];
5128                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
5129         }
5130         
5131         FREE(ret_var.data);
5132         return ret_arr;
5133 }
5134
5135 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
5136 CHECK(!owner->result_ok);
5137         return ProbeSendFailure_clone(&*owner->contents.err);
5138 }
5139 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(uint64_t owner) {
5140         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
5141         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
5142         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
5143         uint64_t ret_ref = tag_ptr(ret_copy, true);
5144         return ret_ref;
5145 }
5146
5147 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
5148         return ThirtyTwoBytes_clone(&owner->a);
5149 }
5150 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(uint64_t owner) {
5151         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
5152         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5153         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(owner_conv).data, 32);
5154         return ret_arr;
5155 }
5156
5157 static inline struct LDKPublicKey C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
5158         return owner->b;
5159 }
5160 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(uint64_t owner) {
5161         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
5162         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
5163         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(owner_conv).compressed_form, 33);
5164         return ret_arr;
5165 }
5166
5167 static inline LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ *orig) {
5168         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ clone bytes"), .datalen = orig->datalen };
5169         for (size_t i = 0; i < ret.datalen; i++) {
5170                 ret.data[i] = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(&orig->data[i]);
5171         }
5172         return ret;
5173 }
5174 uint32_t __attribute__((export_name("TS_LDKCOption_StrZ_ty_from_ptr"))) TS_LDKCOption_StrZ_ty_from_ptr(uint64_t ptr) {
5175         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
5176         switch(obj->tag) {
5177                 case LDKCOption_StrZ_Some: return 0;
5178                 case LDKCOption_StrZ_None: return 1;
5179                 default: abort();
5180         }
5181 }
5182 jstring __attribute__((export_name("TS_LDKCOption_StrZ_Some_get_some"))) TS_LDKCOption_StrZ_Some_get_some(uint64_t ptr) {
5183         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
5184         assert(obj->tag == LDKCOption_StrZ_Some);
5185         LDKStr some_str = obj->some;
5186                         jstring some_conv = str_ref_to_ts(some_str.chars, some_str.len);
5187         return some_conv;
5188 }
5189 static inline void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
5190 CHECK(owner->result_ok);
5191         return *owner->contents.result;
5192 }
5193 void  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_get_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_get_ok(uint64_t owner) {
5194         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
5195         CResult_NoneBolt12SemanticErrorZ_get_ok(owner_conv);
5196 }
5197
5198 static inline enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
5199 CHECK(!owner->result_ok);
5200         return Bolt12SemanticError_clone(&*owner->contents.err);
5201 }
5202 uint32_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_get_err"))) TS_CResult_NoneBolt12SemanticErrorZ_get_err(uint64_t owner) {
5203         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
5204         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_NoneBolt12SemanticErrorZ_get_err(owner_conv));
5205         return ret_conv;
5206 }
5207
5208 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5209 CHECK(owner->result_ok);
5210         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
5211 }
5212 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(uint64_t owner) {
5213         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5214         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5215         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
5216         return tag_ptr(ret_conv, true);
5217 }
5218
5219 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5220 CHECK(!owner->result_ok);
5221         return *owner->contents.err;
5222 }
5223 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(uint64_t owner) {
5224         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5225         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
5226 }
5227
5228 uint32_t __attribute__((export_name("TS_LDKOffersMessage_ty_from_ptr"))) TS_LDKOffersMessage_ty_from_ptr(uint64_t ptr) {
5229         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5230         switch(obj->tag) {
5231                 case LDKOffersMessage_InvoiceRequest: return 0;
5232                 case LDKOffersMessage_Invoice: return 1;
5233                 case LDKOffersMessage_InvoiceError: return 2;
5234                 default: abort();
5235         }
5236 }
5237 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceRequest_get_invoice_request"))) TS_LDKOffersMessage_InvoiceRequest_get_invoice_request(uint64_t ptr) {
5238         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5239         assert(obj->tag == LDKOffersMessage_InvoiceRequest);
5240         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
5241                         uint64_t invoice_request_ref = 0;
5242                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
5243                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
5244         return invoice_request_ref;
5245 }
5246 uint64_t __attribute__((export_name("TS_LDKOffersMessage_Invoice_get_invoice"))) TS_LDKOffersMessage_Invoice_get_invoice(uint64_t ptr) {
5247         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5248         assert(obj->tag == LDKOffersMessage_Invoice);
5249         LDKBolt12Invoice invoice_var = obj->invoice;
5250                         uint64_t invoice_ref = 0;
5251                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
5252                         invoice_ref = tag_ptr(invoice_var.inner, false);
5253         return invoice_ref;
5254 }
5255 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceError_get_invoice_error"))) TS_LDKOffersMessage_InvoiceError_get_invoice_error(uint64_t ptr) {
5256         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5257         assert(obj->tag == LDKOffersMessage_InvoiceError);
5258         LDKInvoiceError invoice_error_var = obj->invoice_error;
5259                         uint64_t invoice_error_ref = 0;
5260                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
5261                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
5262         return invoice_error_ref;
5263 }
5264 uint32_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_ty_from_ptr"))) TS_LDKCOption_OffersMessageZ_ty_from_ptr(uint64_t ptr) {
5265         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
5266         switch(obj->tag) {
5267                 case LDKCOption_OffersMessageZ_Some: return 0;
5268                 case LDKCOption_OffersMessageZ_None: return 1;
5269                 default: abort();
5270         }
5271 }
5272 uint64_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_Some_get_some"))) TS_LDKCOption_OffersMessageZ_Some_get_some(uint64_t ptr) {
5273         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
5274         assert(obj->tag == LDKCOption_OffersMessageZ_Some);
5275         uint64_t some_ref = tag_ptr(&obj->some, false);
5276         return some_ref;
5277 }
5278 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
5279         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5280         switch(obj->tag) {
5281                 case LDKDestination_Node: return 0;
5282                 case LDKDestination_BlindedPath: return 1;
5283                 default: abort();
5284         }
5285 }
5286 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
5287         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5288         assert(obj->tag == LDKDestination_Node);
5289         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
5290         memcpy(node_arr->elems, obj->node.compressed_form, 33);
5291         return node_arr;
5292 }
5293 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedPath_get_blinded_path"))) TS_LDKDestination_BlindedPath_get_blinded_path(uint64_t ptr) {
5294         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5295         assert(obj->tag == LDKDestination_BlindedPath);
5296         LDKBlindedPath blinded_path_var = obj->blinded_path;
5297                         uint64_t blinded_path_ref = 0;
5298                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
5299                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
5300         return blinded_path_ref;
5301 }
5302 static inline struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5303         return OffersMessage_clone(&owner->a);
5304 }
5305 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_a"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(uint64_t owner) {
5306         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5307         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
5308         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(owner_conv);
5309         uint64_t ret_ref = tag_ptr(ret_copy, true);
5310         return ret_ref;
5311 }
5312
5313 static inline struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5314         return Destination_clone(&owner->b);
5315 }
5316 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_b"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(uint64_t owner) {
5317         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5318         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
5319         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(owner_conv);
5320         uint64_t ret_ref = tag_ptr(ret_copy, true);
5321         return ret_ref;
5322 }
5323
5324 static inline struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5325         LDKBlindedPath ret = owner->c;
5326         ret.is_owned = false;
5327         return ret;
5328 }
5329 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_c"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(uint64_t owner) {
5330         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5331         LDKBlindedPath ret_var = C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(owner_conv);
5332         uint64_t ret_ref = 0;
5333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5335         return ret_ref;
5336 }
5337
5338 static inline LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ *orig) {
5339         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
5340         for (size_t i = 0; i < ret.datalen; i++) {
5341                 ret.data[i] = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(&orig->data[i]);
5342         }
5343         return ret;
5344 }
5345 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5346         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
5347         ret.is_owned = false;
5348         return ret;
5349 }
5350 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
5351         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5352         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5353         uint64_t ret_ref = 0;
5354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5356         return ret_ref;
5357 }
5358
5359 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5360 CHECK(!owner->result_ok);
5361         return DecodeError_clone(&*owner->contents.err);
5362 }
5363 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
5364         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5365         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5366         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5367         uint64_t ret_ref = tag_ptr(ret_copy, true);
5368         return ret_ref;
5369 }
5370
5371 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5372         LDKChannelCounterparty ret = *owner->contents.result;
5373         ret.is_owned = false;
5374         return ret;
5375 }
5376 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
5377         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5378         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5379         uint64_t ret_ref = 0;
5380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5382         return ret_ref;
5383 }
5384
5385 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5386 CHECK(!owner->result_ok);
5387         return DecodeError_clone(&*owner->contents.err);
5388 }
5389 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
5390         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5391         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5392         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5393         uint64_t ret_ref = tag_ptr(ret_copy, true);
5394         return ret_ref;
5395 }
5396
5397 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5398         LDKChannelDetails ret = *owner->contents.result;
5399         ret.is_owned = false;
5400         return ret;
5401 }
5402 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
5403         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5404         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5405         uint64_t ret_ref = 0;
5406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5408         return ret_ref;
5409 }
5410
5411 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5412 CHECK(!owner->result_ok);
5413         return DecodeError_clone(&*owner->contents.err);
5414 }
5415 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
5416         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5417         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5418         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5419         uint64_t ret_ref = tag_ptr(ret_copy, true);
5420         return ret_ref;
5421 }
5422
5423 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5424         LDKPhantomRouteHints ret = *owner->contents.result;
5425         ret.is_owned = false;
5426         return ret;
5427 }
5428 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
5429         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5430         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5431         uint64_t ret_ref = 0;
5432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5434         return ret_ref;
5435 }
5436
5437 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5438 CHECK(!owner->result_ok);
5439         return DecodeError_clone(&*owner->contents.err);
5440 }
5441 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
5442         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5443         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5444         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5445         uint64_t ret_ref = tag_ptr(ret_copy, true);
5446         return ret_ref;
5447 }
5448
5449 static inline struct LDKBlindedForward CResult_BlindedForwardDecodeErrorZ_get_ok(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
5450         LDKBlindedForward ret = *owner->contents.result;
5451         ret.is_owned = false;
5452         return ret;
5453 }
5454 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_get_ok"))) TS_CResult_BlindedForwardDecodeErrorZ_get_ok(uint64_t owner) {
5455         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
5456         LDKBlindedForward ret_var = CResult_BlindedForwardDecodeErrorZ_get_ok(owner_conv);
5457         uint64_t ret_ref = 0;
5458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5460         return ret_ref;
5461 }
5462
5463 static inline struct LDKDecodeError CResult_BlindedForwardDecodeErrorZ_get_err(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
5464 CHECK(!owner->result_ok);
5465         return DecodeError_clone(&*owner->contents.err);
5466 }
5467 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_get_err"))) TS_CResult_BlindedForwardDecodeErrorZ_get_err(uint64_t owner) {
5468         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
5469         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5470         *ret_copy = CResult_BlindedForwardDecodeErrorZ_get_err(owner_conv);
5471         uint64_t ret_ref = tag_ptr(ret_copy, true);
5472         return ret_ref;
5473 }
5474
5475 uint32_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ty_from_ptr"))) TS_LDKPendingHTLCRouting_ty_from_ptr(uint64_t ptr) {
5476         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5477         switch(obj->tag) {
5478                 case LDKPendingHTLCRouting_Forward: return 0;
5479                 case LDKPendingHTLCRouting_Receive: return 1;
5480                 case LDKPendingHTLCRouting_ReceiveKeysend: return 2;
5481                 default: abort();
5482         }
5483 }
5484 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Forward_get_onion_packet"))) TS_LDKPendingHTLCRouting_Forward_get_onion_packet(uint64_t ptr) {
5485         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5486         assert(obj->tag == LDKPendingHTLCRouting_Forward);
5487         LDKOnionPacket onion_packet_var = obj->forward.onion_packet;
5488                         uint64_t onion_packet_ref = 0;
5489                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_var);
5490                         onion_packet_ref = tag_ptr(onion_packet_var.inner, false);
5491         return onion_packet_ref;
5492 }
5493 int64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Forward_get_short_channel_id"))) TS_LDKPendingHTLCRouting_Forward_get_short_channel_id(uint64_t ptr) {
5494         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5495         assert(obj->tag == LDKPendingHTLCRouting_Forward);
5496         int64_t short_channel_id_conv = obj->forward.short_channel_id;
5497         return short_channel_id_conv;
5498 }
5499 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Forward_get_blinded"))) TS_LDKPendingHTLCRouting_Forward_get_blinded(uint64_t ptr) {
5500         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5501         assert(obj->tag == LDKPendingHTLCRouting_Forward);
5502         LDKBlindedForward blinded_var = obj->forward.blinded;
5503                         uint64_t blinded_ref = 0;
5504                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
5505                         blinded_ref = tag_ptr(blinded_var.inner, false);
5506         return blinded_ref;
5507 }
5508 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_payment_data"))) TS_LDKPendingHTLCRouting_Receive_get_payment_data(uint64_t ptr) {
5509         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5510         assert(obj->tag == LDKPendingHTLCRouting_Receive);
5511         LDKFinalOnionHopData payment_data_var = obj->receive.payment_data;
5512                         uint64_t payment_data_ref = 0;
5513                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
5514                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
5515         return payment_data_ref;
5516 }
5517 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_payment_metadata"))) TS_LDKPendingHTLCRouting_Receive_get_payment_metadata(uint64_t ptr) {
5518         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5519         assert(obj->tag == LDKPendingHTLCRouting_Receive);
5520         uint64_t payment_metadata_ref = tag_ptr(&obj->receive.payment_metadata, false);
5521         return payment_metadata_ref;
5522 }
5523 int32_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_incoming_cltv_expiry"))) TS_LDKPendingHTLCRouting_Receive_get_incoming_cltv_expiry(uint64_t ptr) {
5524         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5525         assert(obj->tag == LDKPendingHTLCRouting_Receive);
5526         int32_t incoming_cltv_expiry_conv = obj->receive.incoming_cltv_expiry;
5527         return incoming_cltv_expiry_conv;
5528 }
5529 int8_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_phantom_shared_secret"))) TS_LDKPendingHTLCRouting_Receive_get_phantom_shared_secret(uint64_t ptr) {
5530         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5531         assert(obj->tag == LDKPendingHTLCRouting_Receive);
5532         int8_tArray phantom_shared_secret_arr = init_int8_tArray(32, __LINE__);
5533         memcpy(phantom_shared_secret_arr->elems, obj->receive.phantom_shared_secret.data, 32);
5534         return phantom_shared_secret_arr;
5535 }
5536 uint64_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_custom_tlvs"))) TS_LDKPendingHTLCRouting_Receive_get_custom_tlvs(uint64_t ptr) {
5537         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5538         assert(obj->tag == LDKPendingHTLCRouting_Receive);
5539         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive.custom_tlvs;
5540                         uint64_tArray custom_tlvs_arr = NULL;
5541                         custom_tlvs_arr = init_uint64_tArray(custom_tlvs_var.datalen, __LINE__);
5542                         uint64_t *custom_tlvs_arr_ptr = (uint64_t*)(((uint8_t*)custom_tlvs_arr) + 8);
5543                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
5544                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
5545                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
5546                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
5547                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
5548                         }
5549                         
5550         return custom_tlvs_arr;
5551 }
5552 jboolean __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_requires_blinded_error"))) TS_LDKPendingHTLCRouting_Receive_get_requires_blinded_error(uint64_t ptr) {
5553         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5554         assert(obj->tag == LDKPendingHTLCRouting_Receive);
5555         jboolean requires_blinded_error_conv = obj->receive.requires_blinded_error;
5556         return requires_blinded_error_conv;
5557 }
5558 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_data"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_data(uint64_t ptr) {
5559         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5560         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
5561         LDKFinalOnionHopData payment_data_var = obj->receive_keysend.payment_data;
5562                         uint64_t payment_data_ref = 0;
5563                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
5564                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
5565         return payment_data_ref;
5566 }
5567 int8_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_preimage"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_preimage(uint64_t ptr) {
5568         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5569         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
5570         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
5571         memcpy(payment_preimage_arr->elems, obj->receive_keysend.payment_preimage.data, 32);
5572         return payment_preimage_arr;
5573 }
5574 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_metadata"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_metadata(uint64_t ptr) {
5575         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5576         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
5577         uint64_t payment_metadata_ref = tag_ptr(&obj->receive_keysend.payment_metadata, false);
5578         return payment_metadata_ref;
5579 }
5580 int32_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_incoming_cltv_expiry"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_incoming_cltv_expiry(uint64_t ptr) {
5581         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5582         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
5583         int32_t incoming_cltv_expiry_conv = obj->receive_keysend.incoming_cltv_expiry;
5584         return incoming_cltv_expiry_conv;
5585 }
5586 uint64_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_custom_tlvs"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_custom_tlvs(uint64_t ptr) {
5587         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5588         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
5589         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive_keysend.custom_tlvs;
5590                         uint64_tArray custom_tlvs_arr = NULL;
5591                         custom_tlvs_arr = init_uint64_tArray(custom_tlvs_var.datalen, __LINE__);
5592                         uint64_t *custom_tlvs_arr_ptr = (uint64_t*)(((uint8_t*)custom_tlvs_arr) + 8);
5593                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
5594                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
5595                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
5596                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
5597                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
5598                         }
5599                         
5600         return custom_tlvs_arr;
5601 }
5602 static inline struct LDKPendingHTLCRouting CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
5603 CHECK(owner->result_ok);
5604         return PendingHTLCRouting_clone(&*owner->contents.result);
5605 }
5606 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_ok"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(uint64_t owner) {
5607         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
5608         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
5609         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(owner_conv);
5610         uint64_t ret_ref = tag_ptr(ret_copy, true);
5611         return ret_ref;
5612 }
5613
5614 static inline struct LDKDecodeError CResult_PendingHTLCRoutingDecodeErrorZ_get_err(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
5615 CHECK(!owner->result_ok);
5616         return DecodeError_clone(&*owner->contents.err);
5617 }
5618 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_err"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_err(uint64_t owner) {
5619         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
5620         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5621         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_err(owner_conv);
5622         uint64_t ret_ref = tag_ptr(ret_copy, true);
5623         return ret_ref;
5624 }
5625
5626 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoDecodeErrorZ_get_ok(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
5627         LDKPendingHTLCInfo ret = *owner->contents.result;
5628         ret.is_owned = false;
5629         return ret;
5630 }
5631 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_get_ok"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_get_ok(uint64_t owner) {
5632         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
5633         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoDecodeErrorZ_get_ok(owner_conv);
5634         uint64_t ret_ref = 0;
5635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5637         return ret_ref;
5638 }
5639
5640 static inline struct LDKDecodeError CResult_PendingHTLCInfoDecodeErrorZ_get_err(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
5641 CHECK(!owner->result_ok);
5642         return DecodeError_clone(&*owner->contents.err);
5643 }
5644 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_get_err"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_get_err(uint64_t owner) {
5645         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
5646         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5647         *ret_copy = CResult_PendingHTLCInfoDecodeErrorZ_get_err(owner_conv);
5648         uint64_t ret_ref = tag_ptr(ret_copy, true);
5649         return ret_ref;
5650 }
5651
5652 static inline enum LDKBlindedFailure CResult_BlindedFailureDecodeErrorZ_get_ok(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
5653 CHECK(owner->result_ok);
5654         return BlindedFailure_clone(&*owner->contents.result);
5655 }
5656 uint32_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_get_ok"))) TS_CResult_BlindedFailureDecodeErrorZ_get_ok(uint64_t owner) {
5657         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
5658         uint32_t ret_conv = LDKBlindedFailure_to_js(CResult_BlindedFailureDecodeErrorZ_get_ok(owner_conv));
5659         return ret_conv;
5660 }
5661
5662 static inline struct LDKDecodeError CResult_BlindedFailureDecodeErrorZ_get_err(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
5663 CHECK(!owner->result_ok);
5664         return DecodeError_clone(&*owner->contents.err);
5665 }
5666 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_get_err"))) TS_CResult_BlindedFailureDecodeErrorZ_get_err(uint64_t owner) {
5667         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
5668         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5669         *ret_copy = CResult_BlindedFailureDecodeErrorZ_get_err(owner_conv);
5670         uint64_t ret_ref = tag_ptr(ret_copy, true);
5671         return ret_ref;
5672 }
5673
5674 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
5675 CHECK(owner->result_ok);
5676         return ChannelShutdownState_clone(&*owner->contents.result);
5677 }
5678 uint32_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok(uint64_t owner) {
5679         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
5680         uint32_t ret_conv = LDKChannelShutdownState_to_js(CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
5681         return ret_conv;
5682 }
5683
5684 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
5685 CHECK(!owner->result_ok);
5686         return DecodeError_clone(&*owner->contents.err);
5687 }
5688 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err(uint64_t owner) {
5689         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
5690         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5691         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
5692         uint64_t ret_ref = tag_ptr(ret_copy, true);
5693         return ret_ref;
5694 }
5695
5696 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5697         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5698         for (size_t i = 0; i < ret.datalen; i++) {
5699                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5700         }
5701         return ret;
5702 }
5703 typedef struct LDKWatch_JCalls {
5704         atomic_size_t refcnt;
5705         uint32_t instance_ptr;
5706 } LDKWatch_JCalls;
5707 static void LDKWatch_JCalls_free(void* this_arg) {
5708         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5709         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5710                 FREE(j_calls);
5711         }
5712 }
5713 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5714         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5715         LDKOutPoint funding_txo_var = funding_txo;
5716         uint64_t funding_txo_ref = 0;
5717         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5718         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5719         LDKChannelMonitor monitor_var = monitor;
5720         uint64_t monitor_ref = 0;
5721         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5722         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
5723         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
5724         void* ret_ptr = untag_ptr(ret);
5725         CHECK_ACCESS(ret_ptr);
5726         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
5727         FREE(untag_ptr(ret));
5728         return ret_conv;
5729 }
5730 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
5731         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5732         LDKOutPoint funding_txo_var = funding_txo;
5733         uint64_t funding_txo_ref = 0;
5734         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5735         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5736         LDKChannelMonitorUpdate update_var = *update;
5737         uint64_t update_ref = 0;
5738         update_var = ChannelMonitorUpdate_clone(&update_var);
5739         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5740         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
5741         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 19, funding_txo_ref, update_ref, 0, 0, 0, 0);
5742         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
5743         return ret_conv;
5744 }
5745 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5746         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5747         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, 0, 0, 0, 0, 0, 0);
5748         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
5749         ret_constr.datalen = ret->arr_len;
5750         if (ret_constr.datalen > 0)
5751                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
5752         else
5753                 ret_constr.data = NULL;
5754         uint64_t* ret_vals = ret->elems;
5755         for (size_t x = 0; x < ret_constr.datalen; x++) {
5756                 uint64_t ret_conv_49 = ret_vals[x];
5757                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
5758                 CHECK_ACCESS(ret_conv_49_ptr);
5759                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
5760                 FREE(untag_ptr(ret_conv_49));
5761                 ret_constr.data[x] = ret_conv_49_conv;
5762         }
5763         FREE(ret);
5764         return ret_constr;
5765 }
5766 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5767         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5768         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5769 }
5770 static inline LDKWatch LDKWatch_init (JSValue o) {
5771         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5772         atomic_init(&calls->refcnt, 1);
5773         calls->instance_ptr = o;
5774
5775         LDKWatch ret = {
5776                 .this_arg = (void*) calls,
5777                 .watch_channel = watch_channel_LDKWatch_jcall,
5778                 .update_channel = update_channel_LDKWatch_jcall,
5779                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5780                 .free = LDKWatch_JCalls_free,
5781         };
5782         return ret;
5783 }
5784 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5785         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5786         *res_ptr = LDKWatch_init(o);
5787         return tag_ptr(res_ptr, true);
5788 }
5789 uint64_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
5790         void* this_arg_ptr = untag_ptr(this_arg);
5791         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5792         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5793         LDKOutPoint funding_txo_conv;
5794         funding_txo_conv.inner = untag_ptr(funding_txo);
5795         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5796         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5797         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5798         LDKChannelMonitor monitor_conv;
5799         monitor_conv.inner = untag_ptr(monitor);
5800         monitor_conv.is_owned = ptr_is_owned(monitor);
5801         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5802         monitor_conv = ChannelMonitor_clone(&monitor_conv);
5803         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
5804         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
5805         return tag_ptr(ret_conv, true);
5806 }
5807
5808 uint32_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
5809         void* this_arg_ptr = untag_ptr(this_arg);
5810         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5811         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5812         LDKOutPoint funding_txo_conv;
5813         funding_txo_conv.inner = untag_ptr(funding_txo);
5814         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5815         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5816         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5817         LDKChannelMonitorUpdate update_conv;
5818         update_conv.inner = untag_ptr(update);
5819         update_conv.is_owned = ptr_is_owned(update);
5820         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5821         update_conv.is_owned = false;
5822         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
5823         return ret_conv;
5824 }
5825
5826 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
5827         void* this_arg_ptr = untag_ptr(this_arg);
5828         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5829         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5830         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5831         uint64_tArray ret_arr = NULL;
5832         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5833         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5834         for (size_t x = 0; x < ret_var.datalen; x++) {
5835                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
5836                 *ret_conv_49_conv = ret_var.data[x];
5837                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
5838         }
5839         
5840         FREE(ret_var.data);
5841         return ret_arr;
5842 }
5843
5844 typedef struct LDKBroadcasterInterface_JCalls {
5845         atomic_size_t refcnt;
5846         uint32_t instance_ptr;
5847 } LDKBroadcasterInterface_JCalls;
5848 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5849         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5850         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5851                 FREE(j_calls);
5852         }
5853 }
5854 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
5855         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5856         LDKCVec_TransactionZ txs_var = txs;
5857         ptrArray txs_arr = NULL;
5858         txs_arr = init_ptrArray(txs_var.datalen, __LINE__);
5859         int8_tArray *txs_arr_ptr = (int8_tArray*)(((uint8_t*)txs_arr) + 8);
5860         for (size_t m = 0; m < txs_var.datalen; m++) {
5861                 LDKTransaction txs_conv_12_var = txs_var.data[m];
5862                 int8_tArray txs_conv_12_arr = init_int8_tArray(txs_conv_12_var.datalen, __LINE__);
5863                 memcpy(txs_conv_12_arr->elems, txs_conv_12_var.data, txs_conv_12_var.datalen);
5864                 Transaction_free(txs_conv_12_var);
5865                 txs_arr_ptr[m] = txs_conv_12_arr;
5866         }
5867         
5868         FREE(txs_var.data);
5869         js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, (uint32_t)txs_arr, 0, 0, 0, 0, 0);
5870 }
5871 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5872         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5873         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5874 }
5875 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5876         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5877         atomic_init(&calls->refcnt, 1);
5878         calls->instance_ptr = o;
5879
5880         LDKBroadcasterInterface ret = {
5881                 .this_arg = (void*) calls,
5882                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
5883                 .free = LDKBroadcasterInterface_JCalls_free,
5884         };
5885         return ret;
5886 }
5887 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5888         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5889         *res_ptr = LDKBroadcasterInterface_init(o);
5890         return tag_ptr(res_ptr, true);
5891 }
5892 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transactions"))) TS_BroadcasterInterface_broadcast_transactions(uint64_t this_arg, ptrArray txs) {
5893         void* this_arg_ptr = untag_ptr(this_arg);
5894         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5895         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5896         LDKCVec_TransactionZ txs_constr;
5897         txs_constr.datalen = txs->arr_len;
5898         if (txs_constr.datalen > 0)
5899                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5900         else
5901                 txs_constr.data = NULL;
5902         int8_tArray* txs_vals = (void*) txs->elems;
5903         for (size_t m = 0; m < txs_constr.datalen; m++) {
5904                 int8_tArray txs_conv_12 = txs_vals[m];
5905                 LDKTransaction txs_conv_12_ref;
5906                 txs_conv_12_ref.datalen = txs_conv_12->arr_len;
5907                 txs_conv_12_ref.data = MALLOC(txs_conv_12_ref.datalen, "LDKTransaction Bytes");
5908                 memcpy(txs_conv_12_ref.data, txs_conv_12->elems, txs_conv_12_ref.datalen); FREE(txs_conv_12);
5909                 txs_conv_12_ref.data_is_owned = true;
5910                 txs_constr.data[m] = txs_conv_12_ref;
5911         }
5912         FREE(txs);
5913         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
5914 }
5915
5916 typedef struct LDKEntropySource_JCalls {
5917         atomic_size_t refcnt;
5918         uint32_t instance_ptr;
5919 } LDKEntropySource_JCalls;
5920 static void LDKEntropySource_JCalls_free(void* this_arg) {
5921         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5922         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5923                 FREE(j_calls);
5924         }
5925 }
5926 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
5927         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5928         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0);
5929         LDKThirtyTwoBytes ret_ref;
5930         CHECK(ret->arr_len == 32);
5931         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5932         return ret_ref;
5933 }
5934 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
5935         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
5936         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5937 }
5938 static inline LDKEntropySource LDKEntropySource_init (JSValue o) {
5939         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
5940         atomic_init(&calls->refcnt, 1);
5941         calls->instance_ptr = o;
5942
5943         LDKEntropySource ret = {
5944                 .this_arg = (void*) calls,
5945                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
5946                 .free = LDKEntropySource_JCalls_free,
5947         };
5948         return ret;
5949 }
5950 uint64_t  __attribute__((export_name("TS_LDKEntropySource_new"))) TS_LDKEntropySource_new(JSValue o) {
5951         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
5952         *res_ptr = LDKEntropySource_init(o);
5953         return tag_ptr(res_ptr, true);
5954 }
5955 int8_tArray  __attribute__((export_name("TS_EntropySource_get_secure_random_bytes"))) TS_EntropySource_get_secure_random_bytes(uint64_t this_arg) {
5956         void* this_arg_ptr = untag_ptr(this_arg);
5957         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5958         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
5959         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5960         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5961         return ret_arr;
5962 }
5963
5964 uint32_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ty_from_ptr"))) TS_LDKUnsignedGossipMessage_ty_from_ptr(uint64_t ptr) {
5965         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5966         switch(obj->tag) {
5967                 case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0;
5968                 case LDKUnsignedGossipMessage_ChannelUpdate: return 1;
5969                 case LDKUnsignedGossipMessage_NodeAnnouncement: return 2;
5970                 default: abort();
5971         }
5972 }
5973 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement"))) TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(uint64_t ptr) {
5974         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5975         assert(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement);
5976         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
5977                         uint64_t channel_announcement_ref = 0;
5978                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
5979                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
5980         return channel_announcement_ref;
5981 }
5982 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update"))) TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(uint64_t ptr) {
5983         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5984         assert(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate);
5985         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
5986                         uint64_t channel_update_ref = 0;
5987                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
5988                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
5989         return channel_update_ref;
5990 }
5991 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement"))) TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(uint64_t ptr) {
5992         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5993         assert(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement);
5994         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
5995                         uint64_t node_announcement_ref = 0;
5996                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
5997                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
5998         return node_announcement_ref;
5999 }
6000 typedef struct LDKNodeSigner_JCalls {
6001         atomic_size_t refcnt;
6002         uint32_t instance_ptr;
6003 } LDKNodeSigner_JCalls;
6004 static void LDKNodeSigner_JCalls_free(void* this_arg) {
6005         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6006         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6007                 FREE(j_calls);
6008         }
6009 }
6010 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
6011         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6012         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 23, 0, 0, 0, 0, 0, 0);
6013         LDKThirtyTwoBytes ret_ref;
6014         CHECK(ret->arr_len == 32);
6015         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6016         return ret_ref;
6017 }
6018 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
6019         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6020         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6021         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 24, recipient_conv, 0, 0, 0, 0, 0);
6022         void* ret_ptr = untag_ptr(ret);
6023         CHECK_ACCESS(ret_ptr);
6024         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
6025         FREE(untag_ptr(ret));
6026         return ret_conv;
6027 }
6028 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
6029         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6030         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6031         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
6032         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
6033         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
6034         *tweak_copy = tweak;
6035         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
6036         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 25, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
6037         void* ret_ptr = untag_ptr(ret);
6038         CHECK_ACCESS(ret_ptr);
6039         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
6040         FREE(untag_ptr(ret));
6041         return ret_conv;
6042 }
6043 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
6044         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6045         LDKu8slice hrp_bytes_var = hrp_bytes;
6046         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
6047         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
6048         LDKCVec_U5Z invoice_data_var = invoice_data;
6049         ptrArray invoice_data_arr = NULL;
6050         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
6051         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
6052         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
6053                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
6054                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
6055         }
6056         
6057         FREE(invoice_data_var.data);
6058         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6059         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);
6060         void* ret_ptr = untag_ptr(ret);
6061         CHECK_ACCESS(ret_ptr);
6062         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6063         FREE(untag_ptr(ret));
6064         return ret_conv;
6065 }
6066 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
6067         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6068         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
6069         uint64_t invoice_request_ref = 0;
6070         // WARNING: we may need a move here but no clone is available for LDKUnsignedInvoiceRequest
6071         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
6072         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
6073         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 27, invoice_request_ref, 0, 0, 0, 0, 0);
6074         void* ret_ptr = untag_ptr(ret);
6075         CHECK_ACCESS(ret_ptr);
6076         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
6077         FREE(untag_ptr(ret));
6078         return ret_conv;
6079 }
6080 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
6081         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6082         LDKUnsignedBolt12Invoice invoice_var = *invoice;
6083         uint64_t invoice_ref = 0;
6084         // WARNING: we may need a move here but no clone is available for LDKUnsignedBolt12Invoice
6085         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
6086         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
6087         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 28, invoice_ref, 0, 0, 0, 0, 0);
6088         void* ret_ptr = untag_ptr(ret);
6089         CHECK_ACCESS(ret_ptr);
6090         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
6091         FREE(untag_ptr(ret));
6092         return ret_conv;
6093 }
6094 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
6095         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6096         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
6097         *msg_copy = msg;
6098         uint64_t msg_ref = tag_ptr(msg_copy, true);
6099         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 29, msg_ref, 0, 0, 0, 0, 0);
6100         void* ret_ptr = untag_ptr(ret);
6101         CHECK_ACCESS(ret_ptr);
6102         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
6103         FREE(untag_ptr(ret));
6104         return ret_conv;
6105 }
6106 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
6107         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
6108         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6109 }
6110 static inline LDKNodeSigner LDKNodeSigner_init (JSValue o) {
6111         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
6112         atomic_init(&calls->refcnt, 1);
6113         calls->instance_ptr = o;
6114
6115         LDKNodeSigner ret = {
6116                 .this_arg = (void*) calls,
6117                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
6118                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
6119                 .ecdh = ecdh_LDKNodeSigner_jcall,
6120                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
6121                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
6122                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
6123                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
6124                 .free = LDKNodeSigner_JCalls_free,
6125         };
6126         return ret;
6127 }
6128 uint64_t  __attribute__((export_name("TS_LDKNodeSigner_new"))) TS_LDKNodeSigner_new(JSValue o) {
6129         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
6130         *res_ptr = LDKNodeSigner_init(o);
6131         return tag_ptr(res_ptr, true);
6132 }
6133 int8_tArray  __attribute__((export_name("TS_NodeSigner_get_inbound_payment_key_material"))) TS_NodeSigner_get_inbound_payment_key_material(uint64_t this_arg) {
6134         void* this_arg_ptr = untag_ptr(this_arg);
6135         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6136         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6137         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6138         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
6139         return ret_arr;
6140 }
6141
6142 uint64_t  __attribute__((export_name("TS_NodeSigner_get_node_id"))) TS_NodeSigner_get_node_id(uint64_t this_arg, uint32_t recipient) {
6143         void* this_arg_ptr = untag_ptr(this_arg);
6144         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6145         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6146         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6147         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
6148         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
6149         return tag_ptr(ret_conv, true);
6150 }
6151
6152 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) {
6153         void* this_arg_ptr = untag_ptr(this_arg);
6154         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6155         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6156         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6157         LDKPublicKey other_key_ref;
6158         CHECK(other_key->arr_len == 33);
6159         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
6160         void* tweak_ptr = untag_ptr(tweak);
6161         CHECK_ACCESS(tweak_ptr);
6162         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
6163         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
6164         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
6165         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
6166         return tag_ptr(ret_conv, true);
6167 }
6168
6169 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) {
6170         void* this_arg_ptr = untag_ptr(this_arg);
6171         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6172         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6173         LDKu8slice hrp_bytes_ref;
6174         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
6175         hrp_bytes_ref.data = hrp_bytes->elems;
6176         LDKCVec_U5Z invoice_data_constr;
6177         invoice_data_constr.datalen = invoice_data->arr_len;
6178         if (invoice_data_constr.datalen > 0)
6179                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
6180         else
6181                 invoice_data_constr.data = NULL;
6182         int8_t* invoice_data_vals = (void*) invoice_data->elems;
6183         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
6184                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
6185                 
6186                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
6187         }
6188         FREE(invoice_data);
6189         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6190         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6191         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
6192         FREE(hrp_bytes);
6193         return tag_ptr(ret_conv, true);
6194 }
6195
6196 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_bolt12_invoice_request"))) TS_NodeSigner_sign_bolt12_invoice_request(uint64_t this_arg, uint64_t invoice_request) {
6197         void* this_arg_ptr = untag_ptr(this_arg);
6198         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6199         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6200         LDKUnsignedInvoiceRequest invoice_request_conv;
6201         invoice_request_conv.inner = untag_ptr(invoice_request);
6202         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
6203         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
6204         invoice_request_conv.is_owned = false;
6205         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
6206         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
6207         return tag_ptr(ret_conv, true);
6208 }
6209
6210 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_bolt12_invoice"))) TS_NodeSigner_sign_bolt12_invoice(uint64_t this_arg, uint64_t invoice) {
6211         void* this_arg_ptr = untag_ptr(this_arg);
6212         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6213         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6214         LDKUnsignedBolt12Invoice invoice_conv;
6215         invoice_conv.inner = untag_ptr(invoice);
6216         invoice_conv.is_owned = ptr_is_owned(invoice);
6217         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
6218         invoice_conv.is_owned = false;
6219         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
6220         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
6221         return tag_ptr(ret_conv, true);
6222 }
6223
6224 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_gossip_message"))) TS_NodeSigner_sign_gossip_message(uint64_t this_arg, uint64_t msg) {
6225         void* this_arg_ptr = untag_ptr(this_arg);
6226         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6227         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6228         void* msg_ptr = untag_ptr(msg);
6229         CHECK_ACCESS(msg_ptr);
6230         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
6231         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
6232         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
6233         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
6234         return tag_ptr(ret_conv, true);
6235 }
6236
6237 typedef struct LDKSignerProvider_JCalls {
6238         atomic_size_t refcnt;
6239         uint32_t instance_ptr;
6240 } LDKSignerProvider_JCalls;
6241 static void LDKSignerProvider_JCalls_free(void* this_arg) {
6242         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6243         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6244                 FREE(j_calls);
6245         }
6246 }
6247 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
6248         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6249         jboolean inbound_conv = inbound;
6250         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6251         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
6252         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
6253         int8_tArray ret = (int8_tArray)js_invoke_function_ubuuuu(j_calls->instance_ptr, 30, inbound_conv, channel_value_satoshis_conv, (uint32_t)user_channel_id_arr, 0, 0, 0);
6254         LDKThirtyTwoBytes ret_ref;
6255         CHECK(ret->arr_len == 32);
6256         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6257         return ret_ref;
6258 }
6259 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
6260         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6261         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6262         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
6263         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
6264         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 31, channel_value_satoshis_conv, (uint32_t)channel_keys_id_arr, 0, 0, 0, 0);
6265         void* ret_ptr = untag_ptr(ret);
6266         CHECK_ACCESS(ret_ptr);
6267         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
6268         FREE(untag_ptr(ret));
6269         return ret_conv;
6270 }
6271 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
6272         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6273         LDKu8slice reader_var = reader;
6274         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
6275         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
6276         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
6277         void* ret_ptr = untag_ptr(ret);
6278         CHECK_ACCESS(ret_ptr);
6279         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
6280         FREE(untag_ptr(ret));
6281         return ret_conv;
6282 }
6283 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg, LDKThirtyTwoBytes channel_keys_id) {
6284         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6285         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
6286         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
6287         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 33, (uint32_t)channel_keys_id_arr, 0, 0, 0, 0, 0);
6288         void* ret_ptr = untag_ptr(ret);
6289         CHECK_ACCESS(ret_ptr);
6290         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
6291         FREE(untag_ptr(ret));
6292         return ret_conv;
6293 }
6294 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
6295         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6296         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 34, 0, 0, 0, 0, 0, 0);
6297         void* ret_ptr = untag_ptr(ret);
6298         CHECK_ACCESS(ret_ptr);
6299         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
6300         FREE(untag_ptr(ret));
6301         return ret_conv;
6302 }
6303 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
6304         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
6305         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6306 }
6307 static inline LDKSignerProvider LDKSignerProvider_init (JSValue o) {
6308         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
6309         atomic_init(&calls->refcnt, 1);
6310         calls->instance_ptr = o;
6311
6312         LDKSignerProvider ret = {
6313                 .this_arg = (void*) calls,
6314                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
6315                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
6316                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
6317                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
6318                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
6319                 .free = LDKSignerProvider_JCalls_free,
6320         };
6321         return ret;
6322 }
6323 uint64_t  __attribute__((export_name("TS_LDKSignerProvider_new"))) TS_LDKSignerProvider_new(JSValue o) {
6324         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
6325         *res_ptr = LDKSignerProvider_init(o);
6326         return tag_ptr(res_ptr, true);
6327 }
6328 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) {
6329         void* this_arg_ptr = untag_ptr(this_arg);
6330         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6331         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6332         LDKU128 user_channel_id_ref;
6333         CHECK(user_channel_id->arr_len == 16);
6334         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
6335         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6336         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);
6337         return ret_arr;
6338 }
6339
6340 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) {
6341         void* this_arg_ptr = untag_ptr(this_arg);
6342         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6343         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6344         LDKThirtyTwoBytes channel_keys_id_ref;
6345         CHECK(channel_keys_id->arr_len == 32);
6346         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
6347         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
6348         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
6349         return tag_ptr(ret_ret, true);
6350 }
6351
6352 uint64_t  __attribute__((export_name("TS_SignerProvider_read_chan_signer"))) TS_SignerProvider_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
6353         void* this_arg_ptr = untag_ptr(this_arg);
6354         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6355         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6356         LDKu8slice reader_ref;
6357         reader_ref.datalen = reader->arr_len;
6358         reader_ref.data = reader->elems;
6359         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
6360         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6361         FREE(reader);
6362         return tag_ptr(ret_conv, true);
6363 }
6364
6365 uint64_t  __attribute__((export_name("TS_SignerProvider_get_destination_script"))) TS_SignerProvider_get_destination_script(uint64_t this_arg, int8_tArray channel_keys_id) {
6366         void* this_arg_ptr = untag_ptr(this_arg);
6367         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6368         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6369         LDKThirtyTwoBytes channel_keys_id_ref;
6370         CHECK(channel_keys_id->arr_len == 32);
6371         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
6372         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
6373         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg, channel_keys_id_ref);
6374         return tag_ptr(ret_conv, true);
6375 }
6376
6377 uint64_t  __attribute__((export_name("TS_SignerProvider_get_shutdown_scriptpubkey"))) TS_SignerProvider_get_shutdown_scriptpubkey(uint64_t this_arg) {
6378         void* this_arg_ptr = untag_ptr(this_arg);
6379         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6380         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6381         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
6382         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6383         return tag_ptr(ret_conv, true);
6384 }
6385
6386 typedef struct LDKFeeEstimator_JCalls {
6387         atomic_size_t refcnt;
6388         uint32_t instance_ptr;
6389 } LDKFeeEstimator_JCalls;
6390 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
6391         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6392         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6393                 FREE(j_calls);
6394         }
6395 }
6396 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6397         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6398         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
6399         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, confirmation_target_conv, 0, 0, 0, 0, 0);
6400 }
6401 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6402         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6403         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6404 }
6405 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
6406         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6407         atomic_init(&calls->refcnt, 1);
6408         calls->instance_ptr = o;
6409
6410         LDKFeeEstimator ret = {
6411                 .this_arg = (void*) calls,
6412                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6413                 .free = LDKFeeEstimator_JCalls_free,
6414         };
6415         return ret;
6416 }
6417 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
6418         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6419         *res_ptr = LDKFeeEstimator_init(o);
6420         return tag_ptr(res_ptr, true);
6421 }
6422 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) {
6423         void* this_arg_ptr = untag_ptr(this_arg);
6424         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6425         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6426         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
6427         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6428         return ret_conv;
6429 }
6430
6431 typedef struct LDKMessageRouter_JCalls {
6432         atomic_size_t refcnt;
6433         uint32_t instance_ptr;
6434 } LDKMessageRouter_JCalls;
6435 static void LDKMessageRouter_JCalls_free(void* this_arg) {
6436         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
6437         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6438                 FREE(j_calls);
6439         }
6440 }
6441 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
6442         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
6443         int8_tArray sender_arr = init_int8_tArray(33, __LINE__);
6444         memcpy(sender_arr->elems, sender.compressed_form, 33);
6445         LDKCVec_PublicKeyZ peers_var = peers;
6446         ptrArray peers_arr = NULL;
6447         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
6448         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
6449         for (size_t m = 0; m < peers_var.datalen; m++) {
6450                 int8_tArray peers_conv_12_arr = init_int8_tArray(33, __LINE__);
6451                 memcpy(peers_conv_12_arr->elems, peers_var.data[m].compressed_form, 33);
6452                 peers_arr_ptr[m] = peers_conv_12_arr;
6453         }
6454         
6455         FREE(peers_var.data);
6456         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
6457         *destination_copy = destination;
6458         uint64_t destination_ref = tag_ptr(destination_copy, true);
6459         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 36, (uint32_t)sender_arr, (uint32_t)peers_arr, destination_ref, 0, 0, 0);
6460         void* ret_ptr = untag_ptr(ret);
6461         CHECK_ACCESS(ret_ptr);
6462         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
6463         FREE(untag_ptr(ret));
6464         return ret_conv;
6465 }
6466 LDKCResult_CVec_BlindedPathZNoneZ create_blinded_paths_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_PublicKeyZ peers) {
6467         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
6468         int8_tArray recipient_arr = init_int8_tArray(33, __LINE__);
6469         memcpy(recipient_arr->elems, recipient.compressed_form, 33);
6470         LDKCVec_PublicKeyZ peers_var = peers;
6471         ptrArray peers_arr = NULL;
6472         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
6473         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
6474         for (size_t m = 0; m < peers_var.datalen; m++) {
6475                 int8_tArray peers_conv_12_arr = init_int8_tArray(33, __LINE__);
6476                 memcpy(peers_conv_12_arr->elems, peers_var.data[m].compressed_form, 33);
6477                 peers_arr_ptr[m] = peers_conv_12_arr;
6478         }
6479         
6480         FREE(peers_var.data);
6481         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 37, (uint32_t)recipient_arr, (uint32_t)peers_arr, 0, 0, 0, 0);
6482         void* ret_ptr = untag_ptr(ret);
6483         CHECK_ACCESS(ret_ptr);
6484         LDKCResult_CVec_BlindedPathZNoneZ ret_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(ret_ptr);
6485         FREE(untag_ptr(ret));
6486         return ret_conv;
6487 }
6488 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
6489         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
6490         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6491 }
6492 static inline LDKMessageRouter LDKMessageRouter_init (JSValue o) {
6493         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
6494         atomic_init(&calls->refcnt, 1);
6495         calls->instance_ptr = o;
6496
6497         LDKMessageRouter ret = {
6498                 .this_arg = (void*) calls,
6499                 .find_path = find_path_LDKMessageRouter_jcall,
6500                 .create_blinded_paths = create_blinded_paths_LDKMessageRouter_jcall,
6501                 .free = LDKMessageRouter_JCalls_free,
6502         };
6503         return ret;
6504 }
6505 uint64_t  __attribute__((export_name("TS_LDKMessageRouter_new"))) TS_LDKMessageRouter_new(JSValue o) {
6506         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
6507         *res_ptr = LDKMessageRouter_init(o);
6508         return tag_ptr(res_ptr, true);
6509 }
6510 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) {
6511         void* this_arg_ptr = untag_ptr(this_arg);
6512         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6513         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
6514         LDKPublicKey sender_ref;
6515         CHECK(sender->arr_len == 33);
6516         memcpy(sender_ref.compressed_form, sender->elems, 33); FREE(sender);
6517         LDKCVec_PublicKeyZ peers_constr;
6518         peers_constr.datalen = peers->arr_len;
6519         if (peers_constr.datalen > 0)
6520                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
6521         else
6522                 peers_constr.data = NULL;
6523         int8_tArray* peers_vals = (void*) peers->elems;
6524         for (size_t m = 0; m < peers_constr.datalen; m++) {
6525                 int8_tArray peers_conv_12 = peers_vals[m];
6526                 LDKPublicKey peers_conv_12_ref;
6527                 CHECK(peers_conv_12->arr_len == 33);
6528                 memcpy(peers_conv_12_ref.compressed_form, peers_conv_12->elems, 33); FREE(peers_conv_12);
6529                 peers_constr.data[m] = peers_conv_12_ref;
6530         }
6531         FREE(peers);
6532         void* destination_ptr = untag_ptr(destination);
6533         CHECK_ACCESS(destination_ptr);
6534         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
6535         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
6536         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
6537         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
6538         return tag_ptr(ret_conv, true);
6539 }
6540
6541 uint64_t  __attribute__((export_name("TS_MessageRouter_create_blinded_paths"))) TS_MessageRouter_create_blinded_paths(uint64_t this_arg, int8_tArray recipient, ptrArray peers) {
6542         void* this_arg_ptr = untag_ptr(this_arg);
6543         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6544         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
6545         LDKPublicKey recipient_ref;
6546         CHECK(recipient->arr_len == 33);
6547         memcpy(recipient_ref.compressed_form, recipient->elems, 33); FREE(recipient);
6548         LDKCVec_PublicKeyZ peers_constr;
6549         peers_constr.datalen = peers->arr_len;
6550         if (peers_constr.datalen > 0)
6551                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
6552         else
6553                 peers_constr.data = NULL;
6554         int8_tArray* peers_vals = (void*) peers->elems;
6555         for (size_t m = 0; m < peers_constr.datalen; m++) {
6556                 int8_tArray peers_conv_12 = peers_vals[m];
6557                 LDKPublicKey peers_conv_12_ref;
6558                 CHECK(peers_conv_12->arr_len == 33);
6559                 memcpy(peers_conv_12_ref.compressed_form, peers_conv_12->elems, 33); FREE(peers_conv_12);
6560                 peers_constr.data[m] = peers_conv_12_ref;
6561         }
6562         FREE(peers);
6563         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
6564         *ret_conv = (this_arg_conv->create_blinded_paths)(this_arg_conv->this_arg, recipient_ref, peers_constr);
6565         return tag_ptr(ret_conv, true);
6566 }
6567
6568 typedef struct LDKRouter_JCalls {
6569         atomic_size_t refcnt;
6570         uint32_t instance_ptr;
6571         LDKMessageRouter_JCalls* MessageRouter;
6572 } LDKRouter_JCalls;
6573 static void LDKRouter_JCalls_free(void* this_arg) {
6574         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6575         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6576                 FREE(j_calls);
6577         }
6578 }
6579 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
6580         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6581         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
6582         memcpy(payer_arr->elems, payer.compressed_form, 33);
6583         LDKRouteParameters route_params_var = *route_params;
6584         uint64_t route_params_ref = 0;
6585         route_params_var = RouteParameters_clone(&route_params_var);
6586         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
6587         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
6588         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
6589         uint64_tArray first_hops_arr = NULL;
6590         if (first_hops != NULL) {
6591                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
6592                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
6593                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
6594                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
6595                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
6596                         uint64_t first_hops_conv_16_ref = 0;
6597                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
6598                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
6599                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
6600                 }
6601         
6602         }
6603         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
6604         uint64_t inflight_htlcs_ref = 0;
6605         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
6606         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
6607         uint64_t ret = js_invoke_function_ububuu(j_calls->instance_ptr, 38, (uint32_t)payer_arr, route_params_ref, (uint32_t)first_hops_arr, inflight_htlcs_ref, 0, 0);
6608         void* ret_ptr = untag_ptr(ret);
6609         CHECK_ACCESS(ret_ptr);
6610         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
6611         FREE(untag_ptr(ret));
6612         return ret_conv;
6613 }
6614 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) {
6615         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6616         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
6617         memcpy(payer_arr->elems, payer.compressed_form, 33);
6618         LDKRouteParameters route_params_var = *route_params;
6619         uint64_t route_params_ref = 0;
6620         route_params_var = RouteParameters_clone(&route_params_var);
6621         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
6622         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
6623         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
6624         uint64_tArray first_hops_arr = NULL;
6625         if (first_hops != NULL) {
6626                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
6627                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
6628                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
6629                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
6630                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
6631                         uint64_t first_hops_conv_16_ref = 0;
6632                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
6633                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
6634                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
6635                 }
6636         
6637         }
6638         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
6639         uint64_t inflight_htlcs_ref = 0;
6640         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
6641         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
6642         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
6643         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
6644         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
6645         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
6646         uint64_t ret = js_invoke_function_ububuu(j_calls->instance_ptr, 39, (uint32_t)payer_arr, route_params_ref, (uint32_t)first_hops_arr, inflight_htlcs_ref, (uint32_t)_payment_hash_arr, (uint32_t)_payment_id_arr);
6647         void* ret_ptr = untag_ptr(ret);
6648         CHECK_ACCESS(ret_ptr);
6649         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
6650         FREE(untag_ptr(ret));
6651         return ret_conv;
6652 }
6653 LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ create_blinded_payment_paths_LDKRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_ChannelDetailsZ first_hops, LDKReceiveTlvs tlvs, uint64_t amount_msats) {
6654         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6655         int8_tArray recipient_arr = init_int8_tArray(33, __LINE__);
6656         memcpy(recipient_arr->elems, recipient.compressed_form, 33);
6657         LDKCVec_ChannelDetailsZ first_hops_var = first_hops;
6658         uint64_tArray first_hops_arr = NULL;
6659         first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
6660         uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
6661         for (size_t q = 0; q < first_hops_var.datalen; q++) {
6662                 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
6663                 uint64_t first_hops_conv_16_ref = 0;
6664                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
6665                 first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
6666                 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
6667         }
6668         
6669         FREE(first_hops_var.data);
6670         LDKReceiveTlvs tlvs_var = tlvs;
6671         uint64_t tlvs_ref = 0;
6672         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_var);
6673         tlvs_ref = tag_ptr(tlvs_var.inner, tlvs_var.is_owned);
6674         int64_t amount_msats_conv = amount_msats;
6675         uint64_t ret = js_invoke_function_uubbuu(j_calls->instance_ptr, 40, (uint32_t)recipient_arr, (uint32_t)first_hops_arr, tlvs_ref, amount_msats_conv, 0, 0);
6676         void* ret_ptr = untag_ptr(ret);
6677         CHECK_ACCESS(ret_ptr);
6678         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ ret_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(ret_ptr);
6679         FREE(untag_ptr(ret));
6680         return ret_conv;
6681 }
6682 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
6683         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
6684         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6685         atomic_fetch_add_explicit(&j_calls->MessageRouter->refcnt, 1, memory_order_release);
6686 }
6687 static inline LDKRouter LDKRouter_init (JSValue o, JSValue MessageRouter) {
6688         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
6689         atomic_init(&calls->refcnt, 1);
6690         calls->instance_ptr = o;
6691
6692         LDKRouter ret = {
6693                 .this_arg = (void*) calls,
6694                 .find_route = find_route_LDKRouter_jcall,
6695                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
6696                 .create_blinded_payment_paths = create_blinded_payment_paths_LDKRouter_jcall,
6697                 .free = LDKRouter_JCalls_free,
6698                 .MessageRouter = LDKMessageRouter_init(MessageRouter),
6699         };
6700         calls->MessageRouter = ret.MessageRouter.this_arg;
6701         return ret;
6702 }
6703 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o, JSValue MessageRouter) {
6704         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
6705         *res_ptr = LDKRouter_init(o, MessageRouter);
6706         return tag_ptr(res_ptr, true);
6707 }
6708 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) {
6709         void* this_arg_ptr = untag_ptr(this_arg);
6710         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6711         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6712         LDKPublicKey payer_ref;
6713         CHECK(payer->arr_len == 33);
6714         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
6715         LDKRouteParameters route_params_conv;
6716         route_params_conv.inner = untag_ptr(route_params);
6717         route_params_conv.is_owned = ptr_is_owned(route_params);
6718         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
6719         route_params_conv.is_owned = false;
6720         LDKCVec_ChannelDetailsZ first_hops_constr;
6721         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
6722         if (first_hops != 0) {
6723                 first_hops_constr.datalen = first_hops->arr_len;
6724                 if (first_hops_constr.datalen > 0)
6725                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6726                 else
6727                         first_hops_constr.data = NULL;
6728                 uint64_t* first_hops_vals = first_hops->elems;
6729                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6730                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6731                         LDKChannelDetails first_hops_conv_16_conv;
6732                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6733                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6734                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6735                         first_hops_conv_16_conv.is_owned = false;
6736                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6737                 }
6738                 FREE(first_hops);
6739                 first_hops_ptr = &first_hops_constr;
6740         }
6741         LDKInFlightHtlcs inflight_htlcs_conv;
6742         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6743         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6744         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6745         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
6746         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6747         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
6748         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6749         return tag_ptr(ret_conv, true);
6750 }
6751
6752 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) {
6753         void* this_arg_ptr = untag_ptr(this_arg);
6754         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6755         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6756         LDKPublicKey payer_ref;
6757         CHECK(payer->arr_len == 33);
6758         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
6759         LDKRouteParameters route_params_conv;
6760         route_params_conv.inner = untag_ptr(route_params);
6761         route_params_conv.is_owned = ptr_is_owned(route_params);
6762         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
6763         route_params_conv.is_owned = false;
6764         LDKCVec_ChannelDetailsZ first_hops_constr;
6765         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
6766         if (first_hops != 0) {
6767                 first_hops_constr.datalen = first_hops->arr_len;
6768                 if (first_hops_constr.datalen > 0)
6769                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6770                 else
6771                         first_hops_constr.data = NULL;
6772                 uint64_t* first_hops_vals = first_hops->elems;
6773                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6774                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6775                         LDKChannelDetails first_hops_conv_16_conv;
6776                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6777                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6778                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6779                         first_hops_conv_16_conv.is_owned = false;
6780                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6781                 }
6782                 FREE(first_hops);
6783                 first_hops_ptr = &first_hops_constr;
6784         }
6785         LDKInFlightHtlcs inflight_htlcs_conv;
6786         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6787         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6788         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6789         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
6790         LDKThirtyTwoBytes _payment_hash_ref;
6791         CHECK(_payment_hash->arr_len == 32);
6792         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
6793         LDKThirtyTwoBytes _payment_id_ref;
6794         CHECK(_payment_id->arr_len == 32);
6795         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
6796         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6797         *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);
6798         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6799         return tag_ptr(ret_conv, true);
6800 }
6801
6802 uint64_t  __attribute__((export_name("TS_Router_create_blinded_payment_paths"))) TS_Router_create_blinded_payment_paths(uint64_t this_arg, int8_tArray recipient, uint64_tArray first_hops, uint64_t tlvs, int64_t amount_msats) {
6803         void* this_arg_ptr = untag_ptr(this_arg);
6804         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6805         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6806         LDKPublicKey recipient_ref;
6807         CHECK(recipient->arr_len == 33);
6808         memcpy(recipient_ref.compressed_form, recipient->elems, 33); FREE(recipient);
6809         LDKCVec_ChannelDetailsZ first_hops_constr;
6810         first_hops_constr.datalen = first_hops->arr_len;
6811         if (first_hops_constr.datalen > 0)
6812                 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6813         else
6814                 first_hops_constr.data = NULL;
6815         uint64_t* first_hops_vals = first_hops->elems;
6816         for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6817                 uint64_t first_hops_conv_16 = first_hops_vals[q];
6818                 LDKChannelDetails first_hops_conv_16_conv;
6819                 first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6820                 first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6821                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6822                 first_hops_conv_16_conv = ChannelDetails_clone(&first_hops_conv_16_conv);
6823                 first_hops_constr.data[q] = first_hops_conv_16_conv;
6824         }
6825         FREE(first_hops);
6826         LDKReceiveTlvs tlvs_conv;
6827         tlvs_conv.inner = untag_ptr(tlvs);
6828         tlvs_conv.is_owned = ptr_is_owned(tlvs);
6829         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_conv);
6830         tlvs_conv = ReceiveTlvs_clone(&tlvs_conv);
6831         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
6832         *ret_conv = (this_arg_conv->create_blinded_payment_paths)(this_arg_conv->this_arg, recipient_ref, first_hops_constr, tlvs_conv, amount_msats);
6833         return tag_ptr(ret_conv, true);
6834 }
6835
6836 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
6837         return ThirtyTwoBytes_clone(&owner->a);
6838 }
6839 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(uint64_t owner) {
6840         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
6841         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6842         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data, 32);
6843         return ret_arr;
6844 }
6845
6846 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
6847         LDKChannelManager ret = owner->b;
6848         ret.is_owned = false;
6849         return ret;
6850 }
6851 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(uint64_t owner) {
6852         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
6853         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
6854         uint64_t ret_ref = 0;
6855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6857         return ret_ref;
6858 }
6859
6860 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6861 CHECK(owner->result_ok);
6862         return &*owner->contents.result;
6863 }
6864 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
6865         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6866         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
6867         return ret_ret;
6868 }
6869
6870 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6871 CHECK(!owner->result_ok);
6872         return DecodeError_clone(&*owner->contents.err);
6873 }
6874 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
6875         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6876         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6877         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
6878         uint64_t ret_ref = tag_ptr(ret_copy, true);
6879         return ret_ref;
6880 }
6881
6882 uint32_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_ty_from_ptr"))) TS_LDKMaxDustHTLCExposure_ty_from_ptr(uint64_t ptr) {
6883         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
6884         switch(obj->tag) {
6885                 case LDKMaxDustHTLCExposure_FixedLimitMsat: return 0;
6886                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: return 1;
6887                 default: abort();
6888         }
6889 }
6890 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat"))) TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat(uint64_t ptr) {
6891         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
6892         assert(obj->tag == LDKMaxDustHTLCExposure_FixedLimitMsat);
6893         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
6894         return fixed_limit_msat_conv;
6895 }
6896 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier"))) TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier(uint64_t ptr) {
6897         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
6898         assert(obj->tag == LDKMaxDustHTLCExposure_FeeRateMultiplier);
6899         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
6900         return fee_rate_multiplier_conv;
6901 }
6902 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
6903 CHECK(owner->result_ok);
6904         return MaxDustHTLCExposure_clone(&*owner->contents.result);
6905 }
6906 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(uint64_t owner) {
6907         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
6908         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
6909         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
6910         uint64_t ret_ref = tag_ptr(ret_copy, true);
6911         return ret_ref;
6912 }
6913
6914 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
6915 CHECK(!owner->result_ok);
6916         return DecodeError_clone(&*owner->contents.err);
6917 }
6918 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(uint64_t owner) {
6919         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
6920         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6921         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
6922         uint64_t ret_ref = tag_ptr(ret_copy, true);
6923         return ret_ref;
6924 }
6925
6926 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6927         LDKChannelConfig ret = *owner->contents.result;
6928         ret.is_owned = false;
6929         return ret;
6930 }
6931 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
6932         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6933         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
6934         uint64_t ret_ref = 0;
6935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6937         return ret_ref;
6938 }
6939
6940 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6941 CHECK(!owner->result_ok);
6942         return DecodeError_clone(&*owner->contents.err);
6943 }
6944 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
6945         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6946         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6947         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
6948         uint64_t ret_ref = tag_ptr(ret_copy, true);
6949         return ret_ref;
6950 }
6951
6952 uint32_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr"))) TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr(uint64_t ptr) {
6953         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
6954         switch(obj->tag) {
6955                 case LDKCOption_MaxDustHTLCExposureZ_Some: return 0;
6956                 case LDKCOption_MaxDustHTLCExposureZ_None: return 1;
6957                 default: abort();
6958         }
6959 }
6960 uint64_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some"))) TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some(uint64_t ptr) {
6961         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
6962         assert(obj->tag == LDKCOption_MaxDustHTLCExposureZ_Some);
6963         uint64_t some_ref = tag_ptr(&obj->some, false);
6964         return some_ref;
6965 }
6966 uint32_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_ty_from_ptr"))) TS_LDKCOption_APIErrorZ_ty_from_ptr(uint64_t ptr) {
6967         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6968         switch(obj->tag) {
6969                 case LDKCOption_APIErrorZ_Some: return 0;
6970                 case LDKCOption_APIErrorZ_None: return 1;
6971                 default: abort();
6972         }
6973 }
6974 uint64_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_Some_get_some"))) TS_LDKCOption_APIErrorZ_Some_get_some(uint64_t ptr) {
6975         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6976         assert(obj->tag == LDKCOption_APIErrorZ_Some);
6977         uint64_t some_ref = tag_ptr(&obj->some, false);
6978         return some_ref;
6979 }
6980 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6981 CHECK(owner->result_ok);
6982         return COption_APIErrorZ_clone(&*owner->contents.result);
6983 }
6984 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok(uint64_t owner) {
6985         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6986         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
6987         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
6988         uint64_t ret_ref = tag_ptr(ret_copy, true);
6989         return ret_ref;
6990 }
6991
6992 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6993 CHECK(!owner->result_ok);
6994         return DecodeError_clone(&*owner->contents.err);
6995 }
6996 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_err(uint64_t owner) {
6997         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6998         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6999         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
7000         uint64_t ret_ref = tag_ptr(ret_copy, true);
7001         return ret_ref;
7002 }
7003
7004 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7005         LDKChannelMonitorUpdate ret = *owner->contents.result;
7006         ret.is_owned = false;
7007         return ret;
7008 }
7009 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7010         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7011         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
7012         uint64_t ret_ref = 0;
7013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7015         return ret_ref;
7016 }
7017
7018 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7019 CHECK(!owner->result_ok);
7020         return DecodeError_clone(&*owner->contents.err);
7021 }
7022 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
7023         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7024         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7025         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
7026         uint64_t ret_ref = tag_ptr(ret_copy, true);
7027         return ret_ref;
7028 }
7029
7030 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
7031         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7032         switch(obj->tag) {
7033                 case LDKCOption_MonitorEventZ_Some: return 0;
7034                 case LDKCOption_MonitorEventZ_None: return 1;
7035                 default: abort();
7036         }
7037 }
7038 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
7039         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7040         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
7041         uint64_t some_ref = tag_ptr(&obj->some, false);
7042         return some_ref;
7043 }
7044 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7045 CHECK(owner->result_ok);
7046         return COption_MonitorEventZ_clone(&*owner->contents.result);
7047 }
7048 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
7049         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7050         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
7051         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
7052         uint64_t ret_ref = tag_ptr(ret_copy, true);
7053         return ret_ref;
7054 }
7055
7056 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7057 CHECK(!owner->result_ok);
7058         return DecodeError_clone(&*owner->contents.err);
7059 }
7060 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
7061         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7062         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7063         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
7064         uint64_t ret_ref = tag_ptr(ret_copy, true);
7065         return ret_ref;
7066 }
7067
7068 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7069         LDKHTLCUpdate ret = *owner->contents.result;
7070         ret.is_owned = false;
7071         return ret;
7072 }
7073 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7074         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7075         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
7076         uint64_t ret_ref = 0;
7077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7079         return ret_ref;
7080 }
7081
7082 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7083 CHECK(!owner->result_ok);
7084         return DecodeError_clone(&*owner->contents.err);
7085 }
7086 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
7087         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7088         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7089         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
7090         uint64_t ret_ref = tag_ptr(ret_copy, true);
7091         return ret_ref;
7092 }
7093
7094 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
7095         LDKOutPoint ret = owner->a;
7096         ret.is_owned = false;
7097         return ret;
7098 }
7099 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_get_a"))) TS_C2Tuple_OutPointCVec_u8ZZ_get_a(uint64_t owner) {
7100         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
7101         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
7102         uint64_t ret_ref = 0;
7103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7105         return ret_ref;
7106 }
7107
7108 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
7109         return CVec_u8Z_clone(&owner->b);
7110 }
7111 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_get_b"))) TS_C2Tuple_OutPointCVec_u8ZZ_get_b(uint64_t owner) {
7112         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
7113         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
7114         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7115         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7116         CVec_u8Z_free(ret_var);
7117         return ret_arr;
7118 }
7119
7120 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
7121         return owner->a;
7122 }
7123 int32_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_get_a"))) TS_C2Tuple_u32CVec_u8ZZ_get_a(uint64_t owner) {
7124         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
7125         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
7126         return ret_conv;
7127 }
7128
7129 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
7130         return CVec_u8Z_clone(&owner->b);
7131 }
7132 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_get_b"))) TS_C2Tuple_u32CVec_u8ZZ_get_b(uint64_t owner) {
7133         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
7134         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
7135         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7136         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7137         CVec_u8Z_free(ret_var);
7138         return ret_arr;
7139 }
7140
7141 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
7142         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
7143         for (size_t i = 0; i < ret.datalen; i++) {
7144                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
7145         }
7146         return ret;
7147 }
7148 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
7149         return ThirtyTwoBytes_clone(&owner->a);
7150 }
7151 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(uint64_t owner) {
7152         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
7153         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7154         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data, 32);
7155         return ret_arr;
7156 }
7157
7158 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
7159         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
7160 }
7161 uint64_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(uint64_t owner) {
7162         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
7163         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
7164         uint64_tArray ret_arr = NULL;
7165         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7166         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7167         for (size_t x = 0; x < ret_var.datalen; x++) {
7168                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
7169                 *ret_conv_23_conv = ret_var.data[x];
7170                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
7171         }
7172         
7173         FREE(ret_var.data);
7174         return ret_arr;
7175 }
7176
7177 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
7178         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ clone bytes"), .datalen = orig->datalen };
7179         for (size_t i = 0; i < ret.datalen; i++) {
7180                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
7181         }
7182         return ret;
7183 }
7184 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
7185         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
7186         for (size_t i = 0; i < ret.datalen; i++) {
7187                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
7188         }
7189         return ret;
7190 }
7191 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7192         return owner->a;
7193 }
7194 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
7195         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7196         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
7197         return ret_conv;
7198 }
7199
7200 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7201         return TxOut_clone(&owner->b);
7202 }
7203 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
7204         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7205         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7206         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
7207         return tag_ptr(ret_ref, true);
7208 }
7209
7210 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
7211         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
7212         for (size_t i = 0; i < ret.datalen; i++) {
7213                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
7214         }
7215         return ret;
7216 }
7217 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7218         return ThirtyTwoBytes_clone(&owner->a);
7219 }
7220 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
7221         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7222         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7223         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
7224         return ret_arr;
7225 }
7226
7227 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7228         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
7229 }
7230 uint64_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
7231         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7232         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
7233         uint64_tArray ret_arr = NULL;
7234         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7235         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7236         for (size_t u = 0; u < ret_var.datalen; u++) {
7237                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7238                 *ret_conv_20_conv = ret_var.data[u];
7239                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
7240         }
7241         
7242         FREE(ret_var.data);
7243         return ret_arr;
7244 }
7245
7246 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
7247         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ clone bytes"), .datalen = orig->datalen };
7248         for (size_t i = 0; i < ret.datalen; i++) {
7249                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
7250         }
7251         return ret;
7252 }
7253 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
7254         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7255         switch(obj->tag) {
7256                 case LDKBalance_ClaimableOnChannelClose: return 0;
7257                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
7258                 case LDKBalance_ContentiousClaimable: return 2;
7259                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
7260                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
7261                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
7262                 default: abort();
7263         }
7264 }
7265 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis(uint64_t ptr) {
7266         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7267         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
7268         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
7269         return amount_satoshis_conv;
7270 }
7271 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis(uint64_t ptr) {
7272         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7273         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
7274         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
7275         return amount_satoshis_conv;
7276 }
7277 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
7278         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7279         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
7280         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
7281         return confirmation_height_conv;
7282 }
7283 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_amount_satoshis(uint64_t ptr) {
7284         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7285         assert(obj->tag == LDKBalance_ContentiousClaimable);
7286         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
7287         return amount_satoshis_conv;
7288 }
7289 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
7290         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7291         assert(obj->tag == LDKBalance_ContentiousClaimable);
7292         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
7293         return timeout_height_conv;
7294 }
7295 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_hash"))) TS_LDKBalance_ContentiousClaimable_get_payment_hash(uint64_t ptr) {
7296         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7297         assert(obj->tag == LDKBalance_ContentiousClaimable);
7298         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7299         memcpy(payment_hash_arr->elems, obj->contentious_claimable.payment_hash.data, 32);
7300         return payment_hash_arr;
7301 }
7302 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_preimage"))) TS_LDKBalance_ContentiousClaimable_get_payment_preimage(uint64_t ptr) {
7303         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7304         assert(obj->tag == LDKBalance_ContentiousClaimable);
7305         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
7306         memcpy(payment_preimage_arr->elems, obj->contentious_claimable.payment_preimage.data, 32);
7307         return payment_preimage_arr;
7308 }
7309 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
7310         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7311         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7312         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
7313         return amount_satoshis_conv;
7314 }
7315 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
7316         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7317         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7318         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
7319         return claimable_height_conv;
7320 }
7321 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash(uint64_t ptr) {
7322         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7323         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7324         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7325         memcpy(payment_hash_arr->elems, obj->maybe_timeout_claimable_htlc.payment_hash.data, 32);
7326         return payment_hash_arr;
7327 }
7328 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
7329         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7330         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7331         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
7332         return amount_satoshis_conv;
7333 }
7334 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
7335         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7336         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7337         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
7338         return expiry_height_conv;
7339 }
7340 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash(uint64_t ptr) {
7341         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7342         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7343         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7344         memcpy(payment_hash_arr->elems, obj->maybe_preimage_claimable_htlc.payment_hash.data, 32);
7345         return payment_hash_arr;
7346 }
7347 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis(uint64_t ptr) {
7348         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7349         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
7350         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
7351         return amount_satoshis_conv;
7352 }
7353 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
7354         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
7355         for (size_t i = 0; i < ret.datalen; i++) {
7356                 ret.data[i] = Balance_clone(&orig->data[i]);
7357         }
7358         return ret;
7359 }
7360 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
7361         return ThirtyTwoBytes_clone(&owner->a);
7362 }
7363 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(uint64_t owner) {
7364         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
7365         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7366         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data, 32);
7367         return ret_arr;
7368 }
7369
7370 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
7371         LDKChannelMonitor ret = owner->b;
7372         ret.is_owned = false;
7373         return ret;
7374 }
7375 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(uint64_t owner) {
7376         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
7377         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
7378         uint64_t ret_ref = 0;
7379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7381         return ret_ref;
7382 }
7383
7384 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7385 CHECK(owner->result_ok);
7386         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
7387 }
7388 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
7389         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
7390         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
7391         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
7392         return tag_ptr(ret_conv, true);
7393 }
7394
7395 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7396 CHECK(!owner->result_ok);
7397         return DecodeError_clone(&*owner->contents.err);
7398 }
7399 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
7400         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
7401         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7402         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
7403         uint64_t ret_ref = tag_ptr(ret_copy, true);
7404         return ret_ref;
7405 }
7406
7407 typedef struct LDKType_JCalls {
7408         atomic_size_t refcnt;
7409         uint32_t instance_ptr;
7410 } LDKType_JCalls;
7411 static void LDKType_JCalls_free(void* this_arg) {
7412         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7413         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7414                 FREE(j_calls);
7415         }
7416 }
7417 uint16_t type_id_LDKType_jcall(const void* this_arg) {
7418         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7419         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 41, 0, 0, 0, 0, 0, 0);
7420 }
7421 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
7422         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7423         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 42, 0, 0, 0, 0, 0, 0);
7424         LDKStr ret_conv = str_ref_to_owned_c(ret);
7425         return ret_conv;
7426 }
7427 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
7428         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7429         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 43, 0, 0, 0, 0, 0, 0);
7430         LDKCVec_u8Z ret_ref;
7431         ret_ref.datalen = ret->arr_len;
7432         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7433         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
7434         return ret_ref;
7435 }
7436 static void LDKType_JCalls_cloned(LDKType* new_obj) {
7437         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
7438         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7439 }
7440 static inline LDKType LDKType_init (JSValue o) {
7441         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
7442         atomic_init(&calls->refcnt, 1);
7443         calls->instance_ptr = o;
7444
7445         LDKType ret = {
7446                 .this_arg = (void*) calls,
7447                 .type_id = type_id_LDKType_jcall,
7448                 .debug_str = debug_str_LDKType_jcall,
7449                 .write = write_LDKType_jcall,
7450                 .cloned = LDKType_JCalls_cloned,
7451                 .free = LDKType_JCalls_free,
7452         };
7453         return ret;
7454 }
7455 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
7456         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
7457         *res_ptr = LDKType_init(o);
7458         return tag_ptr(res_ptr, true);
7459 }
7460 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
7461         void* this_arg_ptr = untag_ptr(this_arg);
7462         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7463         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7464         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
7465         return ret_conv;
7466 }
7467
7468 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
7469         void* this_arg_ptr = untag_ptr(this_arg);
7470         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7471         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7472         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
7473         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7474         Str_free(ret_str);
7475         return ret_conv;
7476 }
7477
7478 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
7479         void* this_arg_ptr = untag_ptr(this_arg);
7480         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7481         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7482         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7483         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7484         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7485         CVec_u8Z_free(ret_var);
7486         return ret_arr;
7487 }
7488
7489 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7490         return owner->a;
7491 }
7492 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
7493         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
7494         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
7495         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
7496         return ret_arr;
7497 }
7498
7499 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7500         return Type_clone(&owner->b);
7501 }
7502 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
7503         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
7504         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
7505         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
7506         return tag_ptr(ret_ret, true);
7507 }
7508
7509 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
7510         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
7511         for (size_t i = 0; i < ret.datalen; i++) {
7512                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
7513         }
7514         return ret;
7515 }
7516 static inline struct LDKPublicKey C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
7517         return owner->a;
7518 }
7519 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(uint64_t owner) {
7520         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
7521         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
7522         memcpy(ret_arr->elems, C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(owner_conv).compressed_form, 33);
7523         return ret_arr;
7524 }
7525
7526 static inline struct LDKCVec_SocketAddressZ C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
7527         return CVec_SocketAddressZ_clone(&owner->b);
7528 }
7529 uint64_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(uint64_t owner) {
7530         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
7531         LDKCVec_SocketAddressZ ret_var = C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(owner_conv);
7532         uint64_tArray ret_arr = NULL;
7533         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7534         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7535         for (size_t p = 0; p < ret_var.datalen; p++) {
7536                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
7537                 *ret_conv_15_copy = ret_var.data[p];
7538                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
7539                 ret_arr_ptr[p] = ret_conv_15_ref;
7540         }
7541         
7542         FREE(ret_var.data);
7543         return ret_arr;
7544 }
7545
7546 static inline LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ *orig) {
7547         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
7548         for (size_t i = 0; i < ret.datalen; i++) {
7549                 ret.data[i] = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(&orig->data[i]);
7550         }
7551         return ret;
7552 }
7553 typedef struct LDKOnionMessageContents_JCalls {
7554         atomic_size_t refcnt;
7555         uint32_t instance_ptr;
7556 } LDKOnionMessageContents_JCalls;
7557 static void LDKOnionMessageContents_JCalls_free(void* this_arg) {
7558         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
7559         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7560                 FREE(j_calls);
7561         }
7562 }
7563 uint64_t tlv_type_LDKOnionMessageContents_jcall(const void* this_arg) {
7564         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
7565         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 44, 0, 0, 0, 0, 0, 0);
7566 }
7567 LDKCVec_u8Z write_LDKOnionMessageContents_jcall(const void* this_arg) {
7568         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
7569         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 45, 0, 0, 0, 0, 0, 0);
7570         LDKCVec_u8Z ret_ref;
7571         ret_ref.datalen = ret->arr_len;
7572         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7573         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
7574         return ret_ref;
7575 }
7576 LDKStr debug_str_LDKOnionMessageContents_jcall(const void* this_arg) {
7577         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
7578         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 46, 0, 0, 0, 0, 0, 0);
7579         LDKStr ret_conv = str_ref_to_owned_c(ret);
7580         return ret_conv;
7581 }
7582 static void LDKOnionMessageContents_JCalls_cloned(LDKOnionMessageContents* new_obj) {
7583         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) new_obj->this_arg;
7584         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7585 }
7586 static inline LDKOnionMessageContents LDKOnionMessageContents_init (JSValue o) {
7587         LDKOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKOnionMessageContents_JCalls), "LDKOnionMessageContents_JCalls");
7588         atomic_init(&calls->refcnt, 1);
7589         calls->instance_ptr = o;
7590
7591         LDKOnionMessageContents ret = {
7592                 .this_arg = (void*) calls,
7593                 .tlv_type = tlv_type_LDKOnionMessageContents_jcall,
7594                 .write = write_LDKOnionMessageContents_jcall,
7595                 .debug_str = debug_str_LDKOnionMessageContents_jcall,
7596                 .cloned = LDKOnionMessageContents_JCalls_cloned,
7597                 .free = LDKOnionMessageContents_JCalls_free,
7598         };
7599         return ret;
7600 }
7601 uint64_t  __attribute__((export_name("TS_LDKOnionMessageContents_new"))) TS_LDKOnionMessageContents_new(JSValue o) {
7602         LDKOnionMessageContents *res_ptr = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
7603         *res_ptr = LDKOnionMessageContents_init(o);
7604         return tag_ptr(res_ptr, true);
7605 }
7606 int64_t  __attribute__((export_name("TS_OnionMessageContents_tlv_type"))) TS_OnionMessageContents_tlv_type(uint64_t this_arg) {
7607         void* this_arg_ptr = untag_ptr(this_arg);
7608         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7609         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
7610         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
7611         return ret_conv;
7612 }
7613
7614 int8_tArray  __attribute__((export_name("TS_OnionMessageContents_write"))) TS_OnionMessageContents_write(uint64_t this_arg) {
7615         void* this_arg_ptr = untag_ptr(this_arg);
7616         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7617         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
7618         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7619         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7620         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7621         CVec_u8Z_free(ret_var);
7622         return ret_arr;
7623 }
7624
7625 jstring  __attribute__((export_name("TS_OnionMessageContents_debug_str"))) TS_OnionMessageContents_debug_str(uint64_t this_arg) {
7626         void* this_arg_ptr = untag_ptr(this_arg);
7627         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7628         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
7629         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
7630         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7631         Str_free(ret_str);
7632         return ret_conv;
7633 }
7634
7635 uint32_t __attribute__((export_name("TS_LDKCOption_OnionMessageContentsZ_ty_from_ptr"))) TS_LDKCOption_OnionMessageContentsZ_ty_from_ptr(uint64_t ptr) {
7636         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
7637         switch(obj->tag) {
7638                 case LDKCOption_OnionMessageContentsZ_Some: return 0;
7639                 case LDKCOption_OnionMessageContentsZ_None: return 1;
7640                 default: abort();
7641         }
7642 }
7643 uint64_t __attribute__((export_name("TS_LDKCOption_OnionMessageContentsZ_Some_get_some"))) TS_LDKCOption_OnionMessageContentsZ_Some_get_some(uint64_t ptr) {
7644         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
7645         assert(obj->tag == LDKCOption_OnionMessageContentsZ_Some);
7646         LDKOnionMessageContents* some_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
7647         *some_ret = OnionMessageContents_clone(&obj->some);
7648         return tag_ptr(some_ret, true);
7649 }
7650 static inline struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
7651 CHECK(owner->result_ok);
7652         return COption_OnionMessageContentsZ_clone(&*owner->contents.result);
7653 }
7654 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(uint64_t owner) {
7655         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
7656         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
7657         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
7658         uint64_t ret_ref = tag_ptr(ret_copy, true);
7659         return ret_ref;
7660 }
7661
7662 static inline struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
7663 CHECK(!owner->result_ok);
7664         return DecodeError_clone(&*owner->contents.err);
7665 }
7666 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(uint64_t owner) {
7667         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
7668         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7669         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
7670         uint64_t ret_ref = tag_ptr(ret_copy, true);
7671         return ret_ref;
7672 }
7673
7674 static inline struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
7675         return OnionMessageContents_clone(&owner->a);
7676 }
7677 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(uint64_t owner) {
7678         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
7679         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
7680         *ret_ret = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(owner_conv);
7681         return tag_ptr(ret_ret, true);
7682 }
7683
7684 static inline struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
7685         return Destination_clone(&owner->b);
7686 }
7687 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(uint64_t owner) {
7688         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
7689         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
7690         *ret_copy = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(owner_conv);
7691         uint64_t ret_ref = tag_ptr(ret_copy, true);
7692         return ret_ref;
7693 }
7694
7695 static inline struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
7696         LDKBlindedPath ret = owner->c;
7697         ret.is_owned = false;
7698         return ret;
7699 }
7700 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(uint64_t owner) {
7701         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
7702         LDKBlindedPath ret_var = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(owner_conv);
7703         uint64_t ret_ref = 0;
7704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7706         return ret_ref;
7707 }
7708
7709 static inline LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ *orig) {
7710         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
7711         for (size_t i = 0; i < ret.datalen; i++) {
7712                 ret.data[i] = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(&orig->data[i]);
7713         }
7714         return ret;
7715 }
7716 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
7717         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
7718         switch(obj->tag) {
7719                 case LDKCOption_TypeZ_Some: return 0;
7720                 case LDKCOption_TypeZ_None: return 1;
7721                 default: abort();
7722         }
7723 }
7724 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
7725         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
7726         assert(obj->tag == LDKCOption_TypeZ_Some);
7727         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
7728         *some_ret = Type_clone(&obj->some);
7729         return tag_ptr(some_ret, true);
7730 }
7731 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7732 CHECK(owner->result_ok);
7733         return COption_TypeZ_clone(&*owner->contents.result);
7734 }
7735 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
7736         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
7737         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
7738         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
7739         uint64_t ret_ref = tag_ptr(ret_copy, true);
7740         return ret_ref;
7741 }
7742
7743 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7744 CHECK(!owner->result_ok);
7745         return DecodeError_clone(&*owner->contents.err);
7746 }
7747 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
7748         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
7749         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7750         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
7751         uint64_t ret_ref = tag_ptr(ret_copy, true);
7752         return ret_ref;
7753 }
7754
7755 uint32_t __attribute__((export_name("TS_LDKCOption_SocketAddressZ_ty_from_ptr"))) TS_LDKCOption_SocketAddressZ_ty_from_ptr(uint64_t ptr) {
7756         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
7757         switch(obj->tag) {
7758                 case LDKCOption_SocketAddressZ_Some: return 0;
7759                 case LDKCOption_SocketAddressZ_None: return 1;
7760                 default: abort();
7761         }
7762 }
7763 uint64_t __attribute__((export_name("TS_LDKCOption_SocketAddressZ_Some_get_some"))) TS_LDKCOption_SocketAddressZ_Some_get_some(uint64_t ptr) {
7764         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
7765         assert(obj->tag == LDKCOption_SocketAddressZ_Some);
7766         uint64_t some_ref = tag_ptr(&obj->some, false);
7767         return some_ref;
7768 }
7769 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
7770         return owner->a;
7771 }
7772 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(uint64_t owner) {
7773         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
7774         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
7775         memcpy(ret_arr->elems, C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(owner_conv).compressed_form, 33);
7776         return ret_arr;
7777 }
7778
7779 static inline struct LDKCOption_SocketAddressZ C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
7780         return COption_SocketAddressZ_clone(&owner->b);
7781 }
7782 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(uint64_t owner) {
7783         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
7784         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
7785         *ret_copy = C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(owner_conv);
7786         uint64_t ret_ref = tag_ptr(ret_copy, true);
7787         return ret_ref;
7788 }
7789
7790 static inline LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ *orig) {
7791         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
7792         for (size_t i = 0; i < ret.datalen; i++) {
7793                 ret.data[i] = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(&orig->data[i]);
7794         }
7795         return ret;
7796 }
7797 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7798 CHECK(owner->result_ok);
7799         return CVec_u8Z_clone(&*owner->contents.result);
7800 }
7801 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
7802         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7803         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
7804         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7805         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7806         CVec_u8Z_free(ret_var);
7807         return ret_arr;
7808 }
7809
7810 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7811         LDKPeerHandleError ret = *owner->contents.err;
7812         ret.is_owned = false;
7813         return ret;
7814 }
7815 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
7816         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7817         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
7818         uint64_t ret_ref = 0;
7819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7821         return ret_ref;
7822 }
7823
7824 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7825 CHECK(owner->result_ok);
7826         return *owner->contents.result;
7827 }
7828 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
7829         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7830         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
7831 }
7832
7833 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7834         LDKPeerHandleError ret = *owner->contents.err;
7835         ret.is_owned = false;
7836         return ret;
7837 }
7838 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
7839         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7840         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(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 bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7848 CHECK(owner->result_ok);
7849         return *owner->contents.result;
7850 }
7851 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
7852         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7853         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
7854         return ret_conv;
7855 }
7856
7857 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7858         LDKPeerHandleError ret = *owner->contents.err;
7859         ret.is_owned = false;
7860         return ret;
7861 }
7862 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
7863         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7864         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
7865         uint64_t ret_ref = 0;
7866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7868         return ret_ref;
7869 }
7870
7871 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
7872         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7873         switch(obj->tag) {
7874                 case LDKGraphSyncError_DecodeError: return 0;
7875                 case LDKGraphSyncError_LightningError: return 1;
7876                 default: abort();
7877         }
7878 }
7879 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
7880         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7881         assert(obj->tag == LDKGraphSyncError_DecodeError);
7882         uint64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
7883         return decode_error_ref;
7884 }
7885 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
7886         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7887         assert(obj->tag == LDKGraphSyncError_LightningError);
7888         LDKLightningError lightning_error_var = obj->lightning_error;
7889                         uint64_t lightning_error_ref = 0;
7890                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
7891                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
7892         return lightning_error_ref;
7893 }
7894 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7895 CHECK(owner->result_ok);
7896         return *owner->contents.result;
7897 }
7898 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
7899         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7900         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
7901         return ret_conv;
7902 }
7903
7904 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7905 CHECK(!owner->result_ok);
7906         return GraphSyncError_clone(&*owner->contents.err);
7907 }
7908 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
7909         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7910         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
7911         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
7912         uint64_t ret_ref = tag_ptr(ret_copy, true);
7913         return ret_ref;
7914 }
7915
7916 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
7917 CHECK(owner->result_ok);
7918         return CVec_u8Z_clone(&*owner->contents.result);
7919 }
7920 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_get_ok"))) TS_CResult_CVec_u8ZIOErrorZ_get_ok(uint64_t owner) {
7921         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
7922         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
7923         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7924         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7925         CVec_u8Z_free(ret_var);
7926         return ret_arr;
7927 }
7928
7929 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
7930 CHECK(!owner->result_ok);
7931         return *owner->contents.err;
7932 }
7933 uint32_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_get_err"))) TS_CResult_CVec_u8ZIOErrorZ_get_err(uint64_t owner) {
7934         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
7935         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
7936         return ret_conv;
7937 }
7938
7939 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
7940 CHECK(owner->result_ok);
7941         return *owner->contents.result;
7942 }
7943 void  __attribute__((export_name("TS_CResult_NoneIOErrorZ_get_ok"))) TS_CResult_NoneIOErrorZ_get_ok(uint64_t owner) {
7944         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
7945         CResult_NoneIOErrorZ_get_ok(owner_conv);
7946 }
7947
7948 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
7949 CHECK(!owner->result_ok);
7950         return *owner->contents.err;
7951 }
7952 uint32_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_get_err"))) TS_CResult_NoneIOErrorZ_get_err(uint64_t owner) {
7953         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
7954         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneIOErrorZ_get_err(owner_conv));
7955         return ret_conv;
7956 }
7957
7958 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
7959 CHECK(owner->result_ok);
7960         return *owner->contents.result;
7961 }
7962 ptrArray  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_get_ok"))) TS_CResult_CVec_StrZIOErrorZ_get_ok(uint64_t owner) {
7963         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
7964         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
7965         ptrArray ret_arr = NULL;
7966         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
7967         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
7968         for (size_t i = 0; i < ret_var.datalen; i++) {
7969                 LDKStr ret_conv_8_str = ret_var.data[i];
7970                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
7971                 ret_arr_ptr[i] = ret_conv_8_conv;
7972         }
7973         
7974         return ret_arr;
7975 }
7976
7977 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
7978 CHECK(!owner->result_ok);
7979         return *owner->contents.err;
7980 }
7981 uint32_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_get_err"))) TS_CResult_CVec_StrZIOErrorZ_get_err(uint64_t owner) {
7982         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
7983         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
7984         return ret_conv;
7985 }
7986
7987 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
7988         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
7989         for (size_t i = 0; i < ret.datalen; i++) {
7990                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
7991         }
7992         return ret;
7993 }
7994 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
7995 CHECK(owner->result_ok);
7996         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
7997 }
7998 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(uint64_t owner) {
7999         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
8000         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
8001         uint64_tArray ret_arr = NULL;
8002         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8003         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8004         for (size_t o = 0; o < ret_var.datalen; o++) {
8005                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
8006                 *ret_conv_40_conv = ret_var.data[o];
8007                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
8008         }
8009         
8010         FREE(ret_var.data);
8011         return ret_arr;
8012 }
8013
8014 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
8015 CHECK(!owner->result_ok);
8016         return *owner->contents.err;
8017 }
8018 uint32_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(uint64_t owner) {
8019         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
8020         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
8021         return ret_conv;
8022 }
8023
8024 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
8025 CHECK(owner->result_ok);
8026         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
8027 }
8028 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(uint64_t owner) {
8029         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
8030         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
8031         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
8032         return tag_ptr(ret_conv, true);
8033 }
8034
8035 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
8036 CHECK(!owner->result_ok);
8037         return *owner->contents.err;
8038 }
8039 uint32_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(uint64_t owner) {
8040         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
8041         uint32_t ret_conv = LDKIOError_to_js(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
8042         return ret_conv;
8043 }
8044
8045 uint32_t __attribute__((export_name("TS_LDKCOption_SecretKeyZ_ty_from_ptr"))) TS_LDKCOption_SecretKeyZ_ty_from_ptr(uint64_t ptr) {
8046         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
8047         switch(obj->tag) {
8048                 case LDKCOption_SecretKeyZ_Some: return 0;
8049                 case LDKCOption_SecretKeyZ_None: return 1;
8050                 default: abort();
8051         }
8052 }
8053 int8_tArray __attribute__((export_name("TS_LDKCOption_SecretKeyZ_Some_get_some"))) TS_LDKCOption_SecretKeyZ_Some_get_some(uint64_t ptr) {
8054         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
8055         assert(obj->tag == LDKCOption_SecretKeyZ_Some);
8056         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
8057         memcpy(some_arr->elems, obj->some.bytes, 32);
8058         return some_arr;
8059 }
8060 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
8061         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
8062         ret.is_owned = false;
8063         return ret;
8064 }
8065 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_get_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_get_ok(uint64_t owner) {
8066         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
8067         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
8068         uint64_t ret_ref = 0;
8069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8071         return ret_ref;
8072 }
8073
8074 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
8075 CHECK(!owner->result_ok);
8076         return *owner->contents.err;
8077 }
8078 void  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_get_err"))) TS_CResult_VerifiedInvoiceRequestNoneZ_get_err(uint64_t owner) {
8079         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
8080         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
8081 }
8082
8083 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
8084         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
8085         for (size_t i = 0; i < ret.datalen; i++) {
8086                 ret.data[i] = Witness_clone(&orig->data[i]);
8087         }
8088         return ret;
8089 }
8090 uint32_t __attribute__((export_name("TS_LDKCOption_i64Z_ty_from_ptr"))) TS_LDKCOption_i64Z_ty_from_ptr(uint64_t ptr) {
8091         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
8092         switch(obj->tag) {
8093                 case LDKCOption_i64Z_Some: return 0;
8094                 case LDKCOption_i64Z_None: return 1;
8095                 default: abort();
8096         }
8097 }
8098 int64_t __attribute__((export_name("TS_LDKCOption_i64Z_Some_get_some"))) TS_LDKCOption_i64Z_Some_get_some(uint64_t ptr) {
8099         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
8100         assert(obj->tag == LDKCOption_i64Z_Some);
8101         int64_t some_conv = obj->some;
8102         return some_conv;
8103 }
8104 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
8105 CHECK(owner->result_ok);
8106         return SocketAddress_clone(&*owner->contents.result);
8107 }
8108 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_get_ok"))) TS_CResult_SocketAddressDecodeErrorZ_get_ok(uint64_t owner) {
8109         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
8110         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8111         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
8112         uint64_t ret_ref = tag_ptr(ret_copy, true);
8113         return ret_ref;
8114 }
8115
8116 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
8117 CHECK(!owner->result_ok);
8118         return DecodeError_clone(&*owner->contents.err);
8119 }
8120 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_get_err"))) TS_CResult_SocketAddressDecodeErrorZ_get_err(uint64_t owner) {
8121         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
8122         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8123         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
8124         uint64_t ret_ref = tag_ptr(ret_copy, true);
8125         return ret_ref;
8126 }
8127
8128 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
8129 CHECK(owner->result_ok);
8130         return SocketAddress_clone(&*owner->contents.result);
8131 }
8132 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_get_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_get_ok(uint64_t owner) {
8133         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
8134         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8135         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
8136         uint64_t ret_ref = tag_ptr(ret_copy, true);
8137         return ret_ref;
8138 }
8139
8140 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
8141 CHECK(!owner->result_ok);
8142         return SocketAddressParseError_clone(&*owner->contents.err);
8143 }
8144 uint32_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_get_err"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_get_err(uint64_t owner) {
8145         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
8146         uint32_t ret_conv = LDKSocketAddressParseError_to_js(CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
8147         return ret_conv;
8148 }
8149
8150 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8151         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8152         for (size_t i = 0; i < ret.datalen; i++) {
8153                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8154         }
8155         return ret;
8156 }
8157 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8158         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8159         for (size_t i = 0; i < ret.datalen; i++) {
8160                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8161         }
8162         return ret;
8163 }
8164 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8165         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8166         for (size_t i = 0; i < ret.datalen; i++) {
8167                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8168         }
8169         return ret;
8170 }
8171 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8172         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8173         for (size_t i = 0; i < ret.datalen; i++) {
8174                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8175         }
8176         return ret;
8177 }
8178 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8179         LDKAcceptChannel ret = *owner->contents.result;
8180         ret.is_owned = false;
8181         return ret;
8182 }
8183 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
8184         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8185         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
8186         uint64_t ret_ref = 0;
8187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8189         return ret_ref;
8190 }
8191
8192 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8193 CHECK(!owner->result_ok);
8194         return DecodeError_clone(&*owner->contents.err);
8195 }
8196 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
8197         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8198         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8199         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
8200         uint64_t ret_ref = tag_ptr(ret_copy, true);
8201         return ret_ref;
8202 }
8203
8204 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
8205         LDKAcceptChannelV2 ret = *owner->contents.result;
8206         ret.is_owned = false;
8207         return ret;
8208 }
8209 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
8210         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
8211         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
8212         uint64_t ret_ref = 0;
8213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8215         return ret_ref;
8216 }
8217
8218 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
8219 CHECK(!owner->result_ok);
8220         return DecodeError_clone(&*owner->contents.err);
8221 }
8222 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_err(uint64_t owner) {
8223         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
8224         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8225         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
8226         uint64_t ret_ref = tag_ptr(ret_copy, true);
8227         return ret_ref;
8228 }
8229
8230 static inline struct LDKStfu CResult_StfuDecodeErrorZ_get_ok(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
8231         LDKStfu ret = *owner->contents.result;
8232         ret.is_owned = false;
8233         return ret;
8234 }
8235 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_get_ok"))) TS_CResult_StfuDecodeErrorZ_get_ok(uint64_t owner) {
8236         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
8237         LDKStfu ret_var = CResult_StfuDecodeErrorZ_get_ok(owner_conv);
8238         uint64_t ret_ref = 0;
8239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8241         return ret_ref;
8242 }
8243
8244 static inline struct LDKDecodeError CResult_StfuDecodeErrorZ_get_err(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
8245 CHECK(!owner->result_ok);
8246         return DecodeError_clone(&*owner->contents.err);
8247 }
8248 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_get_err"))) TS_CResult_StfuDecodeErrorZ_get_err(uint64_t owner) {
8249         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
8250         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8251         *ret_copy = CResult_StfuDecodeErrorZ_get_err(owner_conv);
8252         uint64_t ret_ref = tag_ptr(ret_copy, true);
8253         return ret_ref;
8254 }
8255
8256 static inline struct LDKSplice CResult_SpliceDecodeErrorZ_get_ok(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
8257         LDKSplice ret = *owner->contents.result;
8258         ret.is_owned = false;
8259         return ret;
8260 }
8261 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_get_ok"))) TS_CResult_SpliceDecodeErrorZ_get_ok(uint64_t owner) {
8262         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
8263         LDKSplice ret_var = CResult_SpliceDecodeErrorZ_get_ok(owner_conv);
8264         uint64_t ret_ref = 0;
8265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8267         return ret_ref;
8268 }
8269
8270 static inline struct LDKDecodeError CResult_SpliceDecodeErrorZ_get_err(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
8271 CHECK(!owner->result_ok);
8272         return DecodeError_clone(&*owner->contents.err);
8273 }
8274 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_get_err"))) TS_CResult_SpliceDecodeErrorZ_get_err(uint64_t owner) {
8275         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
8276         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8277         *ret_copy = CResult_SpliceDecodeErrorZ_get_err(owner_conv);
8278         uint64_t ret_ref = tag_ptr(ret_copy, true);
8279         return ret_ref;
8280 }
8281
8282 static inline struct LDKSpliceAck CResult_SpliceAckDecodeErrorZ_get_ok(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
8283         LDKSpliceAck ret = *owner->contents.result;
8284         ret.is_owned = false;
8285         return ret;
8286 }
8287 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_get_ok"))) TS_CResult_SpliceAckDecodeErrorZ_get_ok(uint64_t owner) {
8288         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
8289         LDKSpliceAck ret_var = CResult_SpliceAckDecodeErrorZ_get_ok(owner_conv);
8290         uint64_t ret_ref = 0;
8291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8293         return ret_ref;
8294 }
8295
8296 static inline struct LDKDecodeError CResult_SpliceAckDecodeErrorZ_get_err(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
8297 CHECK(!owner->result_ok);
8298         return DecodeError_clone(&*owner->contents.err);
8299 }
8300 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_get_err"))) TS_CResult_SpliceAckDecodeErrorZ_get_err(uint64_t owner) {
8301         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
8302         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8303         *ret_copy = CResult_SpliceAckDecodeErrorZ_get_err(owner_conv);
8304         uint64_t ret_ref = tag_ptr(ret_copy, true);
8305         return ret_ref;
8306 }
8307
8308 static inline struct LDKSpliceLocked CResult_SpliceLockedDecodeErrorZ_get_ok(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
8309         LDKSpliceLocked ret = *owner->contents.result;
8310         ret.is_owned = false;
8311         return ret;
8312 }
8313 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_get_ok"))) TS_CResult_SpliceLockedDecodeErrorZ_get_ok(uint64_t owner) {
8314         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
8315         LDKSpliceLocked ret_var = CResult_SpliceLockedDecodeErrorZ_get_ok(owner_conv);
8316         uint64_t ret_ref = 0;
8317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8319         return ret_ref;
8320 }
8321
8322 static inline struct LDKDecodeError CResult_SpliceLockedDecodeErrorZ_get_err(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
8323 CHECK(!owner->result_ok);
8324         return DecodeError_clone(&*owner->contents.err);
8325 }
8326 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_get_err"))) TS_CResult_SpliceLockedDecodeErrorZ_get_err(uint64_t owner) {
8327         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
8328         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8329         *ret_copy = CResult_SpliceLockedDecodeErrorZ_get_err(owner_conv);
8330         uint64_t ret_ref = tag_ptr(ret_copy, true);
8331         return ret_ref;
8332 }
8333
8334 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
8335         LDKTxAddInput ret = *owner->contents.result;
8336         ret.is_owned = false;
8337         return ret;
8338 }
8339 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_ok"))) TS_CResult_TxAddInputDecodeErrorZ_get_ok(uint64_t owner) {
8340         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
8341         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
8342         uint64_t ret_ref = 0;
8343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8345         return ret_ref;
8346 }
8347
8348 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
8349 CHECK(!owner->result_ok);
8350         return DecodeError_clone(&*owner->contents.err);
8351 }
8352 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_err"))) TS_CResult_TxAddInputDecodeErrorZ_get_err(uint64_t owner) {
8353         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
8354         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8355         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
8356         uint64_t ret_ref = tag_ptr(ret_copy, true);
8357         return ret_ref;
8358 }
8359
8360 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
8361         LDKTxAddOutput ret = *owner->contents.result;
8362         ret.is_owned = false;
8363         return ret;
8364 }
8365 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_get_ok(uint64_t owner) {
8366         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
8367         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
8368         uint64_t ret_ref = 0;
8369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8371         return ret_ref;
8372 }
8373
8374 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
8375 CHECK(!owner->result_ok);
8376         return DecodeError_clone(&*owner->contents.err);
8377 }
8378 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_err"))) TS_CResult_TxAddOutputDecodeErrorZ_get_err(uint64_t owner) {
8379         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
8380         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8381         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
8382         uint64_t ret_ref = tag_ptr(ret_copy, true);
8383         return ret_ref;
8384 }
8385
8386 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
8387         LDKTxRemoveInput ret = *owner->contents.result;
8388         ret.is_owned = false;
8389         return ret;
8390 }
8391 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_ok(uint64_t owner) {
8392         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
8393         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
8394         uint64_t ret_ref = 0;
8395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8397         return ret_ref;
8398 }
8399
8400 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
8401 CHECK(!owner->result_ok);
8402         return DecodeError_clone(&*owner->contents.err);
8403 }
8404 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_err(uint64_t owner) {
8405         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
8406         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8407         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
8408         uint64_t ret_ref = tag_ptr(ret_copy, true);
8409         return ret_ref;
8410 }
8411
8412 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
8413         LDKTxRemoveOutput ret = *owner->contents.result;
8414         ret.is_owned = false;
8415         return ret;
8416 }
8417 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok(uint64_t owner) {
8418         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
8419         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
8420         uint64_t ret_ref = 0;
8421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8423         return ret_ref;
8424 }
8425
8426 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
8427 CHECK(!owner->result_ok);
8428         return DecodeError_clone(&*owner->contents.err);
8429 }
8430 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_err(uint64_t owner) {
8431         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
8432         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8433         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
8434         uint64_t ret_ref = tag_ptr(ret_copy, true);
8435         return ret_ref;
8436 }
8437
8438 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
8439         LDKTxComplete ret = *owner->contents.result;
8440         ret.is_owned = false;
8441         return ret;
8442 }
8443 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_ok"))) TS_CResult_TxCompleteDecodeErrorZ_get_ok(uint64_t owner) {
8444         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
8445         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
8446         uint64_t ret_ref = 0;
8447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8449         return ret_ref;
8450 }
8451
8452 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
8453 CHECK(!owner->result_ok);
8454         return DecodeError_clone(&*owner->contents.err);
8455 }
8456 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_err"))) TS_CResult_TxCompleteDecodeErrorZ_get_err(uint64_t owner) {
8457         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
8458         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8459         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
8460         uint64_t ret_ref = tag_ptr(ret_copy, true);
8461         return ret_ref;
8462 }
8463
8464 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
8465         LDKTxSignatures ret = *owner->contents.result;
8466         ret.is_owned = false;
8467         return ret;
8468 }
8469 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
8470         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
8471         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
8472         uint64_t ret_ref = 0;
8473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8475         return ret_ref;
8476 }
8477
8478 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
8479 CHECK(!owner->result_ok);
8480         return DecodeError_clone(&*owner->contents.err);
8481 }
8482 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_err"))) TS_CResult_TxSignaturesDecodeErrorZ_get_err(uint64_t owner) {
8483         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
8484         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8485         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
8486         uint64_t ret_ref = tag_ptr(ret_copy, true);
8487         return ret_ref;
8488 }
8489
8490 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
8491         LDKTxInitRbf ret = *owner->contents.result;
8492         ret.is_owned = false;
8493         return ret;
8494 }
8495 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_get_ok(uint64_t owner) {
8496         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
8497         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
8498         uint64_t ret_ref = 0;
8499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8501         return ret_ref;
8502 }
8503
8504 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
8505 CHECK(!owner->result_ok);
8506         return DecodeError_clone(&*owner->contents.err);
8507 }
8508 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_err"))) TS_CResult_TxInitRbfDecodeErrorZ_get_err(uint64_t owner) {
8509         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
8510         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8511         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
8512         uint64_t ret_ref = tag_ptr(ret_copy, true);
8513         return ret_ref;
8514 }
8515
8516 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
8517         LDKTxAckRbf ret = *owner->contents.result;
8518         ret.is_owned = false;
8519         return ret;
8520 }
8521 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_get_ok(uint64_t owner) {
8522         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
8523         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
8524         uint64_t ret_ref = 0;
8525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8527         return ret_ref;
8528 }
8529
8530 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
8531 CHECK(!owner->result_ok);
8532         return DecodeError_clone(&*owner->contents.err);
8533 }
8534 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_err"))) TS_CResult_TxAckRbfDecodeErrorZ_get_err(uint64_t owner) {
8535         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
8536         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8537         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
8538         uint64_t ret_ref = tag_ptr(ret_copy, true);
8539         return ret_ref;
8540 }
8541
8542 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
8543         LDKTxAbort ret = *owner->contents.result;
8544         ret.is_owned = false;
8545         return ret;
8546 }
8547 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_ok"))) TS_CResult_TxAbortDecodeErrorZ_get_ok(uint64_t owner) {
8548         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
8549         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
8550         uint64_t ret_ref = 0;
8551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8553         return ret_ref;
8554 }
8555
8556 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
8557 CHECK(!owner->result_ok);
8558         return DecodeError_clone(&*owner->contents.err);
8559 }
8560 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_err"))) TS_CResult_TxAbortDecodeErrorZ_get_err(uint64_t owner) {
8561         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
8562         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8563         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
8564         uint64_t ret_ref = tag_ptr(ret_copy, true);
8565         return ret_ref;
8566 }
8567
8568 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8569         LDKAnnouncementSignatures ret = *owner->contents.result;
8570         ret.is_owned = false;
8571         return ret;
8572 }
8573 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
8574         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
8575         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
8576         uint64_t ret_ref = 0;
8577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8579         return ret_ref;
8580 }
8581
8582 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8583 CHECK(!owner->result_ok);
8584         return DecodeError_clone(&*owner->contents.err);
8585 }
8586 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
8587         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
8588         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8589         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
8590         uint64_t ret_ref = tag_ptr(ret_copy, true);
8591         return ret_ref;
8592 }
8593
8594 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8595         LDKChannelReestablish ret = *owner->contents.result;
8596         ret.is_owned = false;
8597         return ret;
8598 }
8599 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
8600         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
8601         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
8602         uint64_t ret_ref = 0;
8603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8605         return ret_ref;
8606 }
8607
8608 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8609 CHECK(!owner->result_ok);
8610         return DecodeError_clone(&*owner->contents.err);
8611 }
8612 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
8613         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
8614         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8615         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
8616         uint64_t ret_ref = tag_ptr(ret_copy, true);
8617         return ret_ref;
8618 }
8619
8620 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8621         LDKClosingSigned ret = *owner->contents.result;
8622         ret.is_owned = false;
8623         return ret;
8624 }
8625 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
8626         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
8627         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
8628         uint64_t ret_ref = 0;
8629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8631         return ret_ref;
8632 }
8633
8634 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8635 CHECK(!owner->result_ok);
8636         return DecodeError_clone(&*owner->contents.err);
8637 }
8638 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
8639         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
8640         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8641         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
8642         uint64_t ret_ref = tag_ptr(ret_copy, true);
8643         return ret_ref;
8644 }
8645
8646 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8647         LDKClosingSignedFeeRange ret = *owner->contents.result;
8648         ret.is_owned = false;
8649         return ret;
8650 }
8651 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
8652         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
8653         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
8654         uint64_t ret_ref = 0;
8655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8657         return ret_ref;
8658 }
8659
8660 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8661 CHECK(!owner->result_ok);
8662         return DecodeError_clone(&*owner->contents.err);
8663 }
8664 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
8665         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
8666         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8667         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
8668         uint64_t ret_ref = tag_ptr(ret_copy, true);
8669         return ret_ref;
8670 }
8671
8672 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8673         LDKCommitmentSigned ret = *owner->contents.result;
8674         ret.is_owned = false;
8675         return ret;
8676 }
8677 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
8678         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
8679         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
8680         uint64_t ret_ref = 0;
8681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8683         return ret_ref;
8684 }
8685
8686 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8687 CHECK(!owner->result_ok);
8688         return DecodeError_clone(&*owner->contents.err);
8689 }
8690 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
8691         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
8692         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8693         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
8694         uint64_t ret_ref = tag_ptr(ret_copy, true);
8695         return ret_ref;
8696 }
8697
8698 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8699         LDKFundingCreated ret = *owner->contents.result;
8700         ret.is_owned = false;
8701         return ret;
8702 }
8703 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
8704         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
8705         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
8706         uint64_t ret_ref = 0;
8707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8709         return ret_ref;
8710 }
8711
8712 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8713 CHECK(!owner->result_ok);
8714         return DecodeError_clone(&*owner->contents.err);
8715 }
8716 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
8717         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
8718         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8719         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
8720         uint64_t ret_ref = tag_ptr(ret_copy, true);
8721         return ret_ref;
8722 }
8723
8724 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8725         LDKFundingSigned ret = *owner->contents.result;
8726         ret.is_owned = false;
8727         return ret;
8728 }
8729 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
8730         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
8731         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
8732         uint64_t ret_ref = 0;
8733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8735         return ret_ref;
8736 }
8737
8738 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8739 CHECK(!owner->result_ok);
8740         return DecodeError_clone(&*owner->contents.err);
8741 }
8742 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
8743         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
8744         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8745         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
8746         uint64_t ret_ref = tag_ptr(ret_copy, true);
8747         return ret_ref;
8748 }
8749
8750 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
8751         LDKChannelReady ret = *owner->contents.result;
8752         ret.is_owned = false;
8753         return ret;
8754 }
8755 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
8756         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
8757         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
8758         uint64_t ret_ref = 0;
8759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8761         return ret_ref;
8762 }
8763
8764 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
8765 CHECK(!owner->result_ok);
8766         return DecodeError_clone(&*owner->contents.err);
8767 }
8768 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
8769         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
8770         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8771         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
8772         uint64_t ret_ref = tag_ptr(ret_copy, true);
8773         return ret_ref;
8774 }
8775
8776 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8777         LDKInit ret = *owner->contents.result;
8778         ret.is_owned = false;
8779         return ret;
8780 }
8781 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
8782         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
8783         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
8784         uint64_t ret_ref = 0;
8785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8787         return ret_ref;
8788 }
8789
8790 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8791 CHECK(!owner->result_ok);
8792         return DecodeError_clone(&*owner->contents.err);
8793 }
8794 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
8795         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
8796         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8797         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
8798         uint64_t ret_ref = tag_ptr(ret_copy, true);
8799         return ret_ref;
8800 }
8801
8802 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8803         LDKOpenChannel ret = *owner->contents.result;
8804         ret.is_owned = false;
8805         return ret;
8806 }
8807 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
8808         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
8809         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
8810         uint64_t ret_ref = 0;
8811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8813         return ret_ref;
8814 }
8815
8816 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8817 CHECK(!owner->result_ok);
8818         return DecodeError_clone(&*owner->contents.err);
8819 }
8820 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
8821         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
8822         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8823         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
8824         uint64_t ret_ref = tag_ptr(ret_copy, true);
8825         return ret_ref;
8826 }
8827
8828 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
8829         LDKOpenChannelV2 ret = *owner->contents.result;
8830         ret.is_owned = false;
8831         return ret;
8832 }
8833 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
8834         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
8835         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
8836         uint64_t ret_ref = 0;
8837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8839         return ret_ref;
8840 }
8841
8842 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
8843 CHECK(!owner->result_ok);
8844         return DecodeError_clone(&*owner->contents.err);
8845 }
8846 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_err(uint64_t owner) {
8847         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
8848         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8849         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
8850         uint64_t ret_ref = tag_ptr(ret_copy, true);
8851         return ret_ref;
8852 }
8853
8854 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8855         LDKRevokeAndACK ret = *owner->contents.result;
8856         ret.is_owned = false;
8857         return ret;
8858 }
8859 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
8860         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
8861         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
8862         uint64_t ret_ref = 0;
8863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8865         return ret_ref;
8866 }
8867
8868 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8869 CHECK(!owner->result_ok);
8870         return DecodeError_clone(&*owner->contents.err);
8871 }
8872 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
8873         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
8874         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8875         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
8876         uint64_t ret_ref = tag_ptr(ret_copy, true);
8877         return ret_ref;
8878 }
8879
8880 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8881         LDKShutdown ret = *owner->contents.result;
8882         ret.is_owned = false;
8883         return ret;
8884 }
8885 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
8886         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
8887         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
8888         uint64_t ret_ref = 0;
8889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8891         return ret_ref;
8892 }
8893
8894 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8895 CHECK(!owner->result_ok);
8896         return DecodeError_clone(&*owner->contents.err);
8897 }
8898 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
8899         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
8900         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8901         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
8902         uint64_t ret_ref = tag_ptr(ret_copy, true);
8903         return ret_ref;
8904 }
8905
8906 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8907         LDKUpdateFailHTLC ret = *owner->contents.result;
8908         ret.is_owned = false;
8909         return ret;
8910 }
8911 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8912         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8913         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
8914         uint64_t ret_ref = 0;
8915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8917         return ret_ref;
8918 }
8919
8920 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8921 CHECK(!owner->result_ok);
8922         return DecodeError_clone(&*owner->contents.err);
8923 }
8924 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
8925         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8926         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8927         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
8928         uint64_t ret_ref = tag_ptr(ret_copy, true);
8929         return ret_ref;
8930 }
8931
8932 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8933         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
8934         ret.is_owned = false;
8935         return ret;
8936 }
8937 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8938         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8939         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
8940         uint64_t ret_ref = 0;
8941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8943         return ret_ref;
8944 }
8945
8946 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8947 CHECK(!owner->result_ok);
8948         return DecodeError_clone(&*owner->contents.err);
8949 }
8950 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
8951         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8952         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8953         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
8954         uint64_t ret_ref = tag_ptr(ret_copy, true);
8955         return ret_ref;
8956 }
8957
8958 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8959         LDKUpdateFee ret = *owner->contents.result;
8960         ret.is_owned = false;
8961         return ret;
8962 }
8963 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
8964         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8965         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
8966         uint64_t ret_ref = 0;
8967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8969         return ret_ref;
8970 }
8971
8972 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8973 CHECK(!owner->result_ok);
8974         return DecodeError_clone(&*owner->contents.err);
8975 }
8976 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
8977         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8978         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8979         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
8980         uint64_t ret_ref = tag_ptr(ret_copy, true);
8981         return ret_ref;
8982 }
8983
8984 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8985         LDKUpdateFulfillHTLC ret = *owner->contents.result;
8986         ret.is_owned = false;
8987         return ret;
8988 }
8989 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8990         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8991         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
8992         uint64_t ret_ref = 0;
8993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8995         return ret_ref;
8996 }
8997
8998 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8999 CHECK(!owner->result_ok);
9000         return DecodeError_clone(&*owner->contents.err);
9001 }
9002 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
9003         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
9004         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9005         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
9006         uint64_t ret_ref = tag_ptr(ret_copy, true);
9007         return ret_ref;
9008 }
9009
9010 static inline struct LDKOnionPacket CResult_OnionPacketDecodeErrorZ_get_ok(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
9011         LDKOnionPacket ret = *owner->contents.result;
9012         ret.is_owned = false;
9013         return ret;
9014 }
9015 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_get_ok"))) TS_CResult_OnionPacketDecodeErrorZ_get_ok(uint64_t owner) {
9016         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
9017         LDKOnionPacket ret_var = CResult_OnionPacketDecodeErrorZ_get_ok(owner_conv);
9018         uint64_t ret_ref = 0;
9019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9021         return ret_ref;
9022 }
9023
9024 static inline struct LDKDecodeError CResult_OnionPacketDecodeErrorZ_get_err(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
9025 CHECK(!owner->result_ok);
9026         return DecodeError_clone(&*owner->contents.err);
9027 }
9028 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_get_err"))) TS_CResult_OnionPacketDecodeErrorZ_get_err(uint64_t owner) {
9029         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
9030         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9031         *ret_copy = CResult_OnionPacketDecodeErrorZ_get_err(owner_conv);
9032         uint64_t ret_ref = tag_ptr(ret_copy, true);
9033         return ret_ref;
9034 }
9035
9036 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9037         LDKUpdateAddHTLC ret = *owner->contents.result;
9038         ret.is_owned = false;
9039         return ret;
9040 }
9041 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9042         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9043         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
9044         uint64_t ret_ref = 0;
9045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9047         return ret_ref;
9048 }
9049
9050 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9051 CHECK(!owner->result_ok);
9052         return DecodeError_clone(&*owner->contents.err);
9053 }
9054 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
9055         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9056         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9057         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
9058         uint64_t ret_ref = tag_ptr(ret_copy, true);
9059         return ret_ref;
9060 }
9061
9062 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9063         LDKOnionMessage ret = *owner->contents.result;
9064         ret.is_owned = false;
9065         return ret;
9066 }
9067 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
9068         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9069         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
9070         uint64_t ret_ref = 0;
9071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9073         return ret_ref;
9074 }
9075
9076 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9077 CHECK(!owner->result_ok);
9078         return DecodeError_clone(&*owner->contents.err);
9079 }
9080 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
9081         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9082         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9083         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
9084         uint64_t ret_ref = tag_ptr(ret_copy, true);
9085         return ret_ref;
9086 }
9087
9088 static inline struct LDKFinalOnionHopData CResult_FinalOnionHopDataDecodeErrorZ_get_ok(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
9089         LDKFinalOnionHopData ret = *owner->contents.result;
9090         ret.is_owned = false;
9091         return ret;
9092 }
9093 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_get_ok"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_get_ok(uint64_t owner) {
9094         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
9095         LDKFinalOnionHopData ret_var = CResult_FinalOnionHopDataDecodeErrorZ_get_ok(owner_conv);
9096         uint64_t ret_ref = 0;
9097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9099         return ret_ref;
9100 }
9101
9102 static inline struct LDKDecodeError CResult_FinalOnionHopDataDecodeErrorZ_get_err(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
9103 CHECK(!owner->result_ok);
9104         return DecodeError_clone(&*owner->contents.err);
9105 }
9106 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_get_err"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_get_err(uint64_t owner) {
9107         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
9108         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9109         *ret_copy = CResult_FinalOnionHopDataDecodeErrorZ_get_err(owner_conv);
9110         uint64_t ret_ref = tag_ptr(ret_copy, true);
9111         return ret_ref;
9112 }
9113
9114 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9115         LDKPing ret = *owner->contents.result;
9116         ret.is_owned = false;
9117         return ret;
9118 }
9119 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
9120         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9121         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
9122         uint64_t ret_ref = 0;
9123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9125         return ret_ref;
9126 }
9127
9128 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9129 CHECK(!owner->result_ok);
9130         return DecodeError_clone(&*owner->contents.err);
9131 }
9132 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
9133         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9134         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9135         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
9136         uint64_t ret_ref = tag_ptr(ret_copy, true);
9137         return ret_ref;
9138 }
9139
9140 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9141         LDKPong ret = *owner->contents.result;
9142         ret.is_owned = false;
9143         return ret;
9144 }
9145 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
9146         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9147         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
9148         uint64_t ret_ref = 0;
9149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9151         return ret_ref;
9152 }
9153
9154 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9155 CHECK(!owner->result_ok);
9156         return DecodeError_clone(&*owner->contents.err);
9157 }
9158 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
9159         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9160         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9161         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
9162         uint64_t ret_ref = tag_ptr(ret_copy, true);
9163         return ret_ref;
9164 }
9165
9166 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9167         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
9168         ret.is_owned = false;
9169         return ret;
9170 }
9171 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9172         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9173         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9174         uint64_t ret_ref = 0;
9175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9177         return ret_ref;
9178 }
9179
9180 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9181 CHECK(!owner->result_ok);
9182         return DecodeError_clone(&*owner->contents.err);
9183 }
9184 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9185         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9186         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9187         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9188         uint64_t ret_ref = tag_ptr(ret_copy, true);
9189         return ret_ref;
9190 }
9191
9192 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9193         LDKChannelAnnouncement ret = *owner->contents.result;
9194         ret.is_owned = false;
9195         return ret;
9196 }
9197 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9198         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9199         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9200         uint64_t ret_ref = 0;
9201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9203         return ret_ref;
9204 }
9205
9206 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9207 CHECK(!owner->result_ok);
9208         return DecodeError_clone(&*owner->contents.err);
9209 }
9210 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9211         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9212         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9213         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9214         uint64_t ret_ref = tag_ptr(ret_copy, true);
9215         return ret_ref;
9216 }
9217
9218 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9219         LDKUnsignedChannelUpdate ret = *owner->contents.result;
9220         ret.is_owned = false;
9221         return ret;
9222 }
9223 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
9224         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9225         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9226         uint64_t ret_ref = 0;
9227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9229         return ret_ref;
9230 }
9231
9232 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9233 CHECK(!owner->result_ok);
9234         return DecodeError_clone(&*owner->contents.err);
9235 }
9236 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
9237         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9238         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9239         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
9240         uint64_t ret_ref = tag_ptr(ret_copy, true);
9241         return ret_ref;
9242 }
9243
9244 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9245         LDKChannelUpdate ret = *owner->contents.result;
9246         ret.is_owned = false;
9247         return ret;
9248 }
9249 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
9250         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9251         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9252         uint64_t ret_ref = 0;
9253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9255         return ret_ref;
9256 }
9257
9258 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9259 CHECK(!owner->result_ok);
9260         return DecodeError_clone(&*owner->contents.err);
9261 }
9262 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
9263         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9264         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9265         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
9266         uint64_t ret_ref = tag_ptr(ret_copy, true);
9267         return ret_ref;
9268 }
9269
9270 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9271         LDKErrorMessage ret = *owner->contents.result;
9272         ret.is_owned = false;
9273         return ret;
9274 }
9275 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
9276         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9277         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
9278         uint64_t ret_ref = 0;
9279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9281         return ret_ref;
9282 }
9283
9284 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9285 CHECK(!owner->result_ok);
9286         return DecodeError_clone(&*owner->contents.err);
9287 }
9288 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
9289         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9290         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9291         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
9292         uint64_t ret_ref = tag_ptr(ret_copy, true);
9293         return ret_ref;
9294 }
9295
9296 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9297         LDKWarningMessage ret = *owner->contents.result;
9298         ret.is_owned = false;
9299         return ret;
9300 }
9301 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
9302         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9303         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
9304         uint64_t ret_ref = 0;
9305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9307         return ret_ref;
9308 }
9309
9310 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9311 CHECK(!owner->result_ok);
9312         return DecodeError_clone(&*owner->contents.err);
9313 }
9314 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
9315         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9316         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9317         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
9318         uint64_t ret_ref = tag_ptr(ret_copy, true);
9319         return ret_ref;
9320 }
9321
9322 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9323         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
9324         ret.is_owned = false;
9325         return ret;
9326 }
9327 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9328         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9329         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9330         uint64_t ret_ref = 0;
9331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9333         return ret_ref;
9334 }
9335
9336 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9337 CHECK(!owner->result_ok);
9338         return DecodeError_clone(&*owner->contents.err);
9339 }
9340 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9341         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9342         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9343         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9344         uint64_t ret_ref = tag_ptr(ret_copy, true);
9345         return ret_ref;
9346 }
9347
9348 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9349         LDKNodeAnnouncement ret = *owner->contents.result;
9350         ret.is_owned = false;
9351         return ret;
9352 }
9353 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9354         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9355         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9356         uint64_t ret_ref = 0;
9357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9359         return ret_ref;
9360 }
9361
9362 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9363 CHECK(!owner->result_ok);
9364         return DecodeError_clone(&*owner->contents.err);
9365 }
9366 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9367         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9368         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9369         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9370         uint64_t ret_ref = tag_ptr(ret_copy, true);
9371         return ret_ref;
9372 }
9373
9374 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9375         LDKQueryShortChannelIds ret = *owner->contents.result;
9376         ret.is_owned = false;
9377         return ret;
9378 }
9379 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
9380         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
9381         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
9382         uint64_t ret_ref = 0;
9383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9385         return ret_ref;
9386 }
9387
9388 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9389 CHECK(!owner->result_ok);
9390         return DecodeError_clone(&*owner->contents.err);
9391 }
9392 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
9393         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
9394         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9395         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
9396         uint64_t ret_ref = tag_ptr(ret_copy, true);
9397         return ret_ref;
9398 }
9399
9400 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9401         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
9402         ret.is_owned = false;
9403         return ret;
9404 }
9405 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
9406         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
9407         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
9408         uint64_t ret_ref = 0;
9409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9411         return ret_ref;
9412 }
9413
9414 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9415 CHECK(!owner->result_ok);
9416         return DecodeError_clone(&*owner->contents.err);
9417 }
9418 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
9419         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
9420         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9421         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
9422         uint64_t ret_ref = tag_ptr(ret_copy, true);
9423         return ret_ref;
9424 }
9425
9426 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9427         LDKQueryChannelRange ret = *owner->contents.result;
9428         ret.is_owned = false;
9429         return ret;
9430 }
9431 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
9432         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
9433         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
9434         uint64_t ret_ref = 0;
9435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9437         return ret_ref;
9438 }
9439
9440 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9441 CHECK(!owner->result_ok);
9442         return DecodeError_clone(&*owner->contents.err);
9443 }
9444 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
9445         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
9446         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9447         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
9448         uint64_t ret_ref = tag_ptr(ret_copy, true);
9449         return ret_ref;
9450 }
9451
9452 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9453         LDKReplyChannelRange ret = *owner->contents.result;
9454         ret.is_owned = false;
9455         return ret;
9456 }
9457 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
9458         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
9459         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
9460         uint64_t ret_ref = 0;
9461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9463         return ret_ref;
9464 }
9465
9466 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9467 CHECK(!owner->result_ok);
9468         return DecodeError_clone(&*owner->contents.err);
9469 }
9470 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
9471         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
9472         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9473         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
9474         uint64_t ret_ref = tag_ptr(ret_copy, true);
9475         return ret_ref;
9476 }
9477
9478 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9479         LDKGossipTimestampFilter ret = *owner->contents.result;
9480         ret.is_owned = false;
9481         return ret;
9482 }
9483 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
9484         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
9485         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
9486         uint64_t ret_ref = 0;
9487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9489         return ret_ref;
9490 }
9491
9492 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9493 CHECK(!owner->result_ok);
9494         return DecodeError_clone(&*owner->contents.err);
9495 }
9496 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
9497         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
9498         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9499         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
9500         uint64_t ret_ref = tag_ptr(ret_copy, true);
9501         return ret_ref;
9502 }
9503
9504 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
9505         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
9506         for (size_t i = 0; i < ret.datalen; i++) {
9507                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
9508         }
9509         return ret;
9510 }
9511 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
9512         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
9513         switch(obj->tag) {
9514                 case LDKSignOrCreationError_SignError: return 0;
9515                 case LDKSignOrCreationError_CreationError: return 1;
9516                 default: abort();
9517         }
9518 }
9519 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
9520         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
9521         assert(obj->tag == LDKSignOrCreationError_CreationError);
9522         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
9523         return creation_error_conv;
9524 }
9525 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9526         LDKBolt11Invoice ret = *owner->contents.result;
9527         ret.is_owned = false;
9528         return ret;
9529 }
9530 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
9531         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
9532         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
9533         uint64_t ret_ref = 0;
9534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9536         return ret_ref;
9537 }
9538
9539 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9540 CHECK(!owner->result_ok);
9541         return SignOrCreationError_clone(&*owner->contents.err);
9542 }
9543 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
9544         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
9545         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
9546         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
9547         uint64_t ret_ref = tag_ptr(ret_copy, true);
9548         return ret_ref;
9549 }
9550
9551 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
9552 CHECK(owner->result_ok);
9553         return OffersMessage_clone(&*owner->contents.result);
9554 }
9555 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_ok"))) TS_CResult_OffersMessageDecodeErrorZ_get_ok(uint64_t owner) {
9556         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
9557         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
9558         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
9559         uint64_t ret_ref = tag_ptr(ret_copy, true);
9560         return ret_ref;
9561 }
9562
9563 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
9564 CHECK(!owner->result_ok);
9565         return DecodeError_clone(&*owner->contents.err);
9566 }
9567 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_err"))) TS_CResult_OffersMessageDecodeErrorZ_get_err(uint64_t owner) {
9568         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
9569         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9570         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
9571         uint64_t ret_ref = tag_ptr(ret_copy, true);
9572         return ret_ref;
9573 }
9574
9575 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_ty_from_ptr"))) TS_LDKCOption_HTLCClaimZ_ty_from_ptr(uint64_t ptr) {
9576         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
9577         switch(obj->tag) {
9578                 case LDKCOption_HTLCClaimZ_Some: return 0;
9579                 case LDKCOption_HTLCClaimZ_None: return 1;
9580                 default: abort();
9581         }
9582 }
9583 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_Some_get_some"))) TS_LDKCOption_HTLCClaimZ_Some_get_some(uint64_t ptr) {
9584         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
9585         assert(obj->tag == LDKCOption_HTLCClaimZ_Some);
9586         uint32_t some_conv = LDKHTLCClaim_to_js(obj->some);
9587         return some_conv;
9588 }
9589 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
9590         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
9591         ret.is_owned = false;
9592         return ret;
9593 }
9594 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
9595         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
9596         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_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_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
9604 CHECK(!owner->result_ok);
9605         return DecodeError_clone(&*owner->contents.err);
9606 }
9607 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
9608         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
9609         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9610         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
9611         uint64_t ret_ref = tag_ptr(ret_copy, true);
9612         return ret_ref;
9613 }
9614
9615 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
9616         LDKTxCreationKeys ret = *owner->contents.result;
9617         ret.is_owned = false;
9618         return ret;
9619 }
9620 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
9621         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
9622         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_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_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
9630 CHECK(!owner->result_ok);
9631         return DecodeError_clone(&*owner->contents.err);
9632 }
9633 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
9634         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
9635         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9636         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
9637         uint64_t ret_ref = tag_ptr(ret_copy, true);
9638         return ret_ref;
9639 }
9640
9641 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
9642         LDKChannelPublicKeys ret = *owner->contents.result;
9643         ret.is_owned = false;
9644         return ret;
9645 }
9646 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
9647         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
9648         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_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_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
9656 CHECK(!owner->result_ok);
9657         return DecodeError_clone(&*owner->contents.err);
9658 }
9659 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
9660         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
9661         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9662         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
9663         uint64_t ret_ref = tag_ptr(ret_copy, true);
9664         return ret_ref;
9665 }
9666
9667 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
9668         LDKHTLCOutputInCommitment ret = *owner->contents.result;
9669         ret.is_owned = false;
9670         return ret;
9671 }
9672 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
9673         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
9674         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_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_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
9682 CHECK(!owner->result_ok);
9683         return DecodeError_clone(&*owner->contents.err);
9684 }
9685 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
9686         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
9687         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9688         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
9689         uint64_t ret_ref = tag_ptr(ret_copy, true);
9690         return ret_ref;
9691 }
9692
9693 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
9694         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
9695         ret.is_owned = false;
9696         return ret;
9697 }
9698 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
9699         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
9700         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_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_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
9708 CHECK(!owner->result_ok);
9709         return DecodeError_clone(&*owner->contents.err);
9710 }
9711 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
9712         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
9713         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9714         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
9715         uint64_t ret_ref = tag_ptr(ret_copy, true);
9716         return ret_ref;
9717 }
9718
9719 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
9720         LDKChannelTransactionParameters ret = *owner->contents.result;
9721         ret.is_owned = false;
9722         return ret;
9723 }
9724 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
9725         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
9726         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_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_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
9734 CHECK(!owner->result_ok);
9735         return DecodeError_clone(&*owner->contents.err);
9736 }
9737 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
9738         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
9739         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9740         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
9741         uint64_t ret_ref = tag_ptr(ret_copy, true);
9742         return ret_ref;
9743 }
9744
9745 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
9746         LDKHolderCommitmentTransaction ret = *owner->contents.result;
9747         ret.is_owned = false;
9748         return ret;
9749 }
9750 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
9751         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
9752         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_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_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
9760 CHECK(!owner->result_ok);
9761         return DecodeError_clone(&*owner->contents.err);
9762 }
9763 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
9764         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
9765         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9766         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
9767         uint64_t ret_ref = tag_ptr(ret_copy, true);
9768         return ret_ref;
9769 }
9770
9771 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
9772         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
9773         ret.is_owned = false;
9774         return ret;
9775 }
9776 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
9777         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
9778         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_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_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
9786 CHECK(!owner->result_ok);
9787         return DecodeError_clone(&*owner->contents.err);
9788 }
9789 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
9790         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
9791         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9792         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
9793         uint64_t ret_ref = tag_ptr(ret_copy, true);
9794         return ret_ref;
9795 }
9796
9797 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
9798         LDKTrustedClosingTransaction ret = *owner->contents.result;
9799         ret.is_owned = false;
9800         return ret;
9801 }
9802 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
9803         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
9804         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_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 void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
9812 CHECK(!owner->result_ok);
9813         return *owner->contents.err;
9814 }
9815 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
9816         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
9817         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
9818 }
9819
9820 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
9821         LDKCommitmentTransaction ret = *owner->contents.result;
9822         ret.is_owned = false;
9823         return ret;
9824 }
9825 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
9826         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
9827         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
9828         uint64_t ret_ref = 0;
9829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9831         return ret_ref;
9832 }
9833
9834 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
9835 CHECK(!owner->result_ok);
9836         return DecodeError_clone(&*owner->contents.err);
9837 }
9838 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
9839         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
9840         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9841         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
9842         uint64_t ret_ref = tag_ptr(ret_copy, true);
9843         return ret_ref;
9844 }
9845
9846 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
9847         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
9848         ret.is_owned = false;
9849         return ret;
9850 }
9851 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
9852         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
9853         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
9854         uint64_t ret_ref = 0;
9855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9857         return ret_ref;
9858 }
9859
9860 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
9861 CHECK(!owner->result_ok);
9862         return *owner->contents.err;
9863 }
9864 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
9865         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
9866         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
9867 }
9868
9869 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
9870 CHECK(owner->result_ok);
9871         return *owner->contents.result;
9872 }
9873 ptrArray  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_get_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_get_ok(uint64_t owner) {
9874         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
9875         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
9876         ptrArray ret_arr = NULL;
9877         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
9878         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
9879         for (size_t m = 0; m < ret_var.datalen; m++) {
9880                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
9881                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
9882                 ret_arr_ptr[m] = ret_conv_12_arr;
9883         }
9884         
9885         return ret_arr;
9886 }
9887
9888 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
9889 CHECK(!owner->result_ok);
9890         return *owner->contents.err;
9891 }
9892 void  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_get_err"))) TS_CResult_CVec_ECDSASignatureZNoneZ_get_err(uint64_t owner) {
9893         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
9894         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
9895 }
9896
9897 uint32_t __attribute__((export_name("TS_LDKCOption_usizeZ_ty_from_ptr"))) TS_LDKCOption_usizeZ_ty_from_ptr(uint64_t ptr) {
9898         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
9899         switch(obj->tag) {
9900                 case LDKCOption_usizeZ_Some: return 0;
9901                 case LDKCOption_usizeZ_None: return 1;
9902                 default: abort();
9903         }
9904 }
9905 uint32_t __attribute__((export_name("TS_LDKCOption_usizeZ_Some_get_some"))) TS_LDKCOption_usizeZ_Some_get_some(uint64_t ptr) {
9906         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
9907         assert(obj->tag == LDKCOption_usizeZ_Some);
9908         uint32_t some_conv = obj->some;
9909         return some_conv;
9910 }
9911 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
9912         LDKShutdownScript ret = *owner->contents.result;
9913         ret.is_owned = false;
9914         return ret;
9915 }
9916 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
9917         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
9918         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
9919         uint64_t ret_ref = 0;
9920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9922         return ret_ref;
9923 }
9924
9925 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
9926 CHECK(!owner->result_ok);
9927         return DecodeError_clone(&*owner->contents.err);
9928 }
9929 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
9930         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
9931         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9932         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
9933         uint64_t ret_ref = tag_ptr(ret_copy, true);
9934         return ret_ref;
9935 }
9936
9937 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
9938         LDKShutdownScript ret = *owner->contents.result;
9939         ret.is_owned = false;
9940         return ret;
9941 }
9942 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
9943         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
9944         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
9945         uint64_t ret_ref = 0;
9946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9948         return ret_ref;
9949 }
9950
9951 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
9952         LDKInvalidShutdownScript ret = *owner->contents.err;
9953         ret.is_owned = false;
9954         return ret;
9955 }
9956 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
9957         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
9958         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
9959         uint64_t ret_ref = 0;
9960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9961         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9962         return ret_ref;
9963 }
9964
9965 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
9966         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9967         switch(obj->tag) {
9968                 case LDKPaymentPurpose_InvoicePayment: return 0;
9969                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
9970                 default: abort();
9971         }
9972 }
9973 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
9974         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9975         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
9976         uint64_t payment_preimage_ref = tag_ptr(&obj->invoice_payment.payment_preimage, false);
9977         return payment_preimage_ref;
9978 }
9979 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
9980         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9981         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
9982         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
9983         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
9984         return payment_secret_arr;
9985 }
9986 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
9987         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9988         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
9989         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
9990         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
9991         return spontaneous_payment_arr;
9992 }
9993 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
9994 CHECK(owner->result_ok);
9995         return PaymentPurpose_clone(&*owner->contents.result);
9996 }
9997 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
9998         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
9999         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
10000         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
10001         uint64_t ret_ref = tag_ptr(ret_copy, true);
10002         return ret_ref;
10003 }
10004
10005 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
10006 CHECK(!owner->result_ok);
10007         return DecodeError_clone(&*owner->contents.err);
10008 }
10009 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
10010         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
10011         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10012         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
10013         uint64_t ret_ref = tag_ptr(ret_copy, true);
10014         return ret_ref;
10015 }
10016
10017 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
10018         LDKClaimedHTLC ret = *owner->contents.result;
10019         ret.is_owned = false;
10020         return ret;
10021 }
10022 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_get_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
10023         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
10024         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
10025         uint64_t ret_ref = 0;
10026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10028         return ret_ref;
10029 }
10030
10031 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
10032 CHECK(!owner->result_ok);
10033         return DecodeError_clone(&*owner->contents.err);
10034 }
10035 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_get_err"))) TS_CResult_ClaimedHTLCDecodeErrorZ_get_err(uint64_t owner) {
10036         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
10037         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10038         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
10039         uint64_t ret_ref = tag_ptr(ret_copy, true);
10040         return ret_ref;
10041 }
10042
10043 uint32_t __attribute__((export_name("TS_LDKPathFailure_ty_from_ptr"))) TS_LDKPathFailure_ty_from_ptr(uint64_t ptr) {
10044         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10045         switch(obj->tag) {
10046                 case LDKPathFailure_InitialSend: return 0;
10047                 case LDKPathFailure_OnPath: return 1;
10048                 default: abort();
10049         }
10050 }
10051 uint64_t __attribute__((export_name("TS_LDKPathFailure_InitialSend_get_err"))) TS_LDKPathFailure_InitialSend_get_err(uint64_t ptr) {
10052         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10053         assert(obj->tag == LDKPathFailure_InitialSend);
10054         uint64_t err_ref = tag_ptr(&obj->initial_send.err, false);
10055         return err_ref;
10056 }
10057 uint64_t __attribute__((export_name("TS_LDKPathFailure_OnPath_get_network_update"))) TS_LDKPathFailure_OnPath_get_network_update(uint64_t ptr) {
10058         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10059         assert(obj->tag == LDKPathFailure_OnPath);
10060         uint64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
10061         return network_update_ref;
10062 }
10063 uint32_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_ty_from_ptr"))) TS_LDKCOption_PathFailureZ_ty_from_ptr(uint64_t ptr) {
10064         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
10065         switch(obj->tag) {
10066                 case LDKCOption_PathFailureZ_Some: return 0;
10067                 case LDKCOption_PathFailureZ_None: return 1;
10068                 default: abort();
10069         }
10070 }
10071 uint64_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_Some_get_some"))) TS_LDKCOption_PathFailureZ_Some_get_some(uint64_t ptr) {
10072         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
10073         assert(obj->tag == LDKCOption_PathFailureZ_Some);
10074         uint64_t some_ref = tag_ptr(&obj->some, false);
10075         return some_ref;
10076 }
10077 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
10078 CHECK(owner->result_ok);
10079         return COption_PathFailureZ_clone(&*owner->contents.result);
10080 }
10081 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok(uint64_t owner) {
10082         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
10083         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
10084         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
10085         uint64_t ret_ref = tag_ptr(ret_copy, true);
10086         return ret_ref;
10087 }
10088
10089 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
10090 CHECK(!owner->result_ok);
10091         return DecodeError_clone(&*owner->contents.err);
10092 }
10093 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_err(uint64_t owner) {
10094         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
10095         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10096         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
10097         uint64_t ret_ref = tag_ptr(ret_copy, true);
10098         return ret_ref;
10099 }
10100
10101 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
10102         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
10103         switch(obj->tag) {
10104                 case LDKClosureReason_CounterpartyForceClosed: return 0;
10105                 case LDKClosureReason_HolderForceClosed: return 1;
10106                 case LDKClosureReason_CooperativeClosure: return 2;
10107                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
10108                 case LDKClosureReason_FundingTimedOut: return 4;
10109                 case LDKClosureReason_ProcessingError: return 5;
10110                 case LDKClosureReason_DisconnectedPeer: return 6;
10111                 case LDKClosureReason_OutdatedChannelManager: return 7;
10112                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: return 8;
10113                 case LDKClosureReason_FundingBatchClosure: return 9;
10114                 default: abort();
10115         }
10116 }
10117 uint64_t __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
10118         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
10119         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
10120         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
10121                         uint64_t peer_msg_ref = 0;
10122                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
10123                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
10124         return peer_msg_ref;
10125 }
10126 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
10127         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
10128         assert(obj->tag == LDKClosureReason_ProcessingError);
10129         LDKStr err_str = obj->processing_error.err;
10130                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
10131         return err_conv;
10132 }
10133 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
10134         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
10135         switch(obj->tag) {
10136                 case LDKCOption_ClosureReasonZ_Some: return 0;
10137                 case LDKCOption_ClosureReasonZ_None: return 1;
10138                 default: abort();
10139         }
10140 }
10141 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
10142         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
10143         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
10144         uint64_t some_ref = tag_ptr(&obj->some, false);
10145         return some_ref;
10146 }
10147 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
10148 CHECK(owner->result_ok);
10149         return COption_ClosureReasonZ_clone(&*owner->contents.result);
10150 }
10151 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
10152         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
10153         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
10154         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
10155         uint64_t ret_ref = tag_ptr(ret_copy, true);
10156         return ret_ref;
10157 }
10158
10159 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
10160 CHECK(!owner->result_ok);
10161         return DecodeError_clone(&*owner->contents.err);
10162 }
10163 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
10164         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
10165         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10166         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
10167         uint64_t ret_ref = tag_ptr(ret_copy, true);
10168         return ret_ref;
10169 }
10170
10171 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
10172         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10173         switch(obj->tag) {
10174                 case LDKHTLCDestination_NextHopChannel: return 0;
10175                 case LDKHTLCDestination_UnknownNextHop: return 1;
10176                 case LDKHTLCDestination_InvalidForward: return 2;
10177                 case LDKHTLCDestination_FailedPayment: return 3;
10178                 default: abort();
10179         }
10180 }
10181 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
10182         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10183         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
10184         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
10185         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
10186         return node_id_arr;
10187 }
10188 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
10189         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10190         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
10191         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10192         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
10193         return channel_id_arr;
10194 }
10195 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
10196         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10197         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
10198         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
10199         return requested_forward_scid_conv;
10200 }
10201 int64_t __attribute__((export_name("TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid"))) TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(uint64_t ptr) {
10202         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10203         assert(obj->tag == LDKHTLCDestination_InvalidForward);
10204         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
10205         return requested_forward_scid_conv;
10206 }
10207 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
10208         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10209         assert(obj->tag == LDKHTLCDestination_FailedPayment);
10210         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10211         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
10212         return payment_hash_arr;
10213 }
10214 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
10215         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
10216         switch(obj->tag) {
10217                 case LDKCOption_HTLCDestinationZ_Some: return 0;
10218                 case LDKCOption_HTLCDestinationZ_None: return 1;
10219                 default: abort();
10220         }
10221 }
10222 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
10223         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
10224         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
10225         uint64_t some_ref = tag_ptr(&obj->some, false);
10226         return some_ref;
10227 }
10228 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
10229 CHECK(owner->result_ok);
10230         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
10231 }
10232 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
10233         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
10234         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
10235         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
10236         uint64_t ret_ref = tag_ptr(ret_copy, true);
10237         return ret_ref;
10238 }
10239
10240 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
10241 CHECK(!owner->result_ok);
10242         return DecodeError_clone(&*owner->contents.err);
10243 }
10244 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
10245         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
10246         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10247         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
10248         uint64_t ret_ref = tag_ptr(ret_copy, true);
10249         return ret_ref;
10250 }
10251
10252 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
10253 CHECK(owner->result_ok);
10254         return PaymentFailureReason_clone(&*owner->contents.result);
10255 }
10256 uint32_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok(uint64_t owner) {
10257         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
10258         uint32_t ret_conv = LDKPaymentFailureReason_to_js(CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
10259         return ret_conv;
10260 }
10261
10262 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
10263 CHECK(!owner->result_ok);
10264         return DecodeError_clone(&*owner->contents.err);
10265 }
10266 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err(uint64_t owner) {
10267         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
10268         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10269         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
10270         uint64_t ret_ref = tag_ptr(ret_copy, true);
10271         return ret_ref;
10272 }
10273
10274 uint32_t __attribute__((export_name("TS_LDKCOption_U128Z_ty_from_ptr"))) TS_LDKCOption_U128Z_ty_from_ptr(uint64_t ptr) {
10275         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
10276         switch(obj->tag) {
10277                 case LDKCOption_U128Z_Some: return 0;
10278                 case LDKCOption_U128Z_None: return 1;
10279                 default: abort();
10280         }
10281 }
10282 int8_tArray __attribute__((export_name("TS_LDKCOption_U128Z_Some_get_some"))) TS_LDKCOption_U128Z_Some_get_some(uint64_t ptr) {
10283         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
10284         assert(obj->tag == LDKCOption_U128Z_Some);
10285         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
10286         memcpy(some_arr->elems, obj->some.le_bytes, 16);
10287         return some_arr;
10288 }
10289 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
10290         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
10291         for (size_t i = 0; i < ret.datalen; i++) {
10292                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
10293         }
10294         return ret;
10295 }
10296 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr"))) TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr(uint64_t ptr) {
10297         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
10298         switch(obj->tag) {
10299                 case LDKCOption_PaymentFailureReasonZ_Some: return 0;
10300                 case LDKCOption_PaymentFailureReasonZ_None: return 1;
10301                 default: abort();
10302         }
10303 }
10304 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_Some_get_some"))) TS_LDKCOption_PaymentFailureReasonZ_Some_get_some(uint64_t ptr) {
10305         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
10306         assert(obj->tag == LDKCOption_PaymentFailureReasonZ_Some);
10307         uint32_t some_conv = LDKPaymentFailureReason_to_js(obj->some);
10308         return some_conv;
10309 }
10310 uint32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ty_from_ptr"))) TS_LDKBumpTransactionEvent_ty_from_ptr(uint64_t ptr) {
10311         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10312         switch(obj->tag) {
10313                 case LDKBumpTransactionEvent_ChannelClose: return 0;
10314                 case LDKBumpTransactionEvent_HTLCResolution: return 1;
10315                 default: abort();
10316         }
10317 }
10318 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id"))) TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id(uint64_t ptr) {
10319         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10320         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10321         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
10322         memcpy(claim_id_arr->elems, obj->channel_close.claim_id.data, 32);
10323         return claim_id_arr;
10324 }
10325 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) {
10326         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10327         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10328         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
10329         return package_target_feerate_sat_per_1000_weight_conv;
10330 }
10331 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx(uint64_t ptr) {
10332         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10333         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10334         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
10335                         int8_tArray commitment_tx_arr = init_int8_tArray(commitment_tx_var.datalen, __LINE__);
10336                         memcpy(commitment_tx_arr->elems, commitment_tx_var.data, commitment_tx_var.datalen);
10337         return commitment_tx_arr;
10338 }
10339 int64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis(uint64_t ptr) {
10340         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10341         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10342         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
10343         return commitment_tx_fee_satoshis_conv;
10344 }
10345 uint64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor"))) TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor(uint64_t ptr) {
10346         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10347         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10348         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
10349                         uint64_t anchor_descriptor_ref = 0;
10350                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
10351                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
10352         return anchor_descriptor_ref;
10353 }
10354 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs"))) TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs(uint64_t ptr) {
10355         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10356         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10357         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
10358                         uint64_tArray pending_htlcs_arr = NULL;
10359                         pending_htlcs_arr = init_uint64_tArray(pending_htlcs_var.datalen, __LINE__);
10360                         uint64_t *pending_htlcs_arr_ptr = (uint64_t*)(((uint8_t*)pending_htlcs_arr) + 8);
10361                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
10362                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
10363                                 uint64_t pending_htlcs_conv_24_ref = 0;
10364                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
10365                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
10366                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
10367                         }
10368                         
10369         return pending_htlcs_arr;
10370 }
10371 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id(uint64_t ptr) {
10372         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10373         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
10374         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
10375         memcpy(claim_id_arr->elems, obj->htlc_resolution.claim_id.data, 32);
10376         return claim_id_arr;
10377 }
10378 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) {
10379         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10380         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
10381         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
10382         return target_feerate_sat_per_1000_weight_conv;
10383 }
10384 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors(uint64_t ptr) {
10385         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10386         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
10387         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
10388                         uint64_tArray htlc_descriptors_arr = NULL;
10389                         htlc_descriptors_arr = init_uint64_tArray(htlc_descriptors_var.datalen, __LINE__);
10390                         uint64_t *htlc_descriptors_arr_ptr = (uint64_t*)(((uint8_t*)htlc_descriptors_arr) + 8);
10391                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
10392                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
10393                                 uint64_t htlc_descriptors_conv_16_ref = 0;
10394                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
10395                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
10396                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
10397                         }
10398                         
10399         return htlc_descriptors_arr;
10400 }
10401 int32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time(uint64_t ptr) {
10402         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10403         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
10404         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
10405         return tx_lock_time_conv;
10406 }
10407 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
10408         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10409         switch(obj->tag) {
10410                 case LDKEvent_FundingGenerationReady: return 0;
10411                 case LDKEvent_PaymentClaimable: return 1;
10412                 case LDKEvent_PaymentClaimed: return 2;
10413                 case LDKEvent_ConnectionNeeded: return 3;
10414                 case LDKEvent_InvoiceRequestFailed: return 4;
10415                 case LDKEvent_PaymentSent: return 5;
10416                 case LDKEvent_PaymentFailed: return 6;
10417                 case LDKEvent_PaymentPathSuccessful: return 7;
10418                 case LDKEvent_PaymentPathFailed: return 8;
10419                 case LDKEvent_ProbeSuccessful: return 9;
10420                 case LDKEvent_ProbeFailed: return 10;
10421                 case LDKEvent_PendingHTLCsForwardable: return 11;
10422                 case LDKEvent_HTLCIntercepted: return 12;
10423                 case LDKEvent_SpendableOutputs: return 13;
10424                 case LDKEvent_PaymentForwarded: return 14;
10425                 case LDKEvent_ChannelPending: return 15;
10426                 case LDKEvent_ChannelReady: return 16;
10427                 case LDKEvent_ChannelClosed: return 17;
10428                 case LDKEvent_DiscardFunding: return 18;
10429                 case LDKEvent_OpenChannelRequest: return 19;
10430                 case LDKEvent_HTLCHandlingFailed: return 20;
10431                 case LDKEvent_BumpTransaction: return 21;
10432                 default: abort();
10433         }
10434 }
10435 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
10436         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10437         assert(obj->tag == LDKEvent_FundingGenerationReady);
10438         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
10439         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
10440         return temporary_channel_id_arr;
10441 }
10442 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
10443         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10444         assert(obj->tag == LDKEvent_FundingGenerationReady);
10445         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
10446         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
10447         return counterparty_node_id_arr;
10448 }
10449 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
10450         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10451         assert(obj->tag == LDKEvent_FundingGenerationReady);
10452         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
10453         return channel_value_satoshis_conv;
10454 }
10455 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
10456         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10457         assert(obj->tag == LDKEvent_FundingGenerationReady);
10458         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
10459                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
10460                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
10461         return output_script_arr;
10462 }
10463 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
10464         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10465         assert(obj->tag == LDKEvent_FundingGenerationReady);
10466         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
10467         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
10468         return user_channel_id_arr;
10469 }
10470 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimable_get_receiver_node_id(uint64_t ptr) {
10471         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10472         assert(obj->tag == LDKEvent_PaymentClaimable);
10473         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
10474         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
10475         return receiver_node_id_arr;
10476 }
10477 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_payment_hash"))) TS_LDKEvent_PaymentClaimable_get_payment_hash(uint64_t ptr) {
10478         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10479         assert(obj->tag == LDKEvent_PaymentClaimable);
10480         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10481         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
10482         return payment_hash_arr;
10483 }
10484 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_onion_fields"))) TS_LDKEvent_PaymentClaimable_get_onion_fields(uint64_t ptr) {
10485         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10486         assert(obj->tag == LDKEvent_PaymentClaimable);
10487         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
10488                         uint64_t onion_fields_ref = 0;
10489                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
10490                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
10491         return onion_fields_ref;
10492 }
10493 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_amount_msat"))) TS_LDKEvent_PaymentClaimable_get_amount_msat(uint64_t ptr) {
10494         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10495         assert(obj->tag == LDKEvent_PaymentClaimable);
10496         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
10497         return amount_msat_conv;
10498 }
10499 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat"))) TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat(uint64_t ptr) {
10500         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10501         assert(obj->tag == LDKEvent_PaymentClaimable);
10502         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
10503         return counterparty_skimmed_fee_msat_conv;
10504 }
10505 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_purpose"))) TS_LDKEvent_PaymentClaimable_get_purpose(uint64_t ptr) {
10506         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10507         assert(obj->tag == LDKEvent_PaymentClaimable);
10508         uint64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
10509         return purpose_ref;
10510 }
10511 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_channel_id(uint64_t ptr) {
10512         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10513         assert(obj->tag == LDKEvent_PaymentClaimable);
10514         uint64_t via_channel_id_ref = tag_ptr(&obj->payment_claimable.via_channel_id, false);
10515         return via_channel_id_ref;
10516 }
10517 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_user_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_user_channel_id(uint64_t ptr) {
10518         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10519         assert(obj->tag == LDKEvent_PaymentClaimable);
10520         uint64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
10521         return via_user_channel_id_ref;
10522 }
10523 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_claim_deadline"))) TS_LDKEvent_PaymentClaimable_get_claim_deadline(uint64_t ptr) {
10524         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10525         assert(obj->tag == LDKEvent_PaymentClaimable);
10526         uint64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
10527         return claim_deadline_ref;
10528 }
10529 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimed_get_receiver_node_id(uint64_t ptr) {
10530         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10531         assert(obj->tag == LDKEvent_PaymentClaimed);
10532         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
10533         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
10534         return receiver_node_id_arr;
10535 }
10536 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
10537         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10538         assert(obj->tag == LDKEvent_PaymentClaimed);
10539         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10540         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
10541         return payment_hash_arr;
10542 }
10543 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
10544         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10545         assert(obj->tag == LDKEvent_PaymentClaimed);
10546         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
10547         return amount_msat_conv;
10548 }
10549 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
10550         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10551         assert(obj->tag == LDKEvent_PaymentClaimed);
10552         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
10553         return purpose_ref;
10554 }
10555 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_htlcs"))) TS_LDKEvent_PaymentClaimed_get_htlcs(uint64_t ptr) {
10556         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10557         assert(obj->tag == LDKEvent_PaymentClaimed);
10558         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
10559                         uint64_tArray htlcs_arr = NULL;
10560                         htlcs_arr = init_uint64_tArray(htlcs_var.datalen, __LINE__);
10561                         uint64_t *htlcs_arr_ptr = (uint64_t*)(((uint8_t*)htlcs_arr) + 8);
10562                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
10563                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
10564                                 uint64_t htlcs_conv_13_ref = 0;
10565                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
10566                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
10567                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
10568                         }
10569                         
10570         return htlcs_arr;
10571 }
10572 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_sender_intended_total_msat"))) TS_LDKEvent_PaymentClaimed_get_sender_intended_total_msat(uint64_t ptr) {
10573         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10574         assert(obj->tag == LDKEvent_PaymentClaimed);
10575         uint64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
10576         return sender_intended_total_msat_ref;
10577 }
10578 int8_tArray __attribute__((export_name("TS_LDKEvent_ConnectionNeeded_get_node_id"))) TS_LDKEvent_ConnectionNeeded_get_node_id(uint64_t ptr) {
10579         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10580         assert(obj->tag == LDKEvent_ConnectionNeeded);
10581         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
10582         memcpy(node_id_arr->elems, obj->connection_needed.node_id.compressed_form, 33);
10583         return node_id_arr;
10584 }
10585 uint64_tArray __attribute__((export_name("TS_LDKEvent_ConnectionNeeded_get_addresses"))) TS_LDKEvent_ConnectionNeeded_get_addresses(uint64_t ptr) {
10586         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10587         assert(obj->tag == LDKEvent_ConnectionNeeded);
10588         LDKCVec_SocketAddressZ addresses_var = obj->connection_needed.addresses;
10589                         uint64_tArray addresses_arr = NULL;
10590                         addresses_arr = init_uint64_tArray(addresses_var.datalen, __LINE__);
10591                         uint64_t *addresses_arr_ptr = (uint64_t*)(((uint8_t*)addresses_arr) + 8);
10592                         for (size_t p = 0; p < addresses_var.datalen; p++) {
10593                                 uint64_t addresses_conv_15_ref = tag_ptr(&addresses_var.data[p], false);
10594                                 addresses_arr_ptr[p] = addresses_conv_15_ref;
10595                         }
10596                         
10597         return addresses_arr;
10598 }
10599 int8_tArray __attribute__((export_name("TS_LDKEvent_InvoiceRequestFailed_get_payment_id"))) TS_LDKEvent_InvoiceRequestFailed_get_payment_id(uint64_t ptr) {
10600         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10601         assert(obj->tag == LDKEvent_InvoiceRequestFailed);
10602         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10603         memcpy(payment_id_arr->elems, obj->invoice_request_failed.payment_id.data, 32);
10604         return payment_id_arr;
10605 }
10606 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
10607         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10608         assert(obj->tag == LDKEvent_PaymentSent);
10609         uint64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
10610         return payment_id_ref;
10611 }
10612 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
10613         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10614         assert(obj->tag == LDKEvent_PaymentSent);
10615         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
10616         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
10617         return payment_preimage_arr;
10618 }
10619 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
10620         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10621         assert(obj->tag == LDKEvent_PaymentSent);
10622         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10623         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
10624         return payment_hash_arr;
10625 }
10626 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
10627         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10628         assert(obj->tag == LDKEvent_PaymentSent);
10629         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
10630         return fee_paid_msat_ref;
10631 }
10632 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
10633         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10634         assert(obj->tag == LDKEvent_PaymentFailed);
10635         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10636         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
10637         return payment_id_arr;
10638 }
10639 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
10640         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10641         assert(obj->tag == LDKEvent_PaymentFailed);
10642         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10643         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
10644         return payment_hash_arr;
10645 }
10646 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_reason"))) TS_LDKEvent_PaymentFailed_get_reason(uint64_t ptr) {
10647         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10648         assert(obj->tag == LDKEvent_PaymentFailed);
10649         uint64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
10650         return reason_ref;
10651 }
10652 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
10653         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10654         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
10655         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10656         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
10657         return payment_id_arr;
10658 }
10659 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
10660         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10661         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
10662         uint64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
10663         return payment_hash_ref;
10664 }
10665 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
10666         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10667         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
10668         LDKPath path_var = obj->payment_path_successful.path;
10669                         uint64_t path_ref = 0;
10670                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
10671                         path_ref = tag_ptr(path_var.inner, false);
10672         return path_ref;
10673 }
10674 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
10675         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10676         assert(obj->tag == LDKEvent_PaymentPathFailed);
10677         uint64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
10678         return payment_id_ref;
10679 }
10680 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
10681         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10682         assert(obj->tag == LDKEvent_PaymentPathFailed);
10683         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10684         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
10685         return payment_hash_arr;
10686 }
10687 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
10688         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10689         assert(obj->tag == LDKEvent_PaymentPathFailed);
10690         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
10691         return payment_failed_permanently_conv;
10692 }
10693 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_failure"))) TS_LDKEvent_PaymentPathFailed_get_failure(uint64_t ptr) {
10694         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10695         assert(obj->tag == LDKEvent_PaymentPathFailed);
10696         uint64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
10697         return failure_ref;
10698 }
10699 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
10700         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10701         assert(obj->tag == LDKEvent_PaymentPathFailed);
10702         LDKPath path_var = obj->payment_path_failed.path;
10703                         uint64_t path_ref = 0;
10704                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
10705                         path_ref = tag_ptr(path_var.inner, false);
10706         return path_ref;
10707 }
10708 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
10709         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10710         assert(obj->tag == LDKEvent_PaymentPathFailed);
10711         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
10712         return short_channel_id_ref;
10713 }
10714 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
10715         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10716         assert(obj->tag == LDKEvent_ProbeSuccessful);
10717         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10718         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
10719         return payment_id_arr;
10720 }
10721 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
10722         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10723         assert(obj->tag == LDKEvent_ProbeSuccessful);
10724         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10725         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
10726         return payment_hash_arr;
10727 }
10728 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
10729         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10730         assert(obj->tag == LDKEvent_ProbeSuccessful);
10731         LDKPath path_var = obj->probe_successful.path;
10732                         uint64_t path_ref = 0;
10733                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
10734                         path_ref = tag_ptr(path_var.inner, false);
10735         return path_ref;
10736 }
10737 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
10738         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10739         assert(obj->tag == LDKEvent_ProbeFailed);
10740         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10741         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
10742         return payment_id_arr;
10743 }
10744 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
10745         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10746         assert(obj->tag == LDKEvent_ProbeFailed);
10747         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10748         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
10749         return payment_hash_arr;
10750 }
10751 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
10752         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10753         assert(obj->tag == LDKEvent_ProbeFailed);
10754         LDKPath path_var = obj->probe_failed.path;
10755                         uint64_t path_ref = 0;
10756                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
10757                         path_ref = tag_ptr(path_var.inner, false);
10758         return path_ref;
10759 }
10760 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
10761         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10762         assert(obj->tag == LDKEvent_ProbeFailed);
10763         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
10764         return short_channel_id_ref;
10765 }
10766 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
10767         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10768         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
10769         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
10770         return time_forwardable_conv;
10771 }
10772 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_intercept_id"))) TS_LDKEvent_HTLCIntercepted_get_intercept_id(uint64_t ptr) {
10773         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10774         assert(obj->tag == LDKEvent_HTLCIntercepted);
10775         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
10776         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
10777         return intercept_id_arr;
10778 }
10779 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid"))) TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(uint64_t ptr) {
10780         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10781         assert(obj->tag == LDKEvent_HTLCIntercepted);
10782         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
10783         return requested_next_hop_scid_conv;
10784 }
10785 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_payment_hash"))) TS_LDKEvent_HTLCIntercepted_get_payment_hash(uint64_t ptr) {
10786         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10787         assert(obj->tag == LDKEvent_HTLCIntercepted);
10788         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10789         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
10790         return payment_hash_arr;
10791 }
10792 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(uint64_t ptr) {
10793         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10794         assert(obj->tag == LDKEvent_HTLCIntercepted);
10795         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
10796         return inbound_amount_msat_conv;
10797 }
10798 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(uint64_t ptr) {
10799         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10800         assert(obj->tag == LDKEvent_HTLCIntercepted);
10801         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
10802         return expected_outbound_amount_msat_conv;
10803 }
10804 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
10805         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10806         assert(obj->tag == LDKEvent_SpendableOutputs);
10807         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
10808                         uint64_tArray outputs_arr = NULL;
10809                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
10810                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
10811                         for (size_t b = 0; b < outputs_var.datalen; b++) {
10812                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
10813                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
10814                         }
10815                         
10816         return outputs_arr;
10817 }
10818 uint64_t __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_channel_id"))) TS_LDKEvent_SpendableOutputs_get_channel_id(uint64_t ptr) {
10819         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10820         assert(obj->tag == LDKEvent_SpendableOutputs);
10821         uint64_t channel_id_ref = tag_ptr(&obj->spendable_outputs.channel_id, false);
10822         return channel_id_ref;
10823 }
10824 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
10825         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10826         assert(obj->tag == LDKEvent_PaymentForwarded);
10827         uint64_t prev_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_channel_id, false);
10828         return prev_channel_id_ref;
10829 }
10830 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
10831         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10832         assert(obj->tag == LDKEvent_PaymentForwarded);
10833         uint64_t next_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_channel_id, false);
10834         return next_channel_id_ref;
10835 }
10836 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
10837         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10838         assert(obj->tag == LDKEvent_PaymentForwarded);
10839         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
10840         return fee_earned_msat_ref;
10841 }
10842 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
10843         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10844         assert(obj->tag == LDKEvent_PaymentForwarded);
10845         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
10846         return claim_from_onchain_tx_conv;
10847 }
10848 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat"))) TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(uint64_t ptr) {
10849         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10850         assert(obj->tag == LDKEvent_PaymentForwarded);
10851         uint64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
10852         return outbound_amount_forwarded_msat_ref;
10853 }
10854 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_channel_id"))) TS_LDKEvent_ChannelPending_get_channel_id(uint64_t ptr) {
10855         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10856         assert(obj->tag == LDKEvent_ChannelPending);
10857         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10858         memcpy(channel_id_arr->elems, obj->channel_pending.channel_id.data, 32);
10859         return channel_id_arr;
10860 }
10861 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_user_channel_id"))) TS_LDKEvent_ChannelPending_get_user_channel_id(uint64_t ptr) {
10862         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10863         assert(obj->tag == LDKEvent_ChannelPending);
10864         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
10865         memcpy(user_channel_id_arr->elems, obj->channel_pending.user_channel_id.le_bytes, 16);
10866         return user_channel_id_arr;
10867 }
10868 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_former_temporary_channel_id"))) TS_LDKEvent_ChannelPending_get_former_temporary_channel_id(uint64_t ptr) {
10869         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10870         assert(obj->tag == LDKEvent_ChannelPending);
10871         uint64_t former_temporary_channel_id_ref = tag_ptr(&obj->channel_pending.former_temporary_channel_id, false);
10872         return former_temporary_channel_id_ref;
10873 }
10874 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_counterparty_node_id"))) TS_LDKEvent_ChannelPending_get_counterparty_node_id(uint64_t ptr) {
10875         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10876         assert(obj->tag == LDKEvent_ChannelPending);
10877         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
10878         memcpy(counterparty_node_id_arr->elems, obj->channel_pending.counterparty_node_id.compressed_form, 33);
10879         return counterparty_node_id_arr;
10880 }
10881 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_funding_txo"))) TS_LDKEvent_ChannelPending_get_funding_txo(uint64_t ptr) {
10882         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10883         assert(obj->tag == LDKEvent_ChannelPending);
10884         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
10885                         uint64_t funding_txo_ref = 0;
10886                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
10887                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
10888         return funding_txo_ref;
10889 }
10890 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_id"))) TS_LDKEvent_ChannelReady_get_channel_id(uint64_t ptr) {
10891         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10892         assert(obj->tag == LDKEvent_ChannelReady);
10893         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10894         memcpy(channel_id_arr->elems, obj->channel_ready.channel_id.data, 32);
10895         return channel_id_arr;
10896 }
10897 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_user_channel_id"))) TS_LDKEvent_ChannelReady_get_user_channel_id(uint64_t ptr) {
10898         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10899         assert(obj->tag == LDKEvent_ChannelReady);
10900         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
10901         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
10902         return user_channel_id_arr;
10903 }
10904 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_counterparty_node_id"))) TS_LDKEvent_ChannelReady_get_counterparty_node_id(uint64_t ptr) {
10905         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10906         assert(obj->tag == LDKEvent_ChannelReady);
10907         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
10908         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
10909         return counterparty_node_id_arr;
10910 }
10911 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_type"))) TS_LDKEvent_ChannelReady_get_channel_type(uint64_t ptr) {
10912         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10913         assert(obj->tag == LDKEvent_ChannelReady);
10914         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
10915                         uint64_t channel_type_ref = 0;
10916                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
10917                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
10918         return channel_type_ref;
10919 }
10920 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
10921         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10922         assert(obj->tag == LDKEvent_ChannelClosed);
10923         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10924         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
10925         return channel_id_arr;
10926 }
10927 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
10928         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10929         assert(obj->tag == LDKEvent_ChannelClosed);
10930         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
10931         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
10932         return user_channel_id_arr;
10933 }
10934 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
10935         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10936         assert(obj->tag == LDKEvent_ChannelClosed);
10937         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
10938         return reason_ref;
10939 }
10940 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_counterparty_node_id"))) TS_LDKEvent_ChannelClosed_get_counterparty_node_id(uint64_t ptr) {
10941         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10942         assert(obj->tag == LDKEvent_ChannelClosed);
10943         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
10944         memcpy(counterparty_node_id_arr->elems, obj->channel_closed.counterparty_node_id.compressed_form, 33);
10945         return counterparty_node_id_arr;
10946 }
10947 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_capacity_sats"))) TS_LDKEvent_ChannelClosed_get_channel_capacity_sats(uint64_t ptr) {
10948         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10949         assert(obj->tag == LDKEvent_ChannelClosed);
10950         uint64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
10951         return channel_capacity_sats_ref;
10952 }
10953 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_funding_txo"))) TS_LDKEvent_ChannelClosed_get_channel_funding_txo(uint64_t ptr) {
10954         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10955         assert(obj->tag == LDKEvent_ChannelClosed);
10956         LDKOutPoint channel_funding_txo_var = obj->channel_closed.channel_funding_txo;
10957                         uint64_t channel_funding_txo_ref = 0;
10958                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_var);
10959                         channel_funding_txo_ref = tag_ptr(channel_funding_txo_var.inner, false);
10960         return channel_funding_txo_ref;
10961 }
10962 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
10963         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10964         assert(obj->tag == LDKEvent_DiscardFunding);
10965         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10966         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
10967         return channel_id_arr;
10968 }
10969 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
10970         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10971         assert(obj->tag == LDKEvent_DiscardFunding);
10972         LDKTransaction transaction_var = obj->discard_funding.transaction;
10973                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
10974                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
10975         return transaction_arr;
10976 }
10977 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
10978         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10979         assert(obj->tag == LDKEvent_OpenChannelRequest);
10980         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
10981         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
10982         return temporary_channel_id_arr;
10983 }
10984 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
10985         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10986         assert(obj->tag == LDKEvent_OpenChannelRequest);
10987         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
10988         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
10989         return counterparty_node_id_arr;
10990 }
10991 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
10992         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10993         assert(obj->tag == LDKEvent_OpenChannelRequest);
10994         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
10995         return funding_satoshis_conv;
10996 }
10997 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
10998         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10999         assert(obj->tag == LDKEvent_OpenChannelRequest);
11000         int64_t push_msat_conv = obj->open_channel_request.push_msat;
11001         return push_msat_conv;
11002 }
11003 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
11004         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11005         assert(obj->tag == LDKEvent_OpenChannelRequest);
11006         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
11007                         uint64_t channel_type_ref = 0;
11008                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
11009                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
11010         return channel_type_ref;
11011 }
11012 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
11013         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11014         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
11015         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
11016         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
11017         return prev_channel_id_arr;
11018 }
11019 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
11020         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11021         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
11022         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
11023         return failed_next_destination_ref;
11024 }
11025 uint64_t __attribute__((export_name("TS_LDKEvent_BumpTransaction_get_bump_transaction"))) TS_LDKEvent_BumpTransaction_get_bump_transaction(uint64_t ptr) {
11026         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11027         assert(obj->tag == LDKEvent_BumpTransaction);
11028         uint64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
11029         return bump_transaction_ref;
11030 }
11031 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
11032         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
11033         switch(obj->tag) {
11034                 case LDKCOption_EventZ_Some: return 0;
11035                 case LDKCOption_EventZ_None: return 1;
11036                 default: abort();
11037         }
11038 }
11039 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
11040         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
11041         assert(obj->tag == LDKCOption_EventZ_Some);
11042         uint64_t some_ref = tag_ptr(&obj->some, false);
11043         return some_ref;
11044 }
11045 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
11046 CHECK(owner->result_ok);
11047         return COption_EventZ_clone(&*owner->contents.result);
11048 }
11049 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
11050         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
11051         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
11052         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
11053         uint64_t ret_ref = tag_ptr(ret_copy, true);
11054         return ret_ref;
11055 }
11056
11057 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
11058 CHECK(!owner->result_ok);
11059         return DecodeError_clone(&*owner->contents.err);
11060 }
11061 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
11062         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
11063         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11064         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
11065         uint64_t ret_ref = tag_ptr(ret_copy, true);
11066         return ret_ref;
11067 }
11068
11069 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_ty_from_ptr"))) TS_LDKBolt11ParseError_ty_from_ptr(uint64_t ptr) {
11070         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11071         switch(obj->tag) {
11072                 case LDKBolt11ParseError_Bech32Error: return 0;
11073                 case LDKBolt11ParseError_ParseAmountError: return 1;
11074                 case LDKBolt11ParseError_MalformedSignature: return 2;
11075                 case LDKBolt11ParseError_BadPrefix: return 3;
11076                 case LDKBolt11ParseError_UnknownCurrency: return 4;
11077                 case LDKBolt11ParseError_UnknownSiPrefix: return 5;
11078                 case LDKBolt11ParseError_MalformedHRP: return 6;
11079                 case LDKBolt11ParseError_TooShortDataPart: return 7;
11080                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: return 8;
11081                 case LDKBolt11ParseError_DescriptionDecodeError: return 9;
11082                 case LDKBolt11ParseError_PaddingError: return 10;
11083                 case LDKBolt11ParseError_IntegerOverflowError: return 11;
11084                 case LDKBolt11ParseError_InvalidSegWitProgramLength: return 12;
11085                 case LDKBolt11ParseError_InvalidPubKeyHashLength: return 13;
11086                 case LDKBolt11ParseError_InvalidScriptHashLength: return 14;
11087                 case LDKBolt11ParseError_InvalidRecoveryId: return 15;
11088                 case LDKBolt11ParseError_InvalidSliceLength: return 16;
11089                 case LDKBolt11ParseError_Skip: return 17;
11090                 default: abort();
11091         }
11092 }
11093 uint64_t __attribute__((export_name("TS_LDKBolt11ParseError_Bech32Error_get_bech32_error"))) TS_LDKBolt11ParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
11094         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11095         assert(obj->tag == LDKBolt11ParseError_Bech32Error);
11096         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
11097         return bech32_error_ref;
11098 }
11099 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
11100         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11101         assert(obj->tag == LDKBolt11ParseError_ParseAmountError);
11102         /*obj->parse_amount_error*/
11103         return 0;
11104 }
11105 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature"))) TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
11106         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11107         assert(obj->tag == LDKBolt11ParseError_MalformedSignature);
11108         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
11109         return malformed_signature_conv;
11110 }
11111 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
11112         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11113         assert(obj->tag == LDKBolt11ParseError_DescriptionDecodeError);
11114         /*obj->description_decode_error*/
11115         return 0;
11116 }
11117 jstring __attribute__((export_name("TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
11118         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11119         assert(obj->tag == LDKBolt11ParseError_InvalidSliceLength);
11120         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
11121                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
11122         return invalid_slice_length_conv;
11123 }
11124 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
11125 CHECK(owner->result_ok);
11126         return SiPrefix_clone(&*owner->contents.result);
11127 }
11128 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok(uint64_t owner) {
11129         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
11130         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
11131         return ret_conv;
11132 }
11133
11134 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
11135 CHECK(!owner->result_ok);
11136         return Bolt11ParseError_clone(&*owner->contents.err);
11137 }
11138 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_err(uint64_t owner) {
11139         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
11140         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
11141         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
11142         uint64_t ret_ref = tag_ptr(ret_copy, true);
11143         return ret_ref;
11144 }
11145
11146 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
11147         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
11148         switch(obj->tag) {
11149                 case LDKParseOrSemanticError_ParseError: return 0;
11150                 case LDKParseOrSemanticError_SemanticError: return 1;
11151                 default: abort();
11152         }
11153 }
11154 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
11155         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
11156         assert(obj->tag == LDKParseOrSemanticError_ParseError);
11157         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
11158         return parse_error_ref;
11159 }
11160 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
11161         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
11162         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
11163         uint32_t semantic_error_conv = LDKBolt11SemanticError_to_js(obj->semantic_error);
11164         return semantic_error_conv;
11165 }
11166 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
11167         LDKBolt11Invoice ret = *owner->contents.result;
11168         ret.is_owned = false;
11169         return ret;
11170 }
11171 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
11172         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
11173         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
11174         uint64_t ret_ref = 0;
11175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11177         return ret_ref;
11178 }
11179
11180 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
11181 CHECK(!owner->result_ok);
11182         return ParseOrSemanticError_clone(&*owner->contents.err);
11183 }
11184 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
11185         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
11186         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
11187         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
11188         uint64_t ret_ref = tag_ptr(ret_copy, true);
11189         return ret_ref;
11190 }
11191
11192 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
11193         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
11194         ret.is_owned = false;
11195         return ret;
11196 }
11197 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(uint64_t owner) {
11198         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
11199         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
11200         uint64_t ret_ref = 0;
11201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11203         return ret_ref;
11204 }
11205
11206 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
11207 CHECK(!owner->result_ok);
11208         return Bolt11ParseError_clone(&*owner->contents.err);
11209 }
11210 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(uint64_t owner) {
11211         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
11212         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
11213         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
11214         uint64_t ret_ref = tag_ptr(ret_copy, true);
11215         return ret_ref;
11216 }
11217
11218 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
11219         LDKRawBolt11Invoice ret = owner->a;
11220         ret.is_owned = false;
11221         return ret;
11222 }
11223 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(uint64_t owner) {
11224         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
11225         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
11226         uint64_t ret_ref = 0;
11227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11229         return ret_ref;
11230 }
11231
11232 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
11233         return ThirtyTwoBytes_clone(&owner->b);
11234 }
11235 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(uint64_t owner) {
11236         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
11237         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
11238         memcpy(ret_arr->elems, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data, 32);
11239         return ret_arr;
11240 }
11241
11242 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
11243         LDKBolt11InvoiceSignature ret = owner->c;
11244         ret.is_owned = false;
11245         return ret;
11246 }
11247 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(uint64_t owner) {
11248         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
11249         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
11250         uint64_t ret_ref = 0;
11251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11253         return ret_ref;
11254 }
11255
11256 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
11257         LDKPayeePubKey ret = *owner->contents.result;
11258         ret.is_owned = false;
11259         return ret;
11260 }
11261 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_get_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_get_ok(uint64_t owner) {
11262         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
11263         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
11264         uint64_t ret_ref = 0;
11265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11267         return ret_ref;
11268 }
11269
11270 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
11271 CHECK(!owner->result_ok);
11272         return *owner->contents.err;
11273 }
11274 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_get_err"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_get_err(uint64_t owner) {
11275         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
11276         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
11277         return ret_conv;
11278 }
11279
11280 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
11281         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
11282         for (size_t i = 0; i < ret.datalen; i++) {
11283                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
11284         }
11285         return ret;
11286 }
11287 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
11288         LDKPositiveTimestamp ret = *owner->contents.result;
11289         ret.is_owned = false;
11290         return ret;
11291 }
11292 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
11293         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
11294         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
11295         uint64_t ret_ref = 0;
11296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11298         return ret_ref;
11299 }
11300
11301 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
11302 CHECK(!owner->result_ok);
11303         return CreationError_clone(&*owner->contents.err);
11304 }
11305 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
11306         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
11307         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
11308         return ret_conv;
11309 }
11310
11311 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
11312 CHECK(owner->result_ok);
11313         return *owner->contents.result;
11314 }
11315 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_get_ok(uint64_t owner) {
11316         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
11317         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
11318 }
11319
11320 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
11321 CHECK(!owner->result_ok);
11322         return Bolt11SemanticError_clone(&*owner->contents.err);
11323 }
11324 uint32_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_err"))) TS_CResult_NoneBolt11SemanticErrorZ_get_err(uint64_t owner) {
11325         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
11326         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
11327         return ret_conv;
11328 }
11329
11330 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
11331         LDKBolt11Invoice ret = *owner->contents.result;
11332         ret.is_owned = false;
11333         return ret;
11334 }
11335 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(uint64_t owner) {
11336         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
11337         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
11338         uint64_t ret_ref = 0;
11339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11341         return ret_ref;
11342 }
11343
11344 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
11345 CHECK(!owner->result_ok);
11346         return Bolt11SemanticError_clone(&*owner->contents.err);
11347 }
11348 uint32_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(uint64_t owner) {
11349         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
11350         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
11351         return ret_conv;
11352 }
11353
11354 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
11355         LDKDescription ret = *owner->contents.result;
11356         ret.is_owned = false;
11357         return ret;
11358 }
11359 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
11360         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
11361         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
11362         uint64_t ret_ref = 0;
11363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11365         return ret_ref;
11366 }
11367
11368 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
11369 CHECK(!owner->result_ok);
11370         return CreationError_clone(&*owner->contents.err);
11371 }
11372 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
11373         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
11374         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
11375         return ret_conv;
11376 }
11377
11378 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
11379         LDKPrivateRoute ret = *owner->contents.result;
11380         ret.is_owned = false;
11381         return ret;
11382 }
11383 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
11384         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
11385         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
11386         uint64_t ret_ref = 0;
11387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11389         return ret_ref;
11390 }
11391
11392 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
11393 CHECK(!owner->result_ok);
11394         return CreationError_clone(&*owner->contents.err);
11395 }
11396 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
11397         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
11398         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
11399         return ret_conv;
11400 }
11401
11402 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
11403         LDKOutPoint ret = *owner->contents.result;
11404         ret.is_owned = false;
11405         return ret;
11406 }
11407 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
11408         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
11409         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
11410         uint64_t ret_ref = 0;
11411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11413         return ret_ref;
11414 }
11415
11416 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
11417 CHECK(!owner->result_ok);
11418         return DecodeError_clone(&*owner->contents.err);
11419 }
11420 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
11421         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
11422         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11423         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
11424         uint64_t ret_ref = tag_ptr(ret_copy, true);
11425         return ret_ref;
11426 }
11427
11428 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
11429         LDKBigSize ret = *owner->contents.result;
11430         ret.is_owned = false;
11431         return ret;
11432 }
11433 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_ok"))) TS_CResult_BigSizeDecodeErrorZ_get_ok(uint64_t owner) {
11434         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
11435         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
11436         uint64_t ret_ref = 0;
11437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11439         return ret_ref;
11440 }
11441
11442 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
11443 CHECK(!owner->result_ok);
11444         return DecodeError_clone(&*owner->contents.err);
11445 }
11446 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_err"))) TS_CResult_BigSizeDecodeErrorZ_get_err(uint64_t owner) {
11447         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
11448         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11449         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
11450         uint64_t ret_ref = tag_ptr(ret_copy, true);
11451         return ret_ref;
11452 }
11453
11454 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
11455         LDKHostname ret = *owner->contents.result;
11456         ret.is_owned = false;
11457         return ret;
11458 }
11459 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_ok"))) TS_CResult_HostnameDecodeErrorZ_get_ok(uint64_t owner) {
11460         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
11461         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
11462         uint64_t ret_ref = 0;
11463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11465         return ret_ref;
11466 }
11467
11468 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
11469 CHECK(!owner->result_ok);
11470         return DecodeError_clone(&*owner->contents.err);
11471 }
11472 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_err"))) TS_CResult_HostnameDecodeErrorZ_get_err(uint64_t owner) {
11473         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
11474         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11475         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
11476         uint64_t ret_ref = tag_ptr(ret_copy, true);
11477         return ret_ref;
11478 }
11479
11480 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
11481         LDKTransactionU16LenLimited ret = *owner->contents.result;
11482         ret.is_owned = false;
11483         return ret;
11484 }
11485 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_ok(uint64_t owner) {
11486         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
11487         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
11488         uint64_t ret_ref = 0;
11489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11491         return ret_ref;
11492 }
11493
11494 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
11495 CHECK(!owner->result_ok);
11496         return *owner->contents.err;
11497 }
11498 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_err(uint64_t owner) {
11499         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
11500         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
11501 }
11502
11503 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
11504         LDKTransactionU16LenLimited ret = *owner->contents.result;
11505         ret.is_owned = false;
11506         return ret;
11507 }
11508 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(uint64_t owner) {
11509         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
11510         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
11511         uint64_t ret_ref = 0;
11512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11514         return ret_ref;
11515 }
11516
11517 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
11518 CHECK(!owner->result_ok);
11519         return DecodeError_clone(&*owner->contents.err);
11520 }
11521 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(uint64_t owner) {
11522         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
11523         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11524         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
11525         uint64_t ret_ref = tag_ptr(ret_copy, true);
11526         return ret_ref;
11527 }
11528
11529 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
11530         LDKUntrustedString ret = *owner->contents.result;
11531         ret.is_owned = false;
11532         return ret;
11533 }
11534 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_get_ok(uint64_t owner) {
11535         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
11536         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
11537         uint64_t ret_ref = 0;
11538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11540         return ret_ref;
11541 }
11542
11543 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
11544 CHECK(!owner->result_ok);
11545         return DecodeError_clone(&*owner->contents.err);
11546 }
11547 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_err"))) TS_CResult_UntrustedStringDecodeErrorZ_get_err(uint64_t owner) {
11548         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
11549         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11550         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
11551         uint64_t ret_ref = tag_ptr(ret_copy, true);
11552         return ret_ref;
11553 }
11554
11555 static inline struct LDKThirtyTwoBytes C2Tuple__u832u16Z_get_a(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
11556         return ThirtyTwoBytes_clone(&owner->a);
11557 }
11558 int8_tArray  __attribute__((export_name("TS_C2Tuple__u832u16Z_get_a"))) TS_C2Tuple__u832u16Z_get_a(uint64_t owner) {
11559         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
11560         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
11561         memcpy(ret_arr->elems, C2Tuple__u832u16Z_get_a(owner_conv).data, 32);
11562         return ret_arr;
11563 }
11564
11565 static inline uint16_t C2Tuple__u832u16Z_get_b(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
11566         return owner->b;
11567 }
11568 int16_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_get_b"))) TS_C2Tuple__u832u16Z_get_b(uint64_t owner) {
11569         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
11570         int16_t ret_conv = C2Tuple__u832u16Z_get_b(owner_conv);
11571         return ret_conv;
11572 }
11573
11574 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
11575         LDKPaymentRelay ret = *owner->contents.result;
11576         ret.is_owned = false;
11577         return ret;
11578 }
11579 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_get_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_get_ok(uint64_t owner) {
11580         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
11581         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
11582         uint64_t ret_ref = 0;
11583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11585         return ret_ref;
11586 }
11587
11588 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
11589 CHECK(!owner->result_ok);
11590         return DecodeError_clone(&*owner->contents.err);
11591 }
11592 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_get_err"))) TS_CResult_PaymentRelayDecodeErrorZ_get_err(uint64_t owner) {
11593         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
11594         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11595         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
11596         uint64_t ret_ref = tag_ptr(ret_copy, true);
11597         return ret_ref;
11598 }
11599
11600 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
11601         LDKPaymentConstraints ret = *owner->contents.result;
11602         ret.is_owned = false;
11603         return ret;
11604 }
11605 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_get_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_get_ok(uint64_t owner) {
11606         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
11607         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
11608         uint64_t ret_ref = 0;
11609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11611         return ret_ref;
11612 }
11613
11614 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
11615 CHECK(!owner->result_ok);
11616         return DecodeError_clone(&*owner->contents.err);
11617 }
11618 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_get_err"))) TS_CResult_PaymentConstraintsDecodeErrorZ_get_err(uint64_t owner) {
11619         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
11620         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11621         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
11622         uint64_t ret_ref = tag_ptr(ret_copy, true);
11623         return ret_ref;
11624 }
11625
11626 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
11627         return ThirtyTwoBytes_clone(&owner->a);
11628 }
11629 int8_tArray  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(uint64_t owner) {
11630         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
11631         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
11632         memcpy(ret_arr->elems, C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(owner_conv).data, 32);
11633         return ret_arr;
11634 }
11635
11636 static inline struct LDKRecipientOnionFields C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
11637         LDKRecipientOnionFields ret = owner->b;
11638         ret.is_owned = false;
11639         return ret;
11640 }
11641 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(uint64_t owner) {
11642         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
11643         LDKRecipientOnionFields ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(owner_conv);
11644         uint64_t ret_ref = 0;
11645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11647         return ret_ref;
11648 }
11649
11650 static inline struct LDKRouteParameters C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
11651         LDKRouteParameters ret = owner->c;
11652         ret.is_owned = false;
11653         return ret;
11654 }
11655 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(uint64_t owner) {
11656         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
11657         LDKRouteParameters ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(owner_conv);
11658         uint64_t ret_ref = 0;
11659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11661         return ret_ref;
11662 }
11663
11664 static inline struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
11665 CHECK(owner->result_ok);
11666         return C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(&*owner->contents.result);
11667 }
11668 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(uint64_t owner) {
11669         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
11670         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
11671         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(owner_conv);
11672         return tag_ptr(ret_conv, true);
11673 }
11674
11675 static inline void CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
11676 CHECK(!owner->result_ok);
11677         return *owner->contents.err;
11678 }
11679 void  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(uint64_t owner) {
11680         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
11681         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(owner_conv);
11682 }
11683
11684 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
11685 CHECK(owner->result_ok);
11686         return *owner->contents.result;
11687 }
11688 jstring  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_get_ok"))) TS_CResult_StrSecp256k1ErrorZ_get_ok(uint64_t owner) {
11689         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
11690         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
11691         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11692         return ret_conv;
11693 }
11694
11695 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
11696 CHECK(!owner->result_ok);
11697         return *owner->contents.err;
11698 }
11699 uint32_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_get_err"))) TS_CResult_StrSecp256k1ErrorZ_get_err(uint64_t owner) {
11700         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
11701         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
11702         return ret_conv;
11703 }
11704
11705 static inline struct LDKPublicKey C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
11706         return owner->a;
11707 }
11708 int8_tArray  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(uint64_t owner) {
11709         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
11710         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
11711         memcpy(ret_arr->elems, C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(owner_conv).compressed_form, 33);
11712         return ret_arr;
11713 }
11714
11715 static inline struct LDKOnionMessage C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
11716         LDKOnionMessage ret = owner->b;
11717         ret.is_owned = false;
11718         return ret;
11719 }
11720 uint64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(uint64_t owner) {
11721         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
11722         LDKOnionMessage ret_var = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(owner_conv);
11723         uint64_t ret_ref = 0;
11724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11726         return ret_ref;
11727 }
11728
11729 static inline struct LDKCOption_CVec_SocketAddressZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
11730         return COption_CVec_SocketAddressZZ_clone(&owner->c);
11731 }
11732 uint64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(uint64_t owner) {
11733         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
11734         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
11735         *ret_copy = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(owner_conv);
11736         uint64_t ret_ref = tag_ptr(ret_copy, true);
11737         return ret_ref;
11738 }
11739
11740 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
11741         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
11742         switch(obj->tag) {
11743                 case LDKSendError_Secp256k1: return 0;
11744                 case LDKSendError_TooBigPacket: return 1;
11745                 case LDKSendError_TooFewBlindedHops: return 2;
11746                 case LDKSendError_InvalidFirstHop: return 3;
11747                 case LDKSendError_PathNotFound: return 4;
11748                 case LDKSendError_InvalidMessage: return 5;
11749                 case LDKSendError_BufferFull: return 6;
11750                 case LDKSendError_GetNodeIdFailed: return 7;
11751                 case LDKSendError_BlindedPathAdvanceFailed: return 8;
11752                 default: abort();
11753         }
11754 }
11755 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
11756         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
11757         assert(obj->tag == LDKSendError_Secp256k1);
11758         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
11759         return secp256k1_conv;
11760 }
11761 int8_tArray __attribute__((export_name("TS_LDKSendError_InvalidFirstHop_get_invalid_first_hop"))) TS_LDKSendError_InvalidFirstHop_get_invalid_first_hop(uint64_t ptr) {
11762         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
11763         assert(obj->tag == LDKSendError_InvalidFirstHop);
11764         int8_tArray invalid_first_hop_arr = init_int8_tArray(33, __LINE__);
11765         memcpy(invalid_first_hop_arr->elems, obj->invalid_first_hop.compressed_form, 33);
11766         return invalid_first_hop_arr;
11767 }
11768 static inline struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
11769 CHECK(owner->result_ok);
11770         return C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(&*owner->contents.result);
11771 }
11772 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(uint64_t owner) {
11773         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
11774         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
11775         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(owner_conv);
11776         return tag_ptr(ret_conv, true);
11777 }
11778
11779 static inline struct LDKSendError CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
11780 CHECK(!owner->result_ok);
11781         return SendError_clone(&*owner->contents.err);
11782 }
11783 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(uint64_t owner) {
11784         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
11785         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
11786         *ret_copy = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(owner_conv);
11787         uint64_t ret_ref = tag_ptr(ret_copy, true);
11788         return ret_ref;
11789 }
11790
11791 uint32_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_ty_from_ptr"))) TS_LDKParsedOnionMessageContents_ty_from_ptr(uint64_t ptr) {
11792         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
11793         switch(obj->tag) {
11794                 case LDKParsedOnionMessageContents_Offers: return 0;
11795                 case LDKParsedOnionMessageContents_Custom: return 1;
11796                 default: abort();
11797         }
11798 }
11799 uint64_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_Offers_get_offers"))) TS_LDKParsedOnionMessageContents_Offers_get_offers(uint64_t ptr) {
11800         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
11801         assert(obj->tag == LDKParsedOnionMessageContents_Offers);
11802         uint64_t offers_ref = tag_ptr(&obj->offers, false);
11803         return offers_ref;
11804 }
11805 uint64_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_Custom_get_custom"))) TS_LDKParsedOnionMessageContents_Custom_get_custom(uint64_t ptr) {
11806         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
11807         assert(obj->tag == LDKParsedOnionMessageContents_Custom);
11808         LDKOnionMessageContents* custom_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
11809         *custom_ret = OnionMessageContents_clone(&obj->custom);
11810         return tag_ptr(custom_ret, true);
11811 }
11812 uint32_t __attribute__((export_name("TS_LDKPeeledOnion_ty_from_ptr"))) TS_LDKPeeledOnion_ty_from_ptr(uint64_t ptr) {
11813         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11814         switch(obj->tag) {
11815                 case LDKPeeledOnion_Forward: return 0;
11816                 case LDKPeeledOnion_Receive: return 1;
11817                 default: abort();
11818         }
11819 }
11820 int8_tArray __attribute__((export_name("TS_LDKPeeledOnion_Forward_get__0"))) TS_LDKPeeledOnion_Forward_get__0(uint64_t ptr) {
11821         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11822         assert(obj->tag == LDKPeeledOnion_Forward);
11823         int8_tArray _0_arr = init_int8_tArray(33, __LINE__);
11824         memcpy(_0_arr->elems, obj->forward._0.compressed_form, 33);
11825         return _0_arr;
11826 }
11827 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Forward_get__1"))) TS_LDKPeeledOnion_Forward_get__1(uint64_t ptr) {
11828         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11829         assert(obj->tag == LDKPeeledOnion_Forward);
11830         LDKOnionMessage _1_var = obj->forward._1;
11831                         uint64_t _1_ref = 0;
11832                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_1_var);
11833                         _1_ref = tag_ptr(_1_var.inner, false);
11834         return _1_ref;
11835 }
11836 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__0"))) TS_LDKPeeledOnion_Receive_get__0(uint64_t ptr) {
11837         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11838         assert(obj->tag == LDKPeeledOnion_Receive);
11839         uint64_t _0_ref = tag_ptr(&obj->receive._0, false);
11840         return _0_ref;
11841 }
11842 int8_tArray __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__1"))) TS_LDKPeeledOnion_Receive_get__1(uint64_t ptr) {
11843         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11844         assert(obj->tag == LDKPeeledOnion_Receive);
11845         int8_tArray _1_arr = init_int8_tArray(32, __LINE__);
11846         memcpy(_1_arr->elems, obj->receive._1.data, 32);
11847         return _1_arr;
11848 }
11849 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__2"))) TS_LDKPeeledOnion_Receive_get__2(uint64_t ptr) {
11850         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11851         assert(obj->tag == LDKPeeledOnion_Receive);
11852         LDKBlindedPath _2_var = obj->receive._2;
11853                         uint64_t _2_ref = 0;
11854                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_2_var);
11855                         _2_ref = tag_ptr(_2_var.inner, false);
11856         return _2_ref;
11857 }
11858 static inline struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
11859 CHECK(owner->result_ok);
11860         return PeeledOnion_clone(&*owner->contents.result);
11861 }
11862 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_get_ok"))) TS_CResult_PeeledOnionNoneZ_get_ok(uint64_t owner) {
11863         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
11864         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
11865         *ret_copy = CResult_PeeledOnionNoneZ_get_ok(owner_conv);
11866         uint64_t ret_ref = tag_ptr(ret_copy, true);
11867         return ret_ref;
11868 }
11869
11870 static inline void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
11871 CHECK(!owner->result_ok);
11872         return *owner->contents.err;
11873 }
11874 void  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_get_err"))) TS_CResult_PeeledOnionNoneZ_get_err(uint64_t owner) {
11875         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
11876         CResult_PeeledOnionNoneZ_get_err(owner_conv);
11877 }
11878
11879 uint32_t __attribute__((export_name("TS_LDKSendSuccess_ty_from_ptr"))) TS_LDKSendSuccess_ty_from_ptr(uint64_t ptr) {
11880         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
11881         switch(obj->tag) {
11882                 case LDKSendSuccess_Buffered: return 0;
11883                 case LDKSendSuccess_BufferedAwaitingConnection: return 1;
11884                 default: abort();
11885         }
11886 }
11887 int8_tArray __attribute__((export_name("TS_LDKSendSuccess_BufferedAwaitingConnection_get_buffered_awaiting_connection"))) TS_LDKSendSuccess_BufferedAwaitingConnection_get_buffered_awaiting_connection(uint64_t ptr) {
11888         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
11889         assert(obj->tag == LDKSendSuccess_BufferedAwaitingConnection);
11890         int8_tArray buffered_awaiting_connection_arr = init_int8_tArray(33, __LINE__);
11891         memcpy(buffered_awaiting_connection_arr->elems, obj->buffered_awaiting_connection.compressed_form, 33);
11892         return buffered_awaiting_connection_arr;
11893 }
11894 static inline struct LDKSendSuccess CResult_SendSuccessSendErrorZ_get_ok(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
11895 CHECK(owner->result_ok);
11896         return SendSuccess_clone(&*owner->contents.result);
11897 }
11898 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_get_ok"))) TS_CResult_SendSuccessSendErrorZ_get_ok(uint64_t owner) {
11899         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
11900         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
11901         *ret_copy = CResult_SendSuccessSendErrorZ_get_ok(owner_conv);
11902         uint64_t ret_ref = tag_ptr(ret_copy, true);
11903         return ret_ref;
11904 }
11905
11906 static inline struct LDKSendError CResult_SendSuccessSendErrorZ_get_err(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
11907 CHECK(!owner->result_ok);
11908         return SendError_clone(&*owner->contents.err);
11909 }
11910 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_get_err"))) TS_CResult_SendSuccessSendErrorZ_get_err(uint64_t owner) {
11911         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
11912         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
11913         *ret_copy = CResult_SendSuccessSendErrorZ_get_err(owner_conv);
11914         uint64_t ret_ref = tag_ptr(ret_copy, true);
11915         return ret_ref;
11916 }
11917
11918 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
11919         LDKBlindedPath ret = *owner->contents.result;
11920         ret.is_owned = false;
11921         return ret;
11922 }
11923 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_ok"))) TS_CResult_BlindedPathNoneZ_get_ok(uint64_t owner) {
11924         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
11925         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
11926         uint64_t ret_ref = 0;
11927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11929         return ret_ref;
11930 }
11931
11932 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
11933 CHECK(!owner->result_ok);
11934         return *owner->contents.err;
11935 }
11936 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_err"))) TS_CResult_BlindedPathNoneZ_get_err(uint64_t owner) {
11937         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
11938         CResult_BlindedPathNoneZ_get_err(owner_conv);
11939 }
11940
11941 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
11942 CHECK(owner->result_ok);
11943         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
11944 }
11945 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(uint64_t owner) {
11946         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
11947         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
11948         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
11949         return tag_ptr(ret_conv, true);
11950 }
11951
11952 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
11953 CHECK(!owner->result_ok);
11954         return *owner->contents.err;
11955 }
11956 void  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(uint64_t owner) {
11957         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
11958         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
11959 }
11960
11961 static inline LDKCVec_ForwardNodeZ CVec_ForwardNodeZ_clone(const LDKCVec_ForwardNodeZ *orig) {
11962         LDKCVec_ForwardNodeZ ret = { .data = MALLOC(sizeof(LDKForwardNode) * orig->datalen, "LDKCVec_ForwardNodeZ clone bytes"), .datalen = orig->datalen };
11963         for (size_t i = 0; i < ret.datalen; i++) {
11964                 ret.data[i] = ForwardNode_clone(&orig->data[i]);
11965         }
11966         return ret;
11967 }
11968 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
11969         LDKBlindedPath ret = *owner->contents.result;
11970         ret.is_owned = false;
11971         return ret;
11972 }
11973 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_ok"))) TS_CResult_BlindedPathDecodeErrorZ_get_ok(uint64_t owner) {
11974         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
11975         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
11976         uint64_t ret_ref = 0;
11977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11979         return ret_ref;
11980 }
11981
11982 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
11983 CHECK(!owner->result_ok);
11984         return DecodeError_clone(&*owner->contents.err);
11985 }
11986 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_err"))) TS_CResult_BlindedPathDecodeErrorZ_get_err(uint64_t owner) {
11987         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
11988         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11989         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
11990         uint64_t ret_ref = tag_ptr(ret_copy, true);
11991         return ret_ref;
11992 }
11993
11994 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
11995         LDKBlindedHop ret = *owner->contents.result;
11996         ret.is_owned = false;
11997         return ret;
11998 }
11999 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
12000         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
12001         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
12002         uint64_t ret_ref = 0;
12003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12005         return ret_ref;
12006 }
12007
12008 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
12009 CHECK(!owner->result_ok);
12010         return DecodeError_clone(&*owner->contents.err);
12011 }
12012 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
12013         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
12014         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12015         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
12016         uint64_t ret_ref = tag_ptr(ret_copy, true);
12017         return ret_ref;
12018 }
12019
12020 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
12021         LDKInvoiceError ret = *owner->contents.result;
12022         ret.is_owned = false;
12023         return ret;
12024 }
12025 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_ok(uint64_t owner) {
12026         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
12027         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
12028         uint64_t ret_ref = 0;
12029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12031         return ret_ref;
12032 }
12033
12034 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
12035 CHECK(!owner->result_ok);
12036         return DecodeError_clone(&*owner->contents.err);
12037 }
12038 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_err(uint64_t owner) {
12039         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
12040         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12041         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
12042         uint64_t ret_ref = tag_ptr(ret_copy, true);
12043         return ret_ref;
12044 }
12045
12046 static inline struct LDKDelayedPaymentBasepoint CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
12047         LDKDelayedPaymentBasepoint ret = *owner->contents.result;
12048         ret.is_owned = false;
12049         return ret;
12050 }
12051 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(uint64_t owner) {
12052         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
12053         LDKDelayedPaymentBasepoint ret_var = CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(owner_conv);
12054         uint64_t ret_ref = 0;
12055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12057         return ret_ref;
12058 }
12059
12060 static inline struct LDKDecodeError CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
12061 CHECK(!owner->result_ok);
12062         return DecodeError_clone(&*owner->contents.err);
12063 }
12064 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(uint64_t owner) {
12065         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
12066         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12067         *ret_copy = CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(owner_conv);
12068         uint64_t ret_ref = tag_ptr(ret_copy, true);
12069         return ret_ref;
12070 }
12071
12072 static inline struct LDKDelayedPaymentKey CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
12073         LDKDelayedPaymentKey ret = *owner->contents.result;
12074         ret.is_owned = false;
12075         return ret;
12076 }
12077 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(uint64_t owner) {
12078         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
12079         LDKDelayedPaymentKey ret_var = CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(owner_conv);
12080         uint64_t ret_ref = 0;
12081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12083         return ret_ref;
12084 }
12085
12086 static inline struct LDKDecodeError CResult_DelayedPaymentKeyDecodeErrorZ_get_err(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
12087 CHECK(!owner->result_ok);
12088         return DecodeError_clone(&*owner->contents.err);
12089 }
12090 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_err(uint64_t owner) {
12091         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
12092         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12093         *ret_copy = CResult_DelayedPaymentKeyDecodeErrorZ_get_err(owner_conv);
12094         uint64_t ret_ref = tag_ptr(ret_copy, true);
12095         return ret_ref;
12096 }
12097
12098 static inline struct LDKHtlcBasepoint CResult_HtlcBasepointDecodeErrorZ_get_ok(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
12099         LDKHtlcBasepoint ret = *owner->contents.result;
12100         ret.is_owned = false;
12101         return ret;
12102 }
12103 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_get_ok"))) TS_CResult_HtlcBasepointDecodeErrorZ_get_ok(uint64_t owner) {
12104         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
12105         LDKHtlcBasepoint ret_var = CResult_HtlcBasepointDecodeErrorZ_get_ok(owner_conv);
12106         uint64_t ret_ref = 0;
12107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12109         return ret_ref;
12110 }
12111
12112 static inline struct LDKDecodeError CResult_HtlcBasepointDecodeErrorZ_get_err(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
12113 CHECK(!owner->result_ok);
12114         return DecodeError_clone(&*owner->contents.err);
12115 }
12116 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_get_err"))) TS_CResult_HtlcBasepointDecodeErrorZ_get_err(uint64_t owner) {
12117         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
12118         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12119         *ret_copy = CResult_HtlcBasepointDecodeErrorZ_get_err(owner_conv);
12120         uint64_t ret_ref = tag_ptr(ret_copy, true);
12121         return ret_ref;
12122 }
12123
12124 static inline struct LDKHtlcKey CResult_HtlcKeyDecodeErrorZ_get_ok(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
12125         LDKHtlcKey ret = *owner->contents.result;
12126         ret.is_owned = false;
12127         return ret;
12128 }
12129 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_get_ok"))) TS_CResult_HtlcKeyDecodeErrorZ_get_ok(uint64_t owner) {
12130         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
12131         LDKHtlcKey ret_var = CResult_HtlcKeyDecodeErrorZ_get_ok(owner_conv);
12132         uint64_t ret_ref = 0;
12133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12135         return ret_ref;
12136 }
12137
12138 static inline struct LDKDecodeError CResult_HtlcKeyDecodeErrorZ_get_err(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
12139 CHECK(!owner->result_ok);
12140         return DecodeError_clone(&*owner->contents.err);
12141 }
12142 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_get_err"))) TS_CResult_HtlcKeyDecodeErrorZ_get_err(uint64_t owner) {
12143         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
12144         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12145         *ret_copy = CResult_HtlcKeyDecodeErrorZ_get_err(owner_conv);
12146         uint64_t ret_ref = tag_ptr(ret_copy, true);
12147         return ret_ref;
12148 }
12149
12150 static inline struct LDKRevocationBasepoint CResult_RevocationBasepointDecodeErrorZ_get_ok(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
12151         LDKRevocationBasepoint ret = *owner->contents.result;
12152         ret.is_owned = false;
12153         return ret;
12154 }
12155 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_get_ok"))) TS_CResult_RevocationBasepointDecodeErrorZ_get_ok(uint64_t owner) {
12156         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
12157         LDKRevocationBasepoint ret_var = CResult_RevocationBasepointDecodeErrorZ_get_ok(owner_conv);
12158         uint64_t ret_ref = 0;
12159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12161         return ret_ref;
12162 }
12163
12164 static inline struct LDKDecodeError CResult_RevocationBasepointDecodeErrorZ_get_err(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
12165 CHECK(!owner->result_ok);
12166         return DecodeError_clone(&*owner->contents.err);
12167 }
12168 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_get_err"))) TS_CResult_RevocationBasepointDecodeErrorZ_get_err(uint64_t owner) {
12169         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
12170         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12171         *ret_copy = CResult_RevocationBasepointDecodeErrorZ_get_err(owner_conv);
12172         uint64_t ret_ref = tag_ptr(ret_copy, true);
12173         return ret_ref;
12174 }
12175
12176 static inline struct LDKRevocationKey CResult_RevocationKeyDecodeErrorZ_get_ok(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
12177         LDKRevocationKey ret = *owner->contents.result;
12178         ret.is_owned = false;
12179         return ret;
12180 }
12181 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_get_ok"))) TS_CResult_RevocationKeyDecodeErrorZ_get_ok(uint64_t owner) {
12182         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
12183         LDKRevocationKey ret_var = CResult_RevocationKeyDecodeErrorZ_get_ok(owner_conv);
12184         uint64_t ret_ref = 0;
12185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12187         return ret_ref;
12188 }
12189
12190 static inline struct LDKDecodeError CResult_RevocationKeyDecodeErrorZ_get_err(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
12191 CHECK(!owner->result_ok);
12192         return DecodeError_clone(&*owner->contents.err);
12193 }
12194 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_get_err"))) TS_CResult_RevocationKeyDecodeErrorZ_get_err(uint64_t owner) {
12195         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
12196         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12197         *ret_copy = CResult_RevocationKeyDecodeErrorZ_get_err(owner_conv);
12198         uint64_t ret_ref = tag_ptr(ret_copy, true);
12199         return ret_ref;
12200 }
12201
12202 typedef struct LDKFilter_JCalls {
12203         atomic_size_t refcnt;
12204         uint32_t instance_ptr;
12205 } LDKFilter_JCalls;
12206 static void LDKFilter_JCalls_free(void* this_arg) {
12207         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
12208         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12209                 FREE(j_calls);
12210         }
12211 }
12212 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
12213         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
12214         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
12215         memcpy(txid_arr->elems, *txid, 32);
12216         LDKu8slice script_pubkey_var = script_pubkey;
12217         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
12218         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
12219         js_invoke_function_uuuuuu(j_calls->instance_ptr, 47, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
12220 }
12221 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
12222         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
12223         LDKWatchedOutput output_var = output;
12224         uint64_t output_ref = 0;
12225         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
12226         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
12227         js_invoke_function_buuuuu(j_calls->instance_ptr, 48, output_ref, 0, 0, 0, 0, 0);
12228 }
12229 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
12230         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
12231         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12232 }
12233 static inline LDKFilter LDKFilter_init (JSValue o) {
12234         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
12235         atomic_init(&calls->refcnt, 1);
12236         calls->instance_ptr = o;
12237
12238         LDKFilter ret = {
12239                 .this_arg = (void*) calls,
12240                 .register_tx = register_tx_LDKFilter_jcall,
12241                 .register_output = register_output_LDKFilter_jcall,
12242                 .free = LDKFilter_JCalls_free,
12243         };
12244         return ret;
12245 }
12246 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
12247         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
12248         *res_ptr = LDKFilter_init(o);
12249         return tag_ptr(res_ptr, true);
12250 }
12251 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
12252         void* this_arg_ptr = untag_ptr(this_arg);
12253         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12254         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
12255         uint8_t txid_arr[32];
12256         CHECK(txid->arr_len == 32);
12257         memcpy(txid_arr, txid->elems, 32); FREE(txid);
12258         uint8_t (*txid_ref)[32] = &txid_arr;
12259         LDKu8slice script_pubkey_ref;
12260         script_pubkey_ref.datalen = script_pubkey->arr_len;
12261         script_pubkey_ref.data = script_pubkey->elems;
12262         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
12263         FREE(script_pubkey);
12264 }
12265
12266 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
12267         void* this_arg_ptr = untag_ptr(this_arg);
12268         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12269         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
12270         LDKWatchedOutput output_conv;
12271         output_conv.inner = untag_ptr(output);
12272         output_conv.is_owned = ptr_is_owned(output);
12273         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
12274         output_conv = WatchedOutput_clone(&output_conv);
12275         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
12276 }
12277
12278 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
12279         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
12280         switch(obj->tag) {
12281                 case LDKCOption_FilterZ_Some: return 0;
12282                 case LDKCOption_FilterZ_None: return 1;
12283                 default: abort();
12284         }
12285 }
12286 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
12287         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
12288         assert(obj->tag == LDKCOption_FilterZ_Some);
12289         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
12290         *some_ret = obj->some;
12291                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
12292                         if ((*some_ret).free == LDKFilter_JCalls_free) {
12293                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12294                                 LDKFilter_JCalls_cloned(&(*some_ret));
12295                         }
12296         return tag_ptr(some_ret, true);
12297 }
12298 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
12299         LDKLockedChannelMonitor ret = *owner->contents.result;
12300         ret.is_owned = false;
12301         return ret;
12302 }
12303 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
12304         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
12305         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
12306         uint64_t ret_ref = 0;
12307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12309         return ret_ref;
12310 }
12311
12312 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
12313 CHECK(!owner->result_ok);
12314         return *owner->contents.err;
12315 }
12316 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
12317         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
12318         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
12319 }
12320
12321 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
12322         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
12323         for (size_t i = 0; i < ret.datalen; i++) {
12324                 ret.data[i] = OutPoint_clone(&orig->data[i]);
12325         }
12326         return ret;
12327 }
12328 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
12329         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
12330         for (size_t i = 0; i < ret.datalen; i++) {
12331                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
12332         }
12333         return ret;
12334 }
12335 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
12336         LDKOutPoint ret = owner->a;
12337         ret.is_owned = false;
12338         return ret;
12339 }
12340 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(uint64_t owner) {
12341         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
12342         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
12343         uint64_t ret_ref = 0;
12344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12346         return ret_ref;
12347 }
12348
12349 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
12350         return CVec_MonitorUpdateIdZ_clone(&owner->b);
12351 }
12352 uint64_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(uint64_t owner) {
12353         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
12354         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
12355         uint64_tArray ret_arr = NULL;
12356         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
12357         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
12358         for (size_t r = 0; r < ret_var.datalen; r++) {
12359                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
12360                 uint64_t ret_conv_17_ref = 0;
12361                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
12362                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
12363                 ret_arr_ptr[r] = ret_conv_17_ref;
12364         }
12365         
12366         FREE(ret_var.data);
12367         return ret_arr;
12368 }
12369
12370 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
12371         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
12372         for (size_t i = 0; i < ret.datalen; i++) {
12373                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
12374         }
12375         return ret;
12376 }
12377 typedef struct LDKKVStore_JCalls {
12378         atomic_size_t refcnt;
12379         uint32_t instance_ptr;
12380 } LDKKVStore_JCalls;
12381 static void LDKKVStore_JCalls_free(void* this_arg) {
12382         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
12383         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12384                 FREE(j_calls);
12385         }
12386 }
12387 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
12388         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
12389         LDKStr primary_namespace_str = primary_namespace;
12390         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
12391         Str_free(primary_namespace_str);
12392         LDKStr secondary_namespace_str = secondary_namespace;
12393         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
12394         Str_free(secondary_namespace_str);
12395         LDKStr key_str = key;
12396         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
12397         Str_free(key_str);
12398         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 49, primary_namespace_conv, secondary_namespace_conv, key_conv, 0, 0, 0);
12399         void* ret_ptr = untag_ptr(ret);
12400         CHECK_ACCESS(ret_ptr);
12401         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
12402         FREE(untag_ptr(ret));
12403         return ret_conv;
12404 }
12405 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
12406         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
12407         LDKStr primary_namespace_str = primary_namespace;
12408         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
12409         Str_free(primary_namespace_str);
12410         LDKStr secondary_namespace_str = secondary_namespace;
12411         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
12412         Str_free(secondary_namespace_str);
12413         LDKStr key_str = key;
12414         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
12415         Str_free(key_str);
12416         LDKu8slice buf_var = buf;
12417         int8_tArray buf_arr = init_int8_tArray(buf_var.datalen, __LINE__);
12418         memcpy(buf_arr->elems, buf_var.data, buf_var.datalen);
12419         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, primary_namespace_conv, secondary_namespace_conv, key_conv, (uint32_t)buf_arr, 0, 0);
12420         void* ret_ptr = untag_ptr(ret);
12421         CHECK_ACCESS(ret_ptr);
12422         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
12423         FREE(untag_ptr(ret));
12424         return ret_conv;
12425 }
12426 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
12427         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
12428         LDKStr primary_namespace_str = primary_namespace;
12429         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
12430         Str_free(primary_namespace_str);
12431         LDKStr secondary_namespace_str = secondary_namespace;
12432         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
12433         Str_free(secondary_namespace_str);
12434         LDKStr key_str = key;
12435         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
12436         Str_free(key_str);
12437         jboolean lazy_conv = lazy;
12438         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 51, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv, 0, 0);
12439         void* ret_ptr = untag_ptr(ret);
12440         CHECK_ACCESS(ret_ptr);
12441         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
12442         FREE(untag_ptr(ret));
12443         return ret_conv;
12444 }
12445 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
12446         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
12447         LDKStr primary_namespace_str = primary_namespace;
12448         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
12449         Str_free(primary_namespace_str);
12450         LDKStr secondary_namespace_str = secondary_namespace;
12451         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
12452         Str_free(secondary_namespace_str);
12453         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 52, primary_namespace_conv, secondary_namespace_conv, 0, 0, 0, 0);
12454         void* ret_ptr = untag_ptr(ret);
12455         CHECK_ACCESS(ret_ptr);
12456         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
12457         FREE(untag_ptr(ret));
12458         return ret_conv;
12459 }
12460 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
12461         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
12462         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12463 }
12464 static inline LDKKVStore LDKKVStore_init (JSValue o) {
12465         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
12466         atomic_init(&calls->refcnt, 1);
12467         calls->instance_ptr = o;
12468
12469         LDKKVStore ret = {
12470                 .this_arg = (void*) calls,
12471                 .read = read_LDKKVStore_jcall,
12472                 .write = write_LDKKVStore_jcall,
12473                 .remove = remove_LDKKVStore_jcall,
12474                 .list = list_LDKKVStore_jcall,
12475                 .free = LDKKVStore_JCalls_free,
12476         };
12477         return ret;
12478 }
12479 uint64_t  __attribute__((export_name("TS_LDKKVStore_new"))) TS_LDKKVStore_new(JSValue o) {
12480         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
12481         *res_ptr = LDKKVStore_init(o);
12482         return tag_ptr(res_ptr, true);
12483 }
12484 uint64_t  __attribute__((export_name("TS_KVStore_read"))) TS_KVStore_read(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key) {
12485         void* this_arg_ptr = untag_ptr(this_arg);
12486         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12487         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
12488         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
12489         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
12490         LDKStr key_conv = str_ref_to_owned_c(key);
12491         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
12492         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
12493         return tag_ptr(ret_conv, true);
12494 }
12495
12496 uint64_t  __attribute__((export_name("TS_KVStore_write"))) TS_KVStore_write(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key, int8_tArray buf) {
12497         void* this_arg_ptr = untag_ptr(this_arg);
12498         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12499         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
12500         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
12501         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
12502         LDKStr key_conv = str_ref_to_owned_c(key);
12503         LDKu8slice buf_ref;
12504         buf_ref.datalen = buf->arr_len;
12505         buf_ref.data = buf->elems;
12506         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
12507         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
12508         FREE(buf);
12509         return tag_ptr(ret_conv, true);
12510 }
12511
12512 uint64_t  __attribute__((export_name("TS_KVStore_remove"))) TS_KVStore_remove(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key, jboolean lazy) {
12513         void* this_arg_ptr = untag_ptr(this_arg);
12514         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12515         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
12516         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
12517         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
12518         LDKStr key_conv = str_ref_to_owned_c(key);
12519         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
12520         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
12521         return tag_ptr(ret_conv, true);
12522 }
12523
12524 uint64_t  __attribute__((export_name("TS_KVStore_list"))) TS_KVStore_list(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace) {
12525         void* this_arg_ptr = untag_ptr(this_arg);
12526         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12527         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
12528         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
12529         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
12530         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
12531         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
12532         return tag_ptr(ret_conv, true);
12533 }
12534
12535 uint32_t __attribute__((export_name("TS_LDKCandidateRouteHop_ty_from_ptr"))) TS_LDKCandidateRouteHop_ty_from_ptr(uint64_t ptr) {
12536         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
12537         switch(obj->tag) {
12538                 case LDKCandidateRouteHop_FirstHop: return 0;
12539                 case LDKCandidateRouteHop_PublicHop: return 1;
12540                 case LDKCandidateRouteHop_PrivateHop: return 2;
12541                 case LDKCandidateRouteHop_Blinded: return 3;
12542                 case LDKCandidateRouteHop_OneHopBlinded: return 4;
12543                 default: abort();
12544         }
12545 }
12546 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_FirstHop_get_first_hop"))) TS_LDKCandidateRouteHop_FirstHop_get_first_hop(uint64_t ptr) {
12547         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
12548         assert(obj->tag == LDKCandidateRouteHop_FirstHop);
12549         LDKFirstHopCandidate first_hop_var = obj->first_hop;
12550                         uint64_t first_hop_ref = 0;
12551                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hop_var);
12552                         first_hop_ref = tag_ptr(first_hop_var.inner, false);
12553         return first_hop_ref;
12554 }
12555 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_PublicHop_get_public_hop"))) TS_LDKCandidateRouteHop_PublicHop_get_public_hop(uint64_t ptr) {
12556         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
12557         assert(obj->tag == LDKCandidateRouteHop_PublicHop);
12558         LDKPublicHopCandidate public_hop_var = obj->public_hop;
12559                         uint64_t public_hop_ref = 0;
12560                         CHECK_INNER_FIELD_ACCESS_OR_NULL(public_hop_var);
12561                         public_hop_ref = tag_ptr(public_hop_var.inner, false);
12562         return public_hop_ref;
12563 }
12564 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_PrivateHop_get_private_hop"))) TS_LDKCandidateRouteHop_PrivateHop_get_private_hop(uint64_t ptr) {
12565         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
12566         assert(obj->tag == LDKCandidateRouteHop_PrivateHop);
12567         LDKPrivateHopCandidate private_hop_var = obj->private_hop;
12568                         uint64_t private_hop_ref = 0;
12569                         CHECK_INNER_FIELD_ACCESS_OR_NULL(private_hop_var);
12570                         private_hop_ref = tag_ptr(private_hop_var.inner, false);
12571         return private_hop_ref;
12572 }
12573 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_Blinded_get_blinded"))) TS_LDKCandidateRouteHop_Blinded_get_blinded(uint64_t ptr) {
12574         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
12575         assert(obj->tag == LDKCandidateRouteHop_Blinded);
12576         LDKBlindedPathCandidate blinded_var = obj->blinded;
12577                         uint64_t blinded_ref = 0;
12578                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
12579                         blinded_ref = tag_ptr(blinded_var.inner, false);
12580         return blinded_ref;
12581 }
12582 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_OneHopBlinded_get_one_hop_blinded"))) TS_LDKCandidateRouteHop_OneHopBlinded_get_one_hop_blinded(uint64_t ptr) {
12583         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
12584         assert(obj->tag == LDKCandidateRouteHop_OneHopBlinded);
12585         LDKOneHopBlindedPathCandidate one_hop_blinded_var = obj->one_hop_blinded;
12586                         uint64_t one_hop_blinded_ref = 0;
12587                         CHECK_INNER_FIELD_ACCESS_OR_NULL(one_hop_blinded_var);
12588                         one_hop_blinded_ref = tag_ptr(one_hop_blinded_var.inner, false);
12589         return one_hop_blinded_ref;
12590 }
12591 typedef struct LDKScoreLookUp_JCalls {
12592         atomic_size_t refcnt;
12593         uint32_t instance_ptr;
12594 } LDKScoreLookUp_JCalls;
12595 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
12596         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
12597         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12598                 FREE(j_calls);
12599         }
12600 }
12601 uint64_t channel_penalty_msat_LDKScoreLookUp_jcall(const void* this_arg, const LDKCandidateRouteHop * candidate, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
12602         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
12603         LDKCandidateRouteHop *ret_candidate = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop ret conversion");
12604         *ret_candidate = CandidateRouteHop_clone(candidate);
12605         uint64_t ref_candidate = tag_ptr(ret_candidate, true);
12606         LDKChannelUsage usage_var = usage;
12607         uint64_t usage_ref = 0;
12608         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
12609         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
12610         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
12611         uint64_t score_params_ref = 0;
12612         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
12613         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
12614         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
12615         return js_invoke_function_bbbuuu(j_calls->instance_ptr, 53, ref_candidate, usage_ref, score_params_ref, 0, 0, 0);
12616 }
12617 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
12618         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
12619         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12620 }
12621 static inline LDKScoreLookUp LDKScoreLookUp_init (JSValue o) {
12622         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
12623         atomic_init(&calls->refcnt, 1);
12624         calls->instance_ptr = o;
12625
12626         LDKScoreLookUp ret = {
12627                 .this_arg = (void*) calls,
12628                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
12629                 .free = LDKScoreLookUp_JCalls_free,
12630         };
12631         return ret;
12632 }
12633 uint64_t  __attribute__((export_name("TS_LDKScoreLookUp_new"))) TS_LDKScoreLookUp_new(JSValue o) {
12634         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
12635         *res_ptr = LDKScoreLookUp_init(o);
12636         return tag_ptr(res_ptr, true);
12637 }
12638 int64_t  __attribute__((export_name("TS_ScoreLookUp_channel_penalty_msat"))) TS_ScoreLookUp_channel_penalty_msat(uint64_t this_arg, uint64_t candidate, uint64_t usage, uint64_t score_params) {
12639         void* this_arg_ptr = untag_ptr(this_arg);
12640         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12641         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
12642         LDKCandidateRouteHop* candidate_conv = (LDKCandidateRouteHop*)untag_ptr(candidate);
12643         LDKChannelUsage usage_conv;
12644         usage_conv.inner = untag_ptr(usage);
12645         usage_conv.is_owned = ptr_is_owned(usage);
12646         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
12647         usage_conv = ChannelUsage_clone(&usage_conv);
12648         LDKProbabilisticScoringFeeParameters score_params_conv;
12649         score_params_conv.inner = untag_ptr(score_params);
12650         score_params_conv.is_owned = ptr_is_owned(score_params);
12651         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
12652         score_params_conv.is_owned = false;
12653         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, candidate_conv, usage_conv, &score_params_conv);
12654         return ret_conv;
12655 }
12656
12657 typedef struct LDKScoreUpdate_JCalls {
12658         atomic_size_t refcnt;
12659         uint32_t instance_ptr;
12660 } LDKScoreUpdate_JCalls;
12661 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
12662         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
12663         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12664                 FREE(j_calls);
12665         }
12666 }
12667 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
12668         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
12669         LDKPath path_var = *path;
12670         uint64_t path_ref = 0;
12671         path_var = Path_clone(&path_var);
12672         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12673         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
12674         int64_t short_channel_id_conv = short_channel_id;
12675         int64_t duration_since_epoch_conv = duration_since_epoch;
12676         js_invoke_function_bbbuuu(j_calls->instance_ptr, 54, path_ref, short_channel_id_conv, duration_since_epoch_conv, 0, 0, 0);
12677 }
12678 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
12679         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
12680         LDKPath path_var = *path;
12681         uint64_t path_ref = 0;
12682         path_var = Path_clone(&path_var);
12683         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12684         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
12685         int64_t duration_since_epoch_conv = duration_since_epoch;
12686         js_invoke_function_bbuuuu(j_calls->instance_ptr, 55, path_ref, duration_since_epoch_conv, 0, 0, 0, 0);
12687 }
12688 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
12689         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
12690         LDKPath path_var = *path;
12691         uint64_t path_ref = 0;
12692         path_var = Path_clone(&path_var);
12693         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12694         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
12695         int64_t short_channel_id_conv = short_channel_id;
12696         int64_t duration_since_epoch_conv = duration_since_epoch;
12697         js_invoke_function_bbbuuu(j_calls->instance_ptr, 56, path_ref, short_channel_id_conv, duration_since_epoch_conv, 0, 0, 0);
12698 }
12699 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
12700         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
12701         LDKPath path_var = *path;
12702         uint64_t path_ref = 0;
12703         path_var = Path_clone(&path_var);
12704         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12705         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
12706         int64_t duration_since_epoch_conv = duration_since_epoch;
12707         js_invoke_function_bbuuuu(j_calls->instance_ptr, 57, path_ref, duration_since_epoch_conv, 0, 0, 0, 0);
12708 }
12709 void time_passed_LDKScoreUpdate_jcall(void* this_arg, uint64_t duration_since_epoch) {
12710         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
12711         int64_t duration_since_epoch_conv = duration_since_epoch;
12712         js_invoke_function_buuuuu(j_calls->instance_ptr, 58, duration_since_epoch_conv, 0, 0, 0, 0, 0);
12713 }
12714 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
12715         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
12716         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12717 }
12718 static inline LDKScoreUpdate LDKScoreUpdate_init (JSValue o) {
12719         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
12720         atomic_init(&calls->refcnt, 1);
12721         calls->instance_ptr = o;
12722
12723         LDKScoreUpdate ret = {
12724                 .this_arg = (void*) calls,
12725                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
12726                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
12727                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
12728                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
12729                 .time_passed = time_passed_LDKScoreUpdate_jcall,
12730                 .free = LDKScoreUpdate_JCalls_free,
12731         };
12732         return ret;
12733 }
12734 uint64_t  __attribute__((export_name("TS_LDKScoreUpdate_new"))) TS_LDKScoreUpdate_new(JSValue o) {
12735         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
12736         *res_ptr = LDKScoreUpdate_init(o);
12737         return tag_ptr(res_ptr, true);
12738 }
12739 void  __attribute__((export_name("TS_ScoreUpdate_payment_path_failed"))) TS_ScoreUpdate_payment_path_failed(uint64_t this_arg, uint64_t path, int64_t short_channel_id, int64_t duration_since_epoch) {
12740         void* this_arg_ptr = untag_ptr(this_arg);
12741         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12742         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
12743         LDKPath path_conv;
12744         path_conv.inner = untag_ptr(path);
12745         path_conv.is_owned = ptr_is_owned(path);
12746         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
12747         path_conv.is_owned = false;
12748         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
12749 }
12750
12751 void  __attribute__((export_name("TS_ScoreUpdate_payment_path_successful"))) TS_ScoreUpdate_payment_path_successful(uint64_t this_arg, uint64_t path, int64_t duration_since_epoch) {
12752         void* this_arg_ptr = untag_ptr(this_arg);
12753         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12754         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
12755         LDKPath path_conv;
12756         path_conv.inner = untag_ptr(path);
12757         path_conv.is_owned = ptr_is_owned(path);
12758         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
12759         path_conv.is_owned = false;
12760         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
12761 }
12762
12763 void  __attribute__((export_name("TS_ScoreUpdate_probe_failed"))) TS_ScoreUpdate_probe_failed(uint64_t this_arg, uint64_t path, int64_t short_channel_id, int64_t duration_since_epoch) {
12764         void* this_arg_ptr = untag_ptr(this_arg);
12765         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12766         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
12767         LDKPath path_conv;
12768         path_conv.inner = untag_ptr(path);
12769         path_conv.is_owned = ptr_is_owned(path);
12770         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
12771         path_conv.is_owned = false;
12772         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
12773 }
12774
12775 void  __attribute__((export_name("TS_ScoreUpdate_probe_successful"))) TS_ScoreUpdate_probe_successful(uint64_t this_arg, uint64_t path, int64_t duration_since_epoch) {
12776         void* this_arg_ptr = untag_ptr(this_arg);
12777         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12778         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
12779         LDKPath path_conv;
12780         path_conv.inner = untag_ptr(path);
12781         path_conv.is_owned = ptr_is_owned(path);
12782         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
12783         path_conv.is_owned = false;
12784         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
12785 }
12786
12787 void  __attribute__((export_name("TS_ScoreUpdate_time_passed"))) TS_ScoreUpdate_time_passed(uint64_t this_arg, int64_t duration_since_epoch) {
12788         void* this_arg_ptr = untag_ptr(this_arg);
12789         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12790         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
12791         (this_arg_conv->time_passed)(this_arg_conv->this_arg, duration_since_epoch);
12792 }
12793
12794 typedef struct LDKLockableScore_JCalls {
12795         atomic_size_t refcnt;
12796         uint32_t instance_ptr;
12797 } LDKLockableScore_JCalls;
12798 static void LDKLockableScore_JCalls_free(void* this_arg) {
12799         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
12800         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12801                 FREE(j_calls);
12802         }
12803 }
12804 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
12805         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
12806         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 59, 0, 0, 0, 0, 0, 0);
12807         void* ret_ptr = untag_ptr(ret);
12808         CHECK_ACCESS(ret_ptr);
12809         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
12810         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
12811                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12812                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
12813         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
12814         
12815         return ret_conv;
12816 }
12817 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
12818         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
12819         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 60, 0, 0, 0, 0, 0, 0);
12820         void* ret_ptr = untag_ptr(ret);
12821         CHECK_ACCESS(ret_ptr);
12822         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
12823         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
12824                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12825                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
12826         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
12827         
12828         return ret_conv;
12829 }
12830 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
12831         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
12832         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12833 }
12834 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
12835         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
12836         atomic_init(&calls->refcnt, 1);
12837         calls->instance_ptr = o;
12838
12839         LDKLockableScore ret = {
12840                 .this_arg = (void*) calls,
12841                 .read_lock = read_lock_LDKLockableScore_jcall,
12842                 .write_lock = write_lock_LDKLockableScore_jcall,
12843                 .free = LDKLockableScore_JCalls_free,
12844         };
12845         return ret;
12846 }
12847 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
12848         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
12849         *res_ptr = LDKLockableScore_init(o);
12850         return tag_ptr(res_ptr, true);
12851 }
12852 uint64_t  __attribute__((export_name("TS_LockableScore_read_lock"))) TS_LockableScore_read_lock(uint64_t this_arg) {
12853         void* this_arg_ptr = untag_ptr(this_arg);
12854         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12855         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
12856         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
12857         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
12858         return tag_ptr(ret_ret, true);
12859 }
12860
12861 uint64_t  __attribute__((export_name("TS_LockableScore_write_lock"))) TS_LockableScore_write_lock(uint64_t this_arg) {
12862         void* this_arg_ptr = untag_ptr(this_arg);
12863         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12864         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
12865         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
12866         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
12867         return tag_ptr(ret_ret, true);
12868 }
12869
12870 typedef struct LDKWriteableScore_JCalls {
12871         atomic_size_t refcnt;
12872         uint32_t instance_ptr;
12873         LDKLockableScore_JCalls* LockableScore;
12874 } LDKWriteableScore_JCalls;
12875 static void LDKWriteableScore_JCalls_free(void* this_arg) {
12876         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
12877         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12878                 FREE(j_calls);
12879         }
12880 }
12881 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
12882         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
12883         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 61, 0, 0, 0, 0, 0, 0);
12884         LDKCVec_u8Z ret_ref;
12885         ret_ref.datalen = ret->arr_len;
12886         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
12887         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
12888         return ret_ref;
12889 }
12890 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
12891         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
12892         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12893         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
12894 }
12895 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
12896         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
12897         atomic_init(&calls->refcnt, 1);
12898         calls->instance_ptr = o;
12899
12900         LDKWriteableScore ret = {
12901                 .this_arg = (void*) calls,
12902                 .write = write_LDKWriteableScore_jcall,
12903                 .free = LDKWriteableScore_JCalls_free,
12904                 .LockableScore = LDKLockableScore_init(LockableScore),
12905         };
12906         calls->LockableScore = ret.LockableScore.this_arg;
12907         return ret;
12908 }
12909 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
12910         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
12911         *res_ptr = LDKWriteableScore_init(o, LockableScore);
12912         return tag_ptr(res_ptr, true);
12913 }
12914 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
12915         void* this_arg_ptr = untag_ptr(this_arg);
12916         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12917         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
12918         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
12919         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
12920         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
12921         CVec_u8Z_free(ret_var);
12922         return ret_arr;
12923 }
12924
12925 typedef struct LDKPersister_JCalls {
12926         atomic_size_t refcnt;
12927         uint32_t instance_ptr;
12928 } LDKPersister_JCalls;
12929 static void LDKPersister_JCalls_free(void* this_arg) {
12930         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
12931         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12932                 FREE(j_calls);
12933         }
12934 }
12935 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
12936         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
12937         LDKChannelManager channel_manager_var = *channel_manager;
12938         uint64_t channel_manager_ref = 0;
12939         // WARNING: we may need a move here but no clone is available for LDKChannelManager
12940         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
12941         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
12942         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 62, channel_manager_ref, 0, 0, 0, 0, 0);
12943         void* ret_ptr = untag_ptr(ret);
12944         CHECK_ACCESS(ret_ptr);
12945         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
12946         FREE(untag_ptr(ret));
12947         return ret_conv;
12948 }
12949 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
12950         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
12951         LDKNetworkGraph network_graph_var = *network_graph;
12952         uint64_t network_graph_ref = 0;
12953         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
12954         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
12955         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
12956         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 63, network_graph_ref, 0, 0, 0, 0, 0);
12957         void* ret_ptr = untag_ptr(ret);
12958         CHECK_ACCESS(ret_ptr);
12959         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
12960         FREE(untag_ptr(ret));
12961         return ret_conv;
12962 }
12963 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
12964         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
12965         // WARNING: This object doesn't live past this scope, needs clone!
12966         uint64_t ret_scorer = tag_ptr(scorer, false);
12967         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 64, ret_scorer, 0, 0, 0, 0, 0);
12968         void* ret_ptr = untag_ptr(ret);
12969         CHECK_ACCESS(ret_ptr);
12970         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
12971         FREE(untag_ptr(ret));
12972         return ret_conv;
12973 }
12974 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
12975         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
12976         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12977 }
12978 static inline LDKPersister LDKPersister_init (JSValue o) {
12979         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
12980         atomic_init(&calls->refcnt, 1);
12981         calls->instance_ptr = o;
12982
12983         LDKPersister ret = {
12984                 .this_arg = (void*) calls,
12985                 .persist_manager = persist_manager_LDKPersister_jcall,
12986                 .persist_graph = persist_graph_LDKPersister_jcall,
12987                 .persist_scorer = persist_scorer_LDKPersister_jcall,
12988                 .free = LDKPersister_JCalls_free,
12989         };
12990         return ret;
12991 }
12992 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
12993         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
12994         *res_ptr = LDKPersister_init(o);
12995         return tag_ptr(res_ptr, true);
12996 }
12997 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
12998         void* this_arg_ptr = untag_ptr(this_arg);
12999         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13000         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
13001         LDKChannelManager channel_manager_conv;
13002         channel_manager_conv.inner = untag_ptr(channel_manager);
13003         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
13004         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
13005         channel_manager_conv.is_owned = false;
13006         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13007         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
13008         return tag_ptr(ret_conv, true);
13009 }
13010
13011 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
13012         void* this_arg_ptr = untag_ptr(this_arg);
13013         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13014         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
13015         LDKNetworkGraph network_graph_conv;
13016         network_graph_conv.inner = untag_ptr(network_graph);
13017         network_graph_conv.is_owned = ptr_is_owned(network_graph);
13018         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
13019         network_graph_conv.is_owned = false;
13020         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13021         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
13022         return tag_ptr(ret_conv, true);
13023 }
13024
13025 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
13026         void* this_arg_ptr = untag_ptr(this_arg);
13027         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13028         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
13029         void* scorer_ptr = untag_ptr(scorer);
13030         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
13031         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
13032         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13033         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
13034         return tag_ptr(ret_conv, true);
13035 }
13036
13037 typedef struct LDKPersist_JCalls {
13038         atomic_size_t refcnt;
13039         uint32_t instance_ptr;
13040 } LDKPersist_JCalls;
13041 static void LDKPersist_JCalls_free(void* this_arg) {
13042         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
13043         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13044                 FREE(j_calls);
13045         }
13046 }
13047 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
13048         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
13049         LDKOutPoint channel_id_var = channel_id;
13050         uint64_t channel_id_ref = 0;
13051         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
13052         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
13053         LDKChannelMonitor data_var = *data;
13054         uint64_t data_ref = 0;
13055         data_var = ChannelMonitor_clone(&data_var);
13056         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
13057         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
13058         LDKMonitorUpdateId update_id_var = update_id;
13059         uint64_t update_id_ref = 0;
13060         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
13061         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
13062         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 65, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
13063         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
13064         return ret_conv;
13065 }
13066 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
13067         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
13068         LDKOutPoint channel_id_var = channel_id;
13069         uint64_t channel_id_ref = 0;
13070         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
13071         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
13072         LDKChannelMonitorUpdate update_var = update;
13073         uint64_t update_ref = 0;
13074         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
13075         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
13076         LDKChannelMonitor data_var = *data;
13077         uint64_t data_ref = 0;
13078         data_var = ChannelMonitor_clone(&data_var);
13079         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
13080         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
13081         LDKMonitorUpdateId update_id_var = update_id;
13082         uint64_t update_id_ref = 0;
13083         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
13084         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
13085         uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 66, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
13086         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
13087         return ret_conv;
13088 }
13089 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
13090         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
13091         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13092 }
13093 static inline LDKPersist LDKPersist_init (JSValue o) {
13094         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
13095         atomic_init(&calls->refcnt, 1);
13096         calls->instance_ptr = o;
13097
13098         LDKPersist ret = {
13099                 .this_arg = (void*) calls,
13100                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
13101                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
13102                 .free = LDKPersist_JCalls_free,
13103         };
13104         return ret;
13105 }
13106 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
13107         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
13108         *res_ptr = LDKPersist_init(o);
13109         return tag_ptr(res_ptr, true);
13110 }
13111 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) {
13112         void* this_arg_ptr = untag_ptr(this_arg);
13113         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13114         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
13115         LDKOutPoint channel_id_conv;
13116         channel_id_conv.inner = untag_ptr(channel_id);
13117         channel_id_conv.is_owned = ptr_is_owned(channel_id);
13118         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
13119         channel_id_conv = OutPoint_clone(&channel_id_conv);
13120         LDKChannelMonitor data_conv;
13121         data_conv.inner = untag_ptr(data);
13122         data_conv.is_owned = ptr_is_owned(data);
13123         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
13124         data_conv.is_owned = false;
13125         LDKMonitorUpdateId update_id_conv;
13126         update_id_conv.inner = untag_ptr(update_id);
13127         update_id_conv.is_owned = ptr_is_owned(update_id);
13128         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
13129         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
13130         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));
13131         return ret_conv;
13132 }
13133
13134 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) {
13135         void* this_arg_ptr = untag_ptr(this_arg);
13136         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13137         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
13138         LDKOutPoint channel_id_conv;
13139         channel_id_conv.inner = untag_ptr(channel_id);
13140         channel_id_conv.is_owned = ptr_is_owned(channel_id);
13141         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
13142         channel_id_conv = OutPoint_clone(&channel_id_conv);
13143         LDKChannelMonitorUpdate update_conv;
13144         update_conv.inner = untag_ptr(update);
13145         update_conv.is_owned = ptr_is_owned(update);
13146         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
13147         update_conv = ChannelMonitorUpdate_clone(&update_conv);
13148         LDKChannelMonitor data_conv;
13149         data_conv.inner = untag_ptr(data);
13150         data_conv.is_owned = ptr_is_owned(data);
13151         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
13152         data_conv.is_owned = false;
13153         LDKMonitorUpdateId update_id_conv;
13154         update_id_conv.inner = untag_ptr(update_id);
13155         update_id_conv.is_owned = ptr_is_owned(update_id);
13156         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
13157         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
13158         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));
13159         return ret_conv;
13160 }
13161
13162 typedef struct LDKFutureCallback_JCalls {
13163         atomic_size_t refcnt;
13164         uint32_t instance_ptr;
13165 } LDKFutureCallback_JCalls;
13166 static void LDKFutureCallback_JCalls_free(void* this_arg) {
13167         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
13168         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13169                 FREE(j_calls);
13170         }
13171 }
13172 void call_LDKFutureCallback_jcall(const void* this_arg) {
13173         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
13174         js_invoke_function_uuuuuu(j_calls->instance_ptr, 67, 0, 0, 0, 0, 0, 0);
13175 }
13176 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
13177         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
13178         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13179 }
13180 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
13181         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
13182         atomic_init(&calls->refcnt, 1);
13183         calls->instance_ptr = o;
13184
13185         LDKFutureCallback ret = {
13186                 .this_arg = (void*) calls,
13187                 .call = call_LDKFutureCallback_jcall,
13188                 .free = LDKFutureCallback_JCalls_free,
13189         };
13190         return ret;
13191 }
13192 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
13193         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
13194         *res_ptr = LDKFutureCallback_init(o);
13195         return tag_ptr(res_ptr, true);
13196 }
13197 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
13198         void* this_arg_ptr = untag_ptr(this_arg);
13199         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13200         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
13201         (this_arg_conv->call)(this_arg_conv->this_arg);
13202 }
13203
13204 typedef struct LDKListen_JCalls {
13205         atomic_size_t refcnt;
13206         uint32_t instance_ptr;
13207 } LDKListen_JCalls;
13208 static void LDKListen_JCalls_free(void* this_arg) {
13209         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
13210         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13211                 FREE(j_calls);
13212         }
13213 }
13214 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
13215         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
13216         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
13217         memcpy(header_arr->elems, *header, 80);
13218         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
13219         uint64_tArray txdata_arr = NULL;
13220         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
13221         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
13222         for (size_t c = 0; c < txdata_var.datalen; c++) {
13223                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13224                 *txdata_conv_28_conv = txdata_var.data[c];
13225                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
13226         }
13227         
13228         FREE(txdata_var.data);
13229         int32_t height_conv = height;
13230         js_invoke_function_uuuuuu(j_calls->instance_ptr, 68, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
13231 }
13232 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
13233         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
13234         LDKu8slice block_var = block;
13235         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
13236         memcpy(block_arr->elems, block_var.data, block_var.datalen);
13237         int32_t height_conv = height;
13238         js_invoke_function_uuuuuu(j_calls->instance_ptr, 69, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
13239 }
13240 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
13241         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
13242         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
13243         memcpy(header_arr->elems, *header, 80);
13244         int32_t height_conv = height;
13245         js_invoke_function_uuuuuu(j_calls->instance_ptr, 70, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
13246 }
13247 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
13248         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
13249         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13250 }
13251 static inline LDKListen LDKListen_init (JSValue o) {
13252         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
13253         atomic_init(&calls->refcnt, 1);
13254         calls->instance_ptr = o;
13255
13256         LDKListen ret = {
13257                 .this_arg = (void*) calls,
13258                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
13259                 .block_connected = block_connected_LDKListen_jcall,
13260                 .block_disconnected = block_disconnected_LDKListen_jcall,
13261                 .free = LDKListen_JCalls_free,
13262         };
13263         return ret;
13264 }
13265 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
13266         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
13267         *res_ptr = LDKListen_init(o);
13268         return tag_ptr(res_ptr, true);
13269 }
13270 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) {
13271         void* this_arg_ptr = untag_ptr(this_arg);
13272         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13273         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
13274         uint8_t header_arr[80];
13275         CHECK(header->arr_len == 80);
13276         memcpy(header_arr, header->elems, 80); FREE(header);
13277         uint8_t (*header_ref)[80] = &header_arr;
13278         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
13279         txdata_constr.datalen = txdata->arr_len;
13280         if (txdata_constr.datalen > 0)
13281                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13282         else
13283                 txdata_constr.data = NULL;
13284         uint64_t* txdata_vals = txdata->elems;
13285         for (size_t c = 0; c < txdata_constr.datalen; c++) {
13286                 uint64_t txdata_conv_28 = txdata_vals[c];
13287                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
13288                 CHECK_ACCESS(txdata_conv_28_ptr);
13289                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
13290                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
13291                 txdata_constr.data[c] = txdata_conv_28_conv;
13292         }
13293         FREE(txdata);
13294         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
13295 }
13296
13297 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
13298         void* this_arg_ptr = untag_ptr(this_arg);
13299         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13300         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
13301         LDKu8slice block_ref;
13302         block_ref.datalen = block->arr_len;
13303         block_ref.data = block->elems;
13304         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
13305         FREE(block);
13306 }
13307
13308 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
13309         void* this_arg_ptr = untag_ptr(this_arg);
13310         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13311         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
13312         uint8_t header_arr[80];
13313         CHECK(header->arr_len == 80);
13314         memcpy(header_arr, header->elems, 80); FREE(header);
13315         uint8_t (*header_ref)[80] = &header_arr;
13316         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
13317 }
13318
13319 typedef struct LDKConfirm_JCalls {
13320         atomic_size_t refcnt;
13321         uint32_t instance_ptr;
13322 } LDKConfirm_JCalls;
13323 static void LDKConfirm_JCalls_free(void* this_arg) {
13324         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13325         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13326                 FREE(j_calls);
13327         }
13328 }
13329 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
13330         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13331         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
13332         memcpy(header_arr->elems, *header, 80);
13333         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
13334         uint64_tArray txdata_arr = NULL;
13335         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
13336         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
13337         for (size_t c = 0; c < txdata_var.datalen; c++) {
13338                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13339                 *txdata_conv_28_conv = txdata_var.data[c];
13340                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
13341         }
13342         
13343         FREE(txdata_var.data);
13344         int32_t height_conv = height;
13345         js_invoke_function_uuuuuu(j_calls->instance_ptr, 71, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
13346 }
13347 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
13348         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13349         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
13350         memcpy(txid_arr->elems, *txid, 32);
13351         js_invoke_function_uuuuuu(j_calls->instance_ptr, 72, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
13352 }
13353 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
13354         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13355         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
13356         memcpy(header_arr->elems, *header, 80);
13357         int32_t height_conv = height;
13358         js_invoke_function_uuuuuu(j_calls->instance_ptr, 73, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
13359 }
13360 LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
13361         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13362         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 74, 0, 0, 0, 0, 0, 0);
13363         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_constr;
13364         ret_constr.datalen = ret->arr_len;
13365         if (ret_constr.datalen > 0)
13366                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
13367         else
13368                 ret_constr.data = NULL;
13369         uint64_t* ret_vals = ret->elems;
13370         for (size_t c = 0; c < ret_constr.datalen; c++) {
13371                 uint64_t ret_conv_54 = ret_vals[c];
13372                 void* ret_conv_54_ptr = untag_ptr(ret_conv_54);
13373                 CHECK_ACCESS(ret_conv_54_ptr);
13374                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ ret_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(ret_conv_54_ptr);
13375                 FREE(untag_ptr(ret_conv_54));
13376                 ret_constr.data[c] = ret_conv_54_conv;
13377         }
13378         FREE(ret);
13379         return ret_constr;
13380 }
13381 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
13382         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
13383         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13384 }
13385 static inline LDKConfirm LDKConfirm_init (JSValue o) {
13386         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
13387         atomic_init(&calls->refcnt, 1);
13388         calls->instance_ptr = o;
13389
13390         LDKConfirm ret = {
13391                 .this_arg = (void*) calls,
13392                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
13393                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
13394                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
13395                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
13396                 .free = LDKConfirm_JCalls_free,
13397         };
13398         return ret;
13399 }
13400 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
13401         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
13402         *res_ptr = LDKConfirm_init(o);
13403         return tag_ptr(res_ptr, true);
13404 }
13405 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) {
13406         void* this_arg_ptr = untag_ptr(this_arg);
13407         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13408         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
13409         uint8_t header_arr[80];
13410         CHECK(header->arr_len == 80);
13411         memcpy(header_arr, header->elems, 80); FREE(header);
13412         uint8_t (*header_ref)[80] = &header_arr;
13413         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
13414         txdata_constr.datalen = txdata->arr_len;
13415         if (txdata_constr.datalen > 0)
13416                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13417         else
13418                 txdata_constr.data = NULL;
13419         uint64_t* txdata_vals = txdata->elems;
13420         for (size_t c = 0; c < txdata_constr.datalen; c++) {
13421                 uint64_t txdata_conv_28 = txdata_vals[c];
13422                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
13423                 CHECK_ACCESS(txdata_conv_28_ptr);
13424                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
13425                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
13426                 txdata_constr.data[c] = txdata_conv_28_conv;
13427         }
13428         FREE(txdata);
13429         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
13430 }
13431
13432 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
13433         void* this_arg_ptr = untag_ptr(this_arg);
13434         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13435         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
13436         uint8_t txid_arr[32];
13437         CHECK(txid->arr_len == 32);
13438         memcpy(txid_arr, txid->elems, 32); FREE(txid);
13439         uint8_t (*txid_ref)[32] = &txid_arr;
13440         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
13441 }
13442
13443 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
13444         void* this_arg_ptr = untag_ptr(this_arg);
13445         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13446         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
13447         uint8_t header_arr[80];
13448         CHECK(header->arr_len == 80);
13449         memcpy(header_arr, header->elems, 80); FREE(header);
13450         uint8_t (*header_ref)[80] = &header_arr;
13451         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
13452 }
13453
13454 uint64_tArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
13455         void* this_arg_ptr = untag_ptr(this_arg);
13456         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13457         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
13458         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
13459         uint64_tArray ret_arr = NULL;
13460         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
13461         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
13462         for (size_t c = 0; c < ret_var.datalen; c++) {
13463                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
13464                 *ret_conv_54_conv = ret_var.data[c];
13465                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
13466         }
13467         
13468         FREE(ret_var.data);
13469         return ret_arr;
13470 }
13471
13472 typedef struct LDKEventHandler_JCalls {
13473         atomic_size_t refcnt;
13474         uint32_t instance_ptr;
13475 } LDKEventHandler_JCalls;
13476 static void LDKEventHandler_JCalls_free(void* this_arg) {
13477         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
13478         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13479                 FREE(j_calls);
13480         }
13481 }
13482 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
13483         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
13484         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13485         *event_copy = event;
13486         uint64_t event_ref = tag_ptr(event_copy, true);
13487         js_invoke_function_buuuuu(j_calls->instance_ptr, 75, event_ref, 0, 0, 0, 0, 0);
13488 }
13489 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
13490         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
13491         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13492 }
13493 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
13494         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
13495         atomic_init(&calls->refcnt, 1);
13496         calls->instance_ptr = o;
13497
13498         LDKEventHandler ret = {
13499                 .this_arg = (void*) calls,
13500                 .handle_event = handle_event_LDKEventHandler_jcall,
13501                 .free = LDKEventHandler_JCalls_free,
13502         };
13503         return ret;
13504 }
13505 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
13506         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
13507         *res_ptr = LDKEventHandler_init(o);
13508         return tag_ptr(res_ptr, true);
13509 }
13510 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
13511         void* this_arg_ptr = untag_ptr(this_arg);
13512         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13513         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
13514         void* event_ptr = untag_ptr(event);
13515         CHECK_ACCESS(event_ptr);
13516         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
13517         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
13518         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
13519 }
13520
13521 typedef struct LDKEventsProvider_JCalls {
13522         atomic_size_t refcnt;
13523         uint32_t instance_ptr;
13524 } LDKEventsProvider_JCalls;
13525 static void LDKEventsProvider_JCalls_free(void* this_arg) {
13526         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
13527         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13528                 FREE(j_calls);
13529         }
13530 }
13531 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
13532         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
13533         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
13534         *handler_ret = handler;
13535         js_invoke_function_buuuuu(j_calls->instance_ptr, 76, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
13536 }
13537 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
13538         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
13539         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13540 }
13541 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
13542         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
13543         atomic_init(&calls->refcnt, 1);
13544         calls->instance_ptr = o;
13545
13546         LDKEventsProvider ret = {
13547                 .this_arg = (void*) calls,
13548                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
13549                 .free = LDKEventsProvider_JCalls_free,
13550         };
13551         return ret;
13552 }
13553 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
13554         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
13555         *res_ptr = LDKEventsProvider_init(o);
13556         return tag_ptr(res_ptr, true);
13557 }
13558 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
13559         void* this_arg_ptr = untag_ptr(this_arg);
13560         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13561         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
13562         void* handler_ptr = untag_ptr(handler);
13563         CHECK_ACCESS(handler_ptr);
13564         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
13565         if (handler_conv.free == LDKEventHandler_JCalls_free) {
13566                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13567                 LDKEventHandler_JCalls_cloned(&handler_conv);
13568         }
13569         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
13570 }
13571
13572 uint32_t __attribute__((export_name("TS_LDKFailureCode_ty_from_ptr"))) TS_LDKFailureCode_ty_from_ptr(uint64_t ptr) {
13573         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
13574         switch(obj->tag) {
13575                 case LDKFailureCode_TemporaryNodeFailure: return 0;
13576                 case LDKFailureCode_RequiredNodeFeatureMissing: return 1;
13577                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: return 2;
13578                 case LDKFailureCode_InvalidOnionPayload: return 3;
13579                 default: abort();
13580         }
13581 }
13582 uint64_t __attribute__((export_name("TS_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload"))) TS_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload(uint64_t ptr) {
13583         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
13584         assert(obj->tag == LDKFailureCode_InvalidOnionPayload);
13585         uint64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
13586         return invalid_onion_payload_ref;
13587 }
13588 typedef struct LDKMessageSendEventsProvider_JCalls {
13589         atomic_size_t refcnt;
13590         uint32_t instance_ptr;
13591 } LDKMessageSendEventsProvider_JCalls;
13592 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
13593         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
13594         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13595                 FREE(j_calls);
13596         }
13597 }
13598 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
13599         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
13600         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 77, 0, 0, 0, 0, 0, 0);
13601         LDKCVec_MessageSendEventZ ret_constr;
13602         ret_constr.datalen = ret->arr_len;
13603         if (ret_constr.datalen > 0)
13604                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
13605         else
13606                 ret_constr.data = NULL;
13607         uint64_t* ret_vals = ret->elems;
13608         for (size_t s = 0; s < ret_constr.datalen; s++) {
13609                 uint64_t ret_conv_18 = ret_vals[s];
13610                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
13611                 CHECK_ACCESS(ret_conv_18_ptr);
13612                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
13613                 FREE(untag_ptr(ret_conv_18));
13614                 ret_constr.data[s] = ret_conv_18_conv;
13615         }
13616         FREE(ret);
13617         return ret_constr;
13618 }
13619 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
13620         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
13621         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13622 }
13623 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
13624         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
13625         atomic_init(&calls->refcnt, 1);
13626         calls->instance_ptr = o;
13627
13628         LDKMessageSendEventsProvider ret = {
13629                 .this_arg = (void*) calls,
13630                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
13631                 .free = LDKMessageSendEventsProvider_JCalls_free,
13632         };
13633         return ret;
13634 }
13635 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
13636         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
13637         *res_ptr = LDKMessageSendEventsProvider_init(o);
13638         return tag_ptr(res_ptr, true);
13639 }
13640 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) {
13641         void* this_arg_ptr = untag_ptr(this_arg);
13642         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13643         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
13644         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
13645         uint64_tArray ret_arr = NULL;
13646         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
13647         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
13648         for (size_t s = 0; s < ret_var.datalen; s++) {
13649                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13650                 *ret_conv_18_copy = ret_var.data[s];
13651                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
13652                 ret_arr_ptr[s] = ret_conv_18_ref;
13653         }
13654         
13655         FREE(ret_var.data);
13656         return ret_arr;
13657 }
13658
13659 typedef struct LDKChannelMessageHandler_JCalls {
13660         atomic_size_t refcnt;
13661         uint32_t instance_ptr;
13662         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
13663 } LDKChannelMessageHandler_JCalls;
13664 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
13665         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13666         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13667                 FREE(j_calls);
13668         }
13669 }
13670 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
13671         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13672         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13673         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13674         LDKOpenChannel msg_var = *msg;
13675         uint64_t msg_ref = 0;
13676         msg_var = OpenChannel_clone(&msg_var);
13677         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13678         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13679         js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13680 }
13681 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
13682         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13683         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13684         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13685         LDKOpenChannelV2 msg_var = *msg;
13686         uint64_t msg_ref = 0;
13687         msg_var = OpenChannelV2_clone(&msg_var);
13688         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13689         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13690         js_invoke_function_ubuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13691 }
13692 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
13693         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13694         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13695         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13696         LDKAcceptChannel msg_var = *msg;
13697         uint64_t msg_ref = 0;
13698         msg_var = AcceptChannel_clone(&msg_var);
13699         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13700         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13701         js_invoke_function_ubuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13702 }
13703 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
13704         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13705         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13706         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13707         LDKAcceptChannelV2 msg_var = *msg;
13708         uint64_t msg_ref = 0;
13709         msg_var = AcceptChannelV2_clone(&msg_var);
13710         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13711         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13712         js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13713 }
13714 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
13715         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13716         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13717         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13718         LDKFundingCreated msg_var = *msg;
13719         uint64_t msg_ref = 0;
13720         msg_var = FundingCreated_clone(&msg_var);
13721         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13722         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13723         js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13724 }
13725 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
13726         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13727         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13728         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13729         LDKFundingSigned msg_var = *msg;
13730         uint64_t msg_ref = 0;
13731         msg_var = FundingSigned_clone(&msg_var);
13732         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13733         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13734         js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13735 }
13736 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
13737         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13738         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13739         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13740         LDKChannelReady msg_var = *msg;
13741         uint64_t msg_ref = 0;
13742         msg_var = ChannelReady_clone(&msg_var);
13743         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13744         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13745         js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13746 }
13747 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
13748         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13749         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13750         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13751         LDKShutdown msg_var = *msg;
13752         uint64_t msg_ref = 0;
13753         msg_var = Shutdown_clone(&msg_var);
13754         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13755         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13756         js_invoke_function_ubuuuu(j_calls->instance_ptr, 85, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13757 }
13758 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
13759         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13760         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13761         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13762         LDKClosingSigned msg_var = *msg;
13763         uint64_t msg_ref = 0;
13764         msg_var = ClosingSigned_clone(&msg_var);
13765         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13766         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13767         js_invoke_function_ubuuuu(j_calls->instance_ptr, 86, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13768 }
13769 void handle_stfu_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKStfu * msg) {
13770         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13771         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13772         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13773         LDKStfu msg_var = *msg;
13774         uint64_t msg_ref = 0;
13775         msg_var = Stfu_clone(&msg_var);
13776         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13777         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13778         js_invoke_function_ubuuuu(j_calls->instance_ptr, 87, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13779 }
13780 void handle_splice_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKSplice * msg) {
13781         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13782         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13783         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13784         LDKSplice msg_var = *msg;
13785         uint64_t msg_ref = 0;
13786         msg_var = Splice_clone(&msg_var);
13787         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13788         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13789         js_invoke_function_ubuuuu(j_calls->instance_ptr, 88, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13790 }
13791 void handle_splice_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKSpliceAck * msg) {
13792         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13793         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13794         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13795         LDKSpliceAck msg_var = *msg;
13796         uint64_t msg_ref = 0;
13797         msg_var = SpliceAck_clone(&msg_var);
13798         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13799         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13800         js_invoke_function_ubuuuu(j_calls->instance_ptr, 89, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13801 }
13802 void handle_splice_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKSpliceLocked * msg) {
13803         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13804         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13805         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13806         LDKSpliceLocked msg_var = *msg;
13807         uint64_t msg_ref = 0;
13808         msg_var = SpliceLocked_clone(&msg_var);
13809         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13810         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13811         js_invoke_function_ubuuuu(j_calls->instance_ptr, 90, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13812 }
13813 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
13814         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13815         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13816         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13817         LDKTxAddInput msg_var = *msg;
13818         uint64_t msg_ref = 0;
13819         msg_var = TxAddInput_clone(&msg_var);
13820         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13821         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13822         js_invoke_function_ubuuuu(j_calls->instance_ptr, 91, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13823 }
13824 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
13825         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13826         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13827         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13828         LDKTxAddOutput msg_var = *msg;
13829         uint64_t msg_ref = 0;
13830         msg_var = TxAddOutput_clone(&msg_var);
13831         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13832         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13833         js_invoke_function_ubuuuu(j_calls->instance_ptr, 92, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13834 }
13835 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
13836         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13837         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13838         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13839         LDKTxRemoveInput msg_var = *msg;
13840         uint64_t msg_ref = 0;
13841         msg_var = TxRemoveInput_clone(&msg_var);
13842         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13843         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13844         js_invoke_function_ubuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13845 }
13846 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
13847         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13848         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13849         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13850         LDKTxRemoveOutput msg_var = *msg;
13851         uint64_t msg_ref = 0;
13852         msg_var = TxRemoveOutput_clone(&msg_var);
13853         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13854         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13855         js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13856 }
13857 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
13858         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13859         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13860         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13861         LDKTxComplete msg_var = *msg;
13862         uint64_t msg_ref = 0;
13863         msg_var = TxComplete_clone(&msg_var);
13864         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13865         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13866         js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13867 }
13868 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
13869         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13870         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13871         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13872         LDKTxSignatures msg_var = *msg;
13873         uint64_t msg_ref = 0;
13874         msg_var = TxSignatures_clone(&msg_var);
13875         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13876         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13877         js_invoke_function_ubuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13878 }
13879 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
13880         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13881         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13882         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13883         LDKTxInitRbf msg_var = *msg;
13884         uint64_t msg_ref = 0;
13885         msg_var = TxInitRbf_clone(&msg_var);
13886         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13887         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13888         js_invoke_function_ubuuuu(j_calls->instance_ptr, 97, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13889 }
13890 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
13891         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13892         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13893         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13894         LDKTxAckRbf msg_var = *msg;
13895         uint64_t msg_ref = 0;
13896         msg_var = TxAckRbf_clone(&msg_var);
13897         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13898         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13899         js_invoke_function_ubuuuu(j_calls->instance_ptr, 98, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13900 }
13901 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
13902         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13903         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13904         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13905         LDKTxAbort msg_var = *msg;
13906         uint64_t msg_ref = 0;
13907         msg_var = TxAbort_clone(&msg_var);
13908         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13909         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13910         js_invoke_function_ubuuuu(j_calls->instance_ptr, 99, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13911 }
13912 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
13913         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13914         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13915         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13916         LDKUpdateAddHTLC msg_var = *msg;
13917         uint64_t msg_ref = 0;
13918         msg_var = UpdateAddHTLC_clone(&msg_var);
13919         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13920         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13921         js_invoke_function_ubuuuu(j_calls->instance_ptr, 100, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13922 }
13923 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
13924         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13925         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13926         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13927         LDKUpdateFulfillHTLC msg_var = *msg;
13928         uint64_t msg_ref = 0;
13929         msg_var = UpdateFulfillHTLC_clone(&msg_var);
13930         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13931         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13932         js_invoke_function_ubuuuu(j_calls->instance_ptr, 101, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13933 }
13934 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
13935         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13936         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13937         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13938         LDKUpdateFailHTLC msg_var = *msg;
13939         uint64_t msg_ref = 0;
13940         msg_var = UpdateFailHTLC_clone(&msg_var);
13941         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13942         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13943         js_invoke_function_ubuuuu(j_calls->instance_ptr, 102, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13944 }
13945 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
13946         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13947         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13948         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13949         LDKUpdateFailMalformedHTLC msg_var = *msg;
13950         uint64_t msg_ref = 0;
13951         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
13952         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13953         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13954         js_invoke_function_ubuuuu(j_calls->instance_ptr, 103, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13955 }
13956 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
13957         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13958         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13959         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13960         LDKCommitmentSigned msg_var = *msg;
13961         uint64_t msg_ref = 0;
13962         msg_var = CommitmentSigned_clone(&msg_var);
13963         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13964         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13965         js_invoke_function_ubuuuu(j_calls->instance_ptr, 104, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13966 }
13967 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
13968         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13969         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13970         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13971         LDKRevokeAndACK msg_var = *msg;
13972         uint64_t msg_ref = 0;
13973         msg_var = RevokeAndACK_clone(&msg_var);
13974         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13975         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13976         js_invoke_function_ubuuuu(j_calls->instance_ptr, 105, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13977 }
13978 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
13979         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13980         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13981         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13982         LDKUpdateFee msg_var = *msg;
13983         uint64_t msg_ref = 0;
13984         msg_var = UpdateFee_clone(&msg_var);
13985         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13986         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13987         js_invoke_function_ubuuuu(j_calls->instance_ptr, 106, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13988 }
13989 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
13990         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13991         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13992         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13993         LDKAnnouncementSignatures msg_var = *msg;
13994         uint64_t msg_ref = 0;
13995         msg_var = AnnouncementSignatures_clone(&msg_var);
13996         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13997         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13998         js_invoke_function_ubuuuu(j_calls->instance_ptr, 107, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13999 }
14000 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14001         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14002         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14003         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14004         js_invoke_function_uuuuuu(j_calls->instance_ptr, 108, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
14005 }
14006 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
14007         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14008         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14009         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14010         LDKInit msg_var = *msg;
14011         uint64_t msg_ref = 0;
14012         msg_var = Init_clone(&msg_var);
14013         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14014         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14015         jboolean inbound_conv = inbound;
14016         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 109, (uint32_t)their_node_id_arr, msg_ref, inbound_conv, 0, 0, 0);
14017         void* ret_ptr = untag_ptr(ret);
14018         CHECK_ACCESS(ret_ptr);
14019         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
14020         FREE(untag_ptr(ret));
14021         return ret_conv;
14022 }
14023 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
14024         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14025         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14026         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14027         LDKChannelReestablish msg_var = *msg;
14028         uint64_t msg_ref = 0;
14029         msg_var = ChannelReestablish_clone(&msg_var);
14030         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14031         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14032         js_invoke_function_ubuuuu(j_calls->instance_ptr, 110, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
14033 }
14034 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
14035         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14036         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14037         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14038         LDKChannelUpdate msg_var = *msg;
14039         uint64_t msg_ref = 0;
14040         msg_var = ChannelUpdate_clone(&msg_var);
14041         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14042         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14043         js_invoke_function_ubuuuu(j_calls->instance_ptr, 111, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
14044 }
14045 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
14046         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14047         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14048         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14049         LDKErrorMessage msg_var = *msg;
14050         uint64_t msg_ref = 0;
14051         msg_var = ErrorMessage_clone(&msg_var);
14052         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14053         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14054         js_invoke_function_ubuuuu(j_calls->instance_ptr, 112, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
14055 }
14056 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
14057         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14058         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 113, 0, 0, 0, 0, 0, 0);
14059         LDKNodeFeatures ret_conv;
14060         ret_conv.inner = untag_ptr(ret);
14061         ret_conv.is_owned = ptr_is_owned(ret);
14062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14063         return ret_conv;
14064 }
14065 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14066         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14067         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14068         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14069         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 114, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
14070         LDKInitFeatures ret_conv;
14071         ret_conv.inner = untag_ptr(ret);
14072         ret_conv.is_owned = ptr_is_owned(ret);
14073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14074         return ret_conv;
14075 }
14076 LDKCOption_CVec_ThirtyTwoBytesZZ get_chain_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
14077         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14078         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 115, 0, 0, 0, 0, 0, 0);
14079         void* ret_ptr = untag_ptr(ret);
14080         CHECK_ACCESS(ret_ptr);
14081         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
14082         FREE(untag_ptr(ret));
14083         return ret_conv;
14084 }
14085 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
14086         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
14087         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14088         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
14089 }
14090 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
14091         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
14092         atomic_init(&calls->refcnt, 1);
14093         calls->instance_ptr = o;
14094
14095         LDKChannelMessageHandler ret = {
14096                 .this_arg = (void*) calls,
14097                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
14098                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
14099                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
14100                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
14101                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
14102                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
14103                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
14104                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
14105                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
14106                 .handle_stfu = handle_stfu_LDKChannelMessageHandler_jcall,
14107                 .handle_splice = handle_splice_LDKChannelMessageHandler_jcall,
14108                 .handle_splice_ack = handle_splice_ack_LDKChannelMessageHandler_jcall,
14109                 .handle_splice_locked = handle_splice_locked_LDKChannelMessageHandler_jcall,
14110                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
14111                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
14112                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
14113                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
14114                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
14115                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
14116                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
14117                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
14118                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
14119                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
14120                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
14121                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
14122                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
14123                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
14124                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
14125                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
14126                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
14127                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
14128                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
14129                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
14130                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
14131                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
14132                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
14133                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
14134                 .get_chain_hashes = get_chain_hashes_LDKChannelMessageHandler_jcall,
14135                 .free = LDKChannelMessageHandler_JCalls_free,
14136                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
14137         };
14138         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
14139         return ret;
14140 }
14141 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
14142         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
14143         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
14144         return tag_ptr(res_ptr, true);
14145 }
14146 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) {
14147         void* this_arg_ptr = untag_ptr(this_arg);
14148         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14149         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14150         LDKPublicKey their_node_id_ref;
14151         CHECK(their_node_id->arr_len == 33);
14152         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14153         LDKOpenChannel msg_conv;
14154         msg_conv.inner = untag_ptr(msg);
14155         msg_conv.is_owned = ptr_is_owned(msg);
14156         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14157         msg_conv.is_owned = false;
14158         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14159 }
14160
14161 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) {
14162         void* this_arg_ptr = untag_ptr(this_arg);
14163         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14164         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14165         LDKPublicKey their_node_id_ref;
14166         CHECK(their_node_id->arr_len == 33);
14167         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14168         LDKOpenChannelV2 msg_conv;
14169         msg_conv.inner = untag_ptr(msg);
14170         msg_conv.is_owned = ptr_is_owned(msg);
14171         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14172         msg_conv.is_owned = false;
14173         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14174 }
14175
14176 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) {
14177         void* this_arg_ptr = untag_ptr(this_arg);
14178         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14179         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14180         LDKPublicKey their_node_id_ref;
14181         CHECK(their_node_id->arr_len == 33);
14182         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14183         LDKAcceptChannel msg_conv;
14184         msg_conv.inner = untag_ptr(msg);
14185         msg_conv.is_owned = ptr_is_owned(msg);
14186         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14187         msg_conv.is_owned = false;
14188         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14189 }
14190
14191 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) {
14192         void* this_arg_ptr = untag_ptr(this_arg);
14193         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14194         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14195         LDKPublicKey their_node_id_ref;
14196         CHECK(their_node_id->arr_len == 33);
14197         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14198         LDKAcceptChannelV2 msg_conv;
14199         msg_conv.inner = untag_ptr(msg);
14200         msg_conv.is_owned = ptr_is_owned(msg);
14201         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14202         msg_conv.is_owned = false;
14203         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14204 }
14205
14206 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) {
14207         void* this_arg_ptr = untag_ptr(this_arg);
14208         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14209         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14210         LDKPublicKey their_node_id_ref;
14211         CHECK(their_node_id->arr_len == 33);
14212         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14213         LDKFundingCreated msg_conv;
14214         msg_conv.inner = untag_ptr(msg);
14215         msg_conv.is_owned = ptr_is_owned(msg);
14216         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14217         msg_conv.is_owned = false;
14218         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14219 }
14220
14221 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) {
14222         void* this_arg_ptr = untag_ptr(this_arg);
14223         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14224         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14225         LDKPublicKey their_node_id_ref;
14226         CHECK(their_node_id->arr_len == 33);
14227         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14228         LDKFundingSigned msg_conv;
14229         msg_conv.inner = untag_ptr(msg);
14230         msg_conv.is_owned = ptr_is_owned(msg);
14231         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14232         msg_conv.is_owned = false;
14233         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14234 }
14235
14236 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) {
14237         void* this_arg_ptr = untag_ptr(this_arg);
14238         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14239         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14240         LDKPublicKey their_node_id_ref;
14241         CHECK(their_node_id->arr_len == 33);
14242         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14243         LDKChannelReady msg_conv;
14244         msg_conv.inner = untag_ptr(msg);
14245         msg_conv.is_owned = ptr_is_owned(msg);
14246         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14247         msg_conv.is_owned = false;
14248         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14249 }
14250
14251 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
14252         void* this_arg_ptr = untag_ptr(this_arg);
14253         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14254         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14255         LDKPublicKey their_node_id_ref;
14256         CHECK(their_node_id->arr_len == 33);
14257         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14258         LDKShutdown msg_conv;
14259         msg_conv.inner = untag_ptr(msg);
14260         msg_conv.is_owned = ptr_is_owned(msg);
14261         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14262         msg_conv.is_owned = false;
14263         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14264 }
14265
14266 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) {
14267         void* this_arg_ptr = untag_ptr(this_arg);
14268         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14269         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14270         LDKPublicKey their_node_id_ref;
14271         CHECK(their_node_id->arr_len == 33);
14272         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14273         LDKClosingSigned msg_conv;
14274         msg_conv.inner = untag_ptr(msg);
14275         msg_conv.is_owned = ptr_is_owned(msg);
14276         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14277         msg_conv.is_owned = false;
14278         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14279 }
14280
14281 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_stfu"))) TS_ChannelMessageHandler_handle_stfu(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
14282         void* this_arg_ptr = untag_ptr(this_arg);
14283         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14284         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14285         LDKPublicKey their_node_id_ref;
14286         CHECK(their_node_id->arr_len == 33);
14287         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14288         LDKStfu msg_conv;
14289         msg_conv.inner = untag_ptr(msg);
14290         msg_conv.is_owned = ptr_is_owned(msg);
14291         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14292         msg_conv.is_owned = false;
14293         (this_arg_conv->handle_stfu)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14294 }
14295
14296 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_splice"))) TS_ChannelMessageHandler_handle_splice(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
14297         void* this_arg_ptr = untag_ptr(this_arg);
14298         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14299         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14300         LDKPublicKey their_node_id_ref;
14301         CHECK(their_node_id->arr_len == 33);
14302         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14303         LDKSplice msg_conv;
14304         msg_conv.inner = untag_ptr(msg);
14305         msg_conv.is_owned = ptr_is_owned(msg);
14306         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14307         msg_conv.is_owned = false;
14308         (this_arg_conv->handle_splice)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14309 }
14310
14311 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_splice_ack"))) TS_ChannelMessageHandler_handle_splice_ack(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
14312         void* this_arg_ptr = untag_ptr(this_arg);
14313         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14314         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14315         LDKPublicKey their_node_id_ref;
14316         CHECK(their_node_id->arr_len == 33);
14317         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14318         LDKSpliceAck msg_conv;
14319         msg_conv.inner = untag_ptr(msg);
14320         msg_conv.is_owned = ptr_is_owned(msg);
14321         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14322         msg_conv.is_owned = false;
14323         (this_arg_conv->handle_splice_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14324 }
14325
14326 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_splice_locked"))) TS_ChannelMessageHandler_handle_splice_locked(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
14327         void* this_arg_ptr = untag_ptr(this_arg);
14328         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14329         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14330         LDKPublicKey their_node_id_ref;
14331         CHECK(their_node_id->arr_len == 33);
14332         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14333         LDKSpliceLocked msg_conv;
14334         msg_conv.inner = untag_ptr(msg);
14335         msg_conv.is_owned = ptr_is_owned(msg);
14336         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14337         msg_conv.is_owned = false;
14338         (this_arg_conv->handle_splice_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14339 }
14340
14341 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) {
14342         void* this_arg_ptr = untag_ptr(this_arg);
14343         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14344         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14345         LDKPublicKey their_node_id_ref;
14346         CHECK(their_node_id->arr_len == 33);
14347         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14348         LDKTxAddInput msg_conv;
14349         msg_conv.inner = untag_ptr(msg);
14350         msg_conv.is_owned = ptr_is_owned(msg);
14351         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14352         msg_conv.is_owned = false;
14353         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14354 }
14355
14356 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) {
14357         void* this_arg_ptr = untag_ptr(this_arg);
14358         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14359         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14360         LDKPublicKey their_node_id_ref;
14361         CHECK(their_node_id->arr_len == 33);
14362         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14363         LDKTxAddOutput msg_conv;
14364         msg_conv.inner = untag_ptr(msg);
14365         msg_conv.is_owned = ptr_is_owned(msg);
14366         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14367         msg_conv.is_owned = false;
14368         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14369 }
14370
14371 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) {
14372         void* this_arg_ptr = untag_ptr(this_arg);
14373         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14374         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14375         LDKPublicKey their_node_id_ref;
14376         CHECK(their_node_id->arr_len == 33);
14377         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14378         LDKTxRemoveInput msg_conv;
14379         msg_conv.inner = untag_ptr(msg);
14380         msg_conv.is_owned = ptr_is_owned(msg);
14381         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14382         msg_conv.is_owned = false;
14383         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14384 }
14385
14386 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) {
14387         void* this_arg_ptr = untag_ptr(this_arg);
14388         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14389         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14390         LDKPublicKey their_node_id_ref;
14391         CHECK(their_node_id->arr_len == 33);
14392         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14393         LDKTxRemoveOutput msg_conv;
14394         msg_conv.inner = untag_ptr(msg);
14395         msg_conv.is_owned = ptr_is_owned(msg);
14396         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14397         msg_conv.is_owned = false;
14398         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14399 }
14400
14401 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) {
14402         void* this_arg_ptr = untag_ptr(this_arg);
14403         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14404         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14405         LDKPublicKey their_node_id_ref;
14406         CHECK(their_node_id->arr_len == 33);
14407         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14408         LDKTxComplete msg_conv;
14409         msg_conv.inner = untag_ptr(msg);
14410         msg_conv.is_owned = ptr_is_owned(msg);
14411         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14412         msg_conv.is_owned = false;
14413         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14414 }
14415
14416 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) {
14417         void* this_arg_ptr = untag_ptr(this_arg);
14418         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14419         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14420         LDKPublicKey their_node_id_ref;
14421         CHECK(their_node_id->arr_len == 33);
14422         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14423         LDKTxSignatures msg_conv;
14424         msg_conv.inner = untag_ptr(msg);
14425         msg_conv.is_owned = ptr_is_owned(msg);
14426         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14427         msg_conv.is_owned = false;
14428         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14429 }
14430
14431 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) {
14432         void* this_arg_ptr = untag_ptr(this_arg);
14433         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14434         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14435         LDKPublicKey their_node_id_ref;
14436         CHECK(their_node_id->arr_len == 33);
14437         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14438         LDKTxInitRbf msg_conv;
14439         msg_conv.inner = untag_ptr(msg);
14440         msg_conv.is_owned = ptr_is_owned(msg);
14441         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14442         msg_conv.is_owned = false;
14443         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14444 }
14445
14446 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) {
14447         void* this_arg_ptr = untag_ptr(this_arg);
14448         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14449         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14450         LDKPublicKey their_node_id_ref;
14451         CHECK(their_node_id->arr_len == 33);
14452         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14453         LDKTxAckRbf msg_conv;
14454         msg_conv.inner = untag_ptr(msg);
14455         msg_conv.is_owned = ptr_is_owned(msg);
14456         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14457         msg_conv.is_owned = false;
14458         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14459 }
14460
14461 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) {
14462         void* this_arg_ptr = untag_ptr(this_arg);
14463         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14464         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14465         LDKPublicKey their_node_id_ref;
14466         CHECK(their_node_id->arr_len == 33);
14467         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14468         LDKTxAbort msg_conv;
14469         msg_conv.inner = untag_ptr(msg);
14470         msg_conv.is_owned = ptr_is_owned(msg);
14471         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14472         msg_conv.is_owned = false;
14473         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14474 }
14475
14476 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) {
14477         void* this_arg_ptr = untag_ptr(this_arg);
14478         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14479         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14480         LDKPublicKey their_node_id_ref;
14481         CHECK(their_node_id->arr_len == 33);
14482         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14483         LDKUpdateAddHTLC msg_conv;
14484         msg_conv.inner = untag_ptr(msg);
14485         msg_conv.is_owned = ptr_is_owned(msg);
14486         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14487         msg_conv.is_owned = false;
14488         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14489 }
14490
14491 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) {
14492         void* this_arg_ptr = untag_ptr(this_arg);
14493         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14494         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14495         LDKPublicKey their_node_id_ref;
14496         CHECK(their_node_id->arr_len == 33);
14497         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14498         LDKUpdateFulfillHTLC msg_conv;
14499         msg_conv.inner = untag_ptr(msg);
14500         msg_conv.is_owned = ptr_is_owned(msg);
14501         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14502         msg_conv.is_owned = false;
14503         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14504 }
14505
14506 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) {
14507         void* this_arg_ptr = untag_ptr(this_arg);
14508         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14509         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14510         LDKPublicKey their_node_id_ref;
14511         CHECK(their_node_id->arr_len == 33);
14512         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14513         LDKUpdateFailHTLC msg_conv;
14514         msg_conv.inner = untag_ptr(msg);
14515         msg_conv.is_owned = ptr_is_owned(msg);
14516         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14517         msg_conv.is_owned = false;
14518         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14519 }
14520
14521 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) {
14522         void* this_arg_ptr = untag_ptr(this_arg);
14523         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14524         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14525         LDKPublicKey their_node_id_ref;
14526         CHECK(their_node_id->arr_len == 33);
14527         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14528         LDKUpdateFailMalformedHTLC msg_conv;
14529         msg_conv.inner = untag_ptr(msg);
14530         msg_conv.is_owned = ptr_is_owned(msg);
14531         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14532         msg_conv.is_owned = false;
14533         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14534 }
14535
14536 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) {
14537         void* this_arg_ptr = untag_ptr(this_arg);
14538         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14539         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14540         LDKPublicKey their_node_id_ref;
14541         CHECK(their_node_id->arr_len == 33);
14542         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14543         LDKCommitmentSigned msg_conv;
14544         msg_conv.inner = untag_ptr(msg);
14545         msg_conv.is_owned = ptr_is_owned(msg);
14546         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14547         msg_conv.is_owned = false;
14548         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14549 }
14550
14551 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) {
14552         void* this_arg_ptr = untag_ptr(this_arg);
14553         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14554         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14555         LDKPublicKey their_node_id_ref;
14556         CHECK(their_node_id->arr_len == 33);
14557         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14558         LDKRevokeAndACK msg_conv;
14559         msg_conv.inner = untag_ptr(msg);
14560         msg_conv.is_owned = ptr_is_owned(msg);
14561         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14562         msg_conv.is_owned = false;
14563         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14564 }
14565
14566 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) {
14567         void* this_arg_ptr = untag_ptr(this_arg);
14568         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14569         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14570         LDKPublicKey their_node_id_ref;
14571         CHECK(their_node_id->arr_len == 33);
14572         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14573         LDKUpdateFee msg_conv;
14574         msg_conv.inner = untag_ptr(msg);
14575         msg_conv.is_owned = ptr_is_owned(msg);
14576         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14577         msg_conv.is_owned = false;
14578         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14579 }
14580
14581 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) {
14582         void* this_arg_ptr = untag_ptr(this_arg);
14583         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14584         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14585         LDKPublicKey their_node_id_ref;
14586         CHECK(their_node_id->arr_len == 33);
14587         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14588         LDKAnnouncementSignatures msg_conv;
14589         msg_conv.inner = untag_ptr(msg);
14590         msg_conv.is_owned = ptr_is_owned(msg);
14591         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14592         msg_conv.is_owned = false;
14593         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14594 }
14595
14596 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
14597         void* this_arg_ptr = untag_ptr(this_arg);
14598         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14599         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14600         LDKPublicKey their_node_id_ref;
14601         CHECK(their_node_id->arr_len == 33);
14602         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14603         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
14604 }
14605
14606 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) {
14607         void* this_arg_ptr = untag_ptr(this_arg);
14608         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14609         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14610         LDKPublicKey their_node_id_ref;
14611         CHECK(their_node_id->arr_len == 33);
14612         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14613         LDKInit msg_conv;
14614         msg_conv.inner = untag_ptr(msg);
14615         msg_conv.is_owned = ptr_is_owned(msg);
14616         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14617         msg_conv.is_owned = false;
14618         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14619         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
14620         return tag_ptr(ret_conv, true);
14621 }
14622
14623 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) {
14624         void* this_arg_ptr = untag_ptr(this_arg);
14625         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14626         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14627         LDKPublicKey their_node_id_ref;
14628         CHECK(their_node_id->arr_len == 33);
14629         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14630         LDKChannelReestablish msg_conv;
14631         msg_conv.inner = untag_ptr(msg);
14632         msg_conv.is_owned = ptr_is_owned(msg);
14633         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14634         msg_conv.is_owned = false;
14635         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14636 }
14637
14638 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) {
14639         void* this_arg_ptr = untag_ptr(this_arg);
14640         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14641         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14642         LDKPublicKey their_node_id_ref;
14643         CHECK(their_node_id->arr_len == 33);
14644         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14645         LDKChannelUpdate msg_conv;
14646         msg_conv.inner = untag_ptr(msg);
14647         msg_conv.is_owned = ptr_is_owned(msg);
14648         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14649         msg_conv.is_owned = false;
14650         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14651 }
14652
14653 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
14654         void* this_arg_ptr = untag_ptr(this_arg);
14655         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14656         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14657         LDKPublicKey their_node_id_ref;
14658         CHECK(their_node_id->arr_len == 33);
14659         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14660         LDKErrorMessage msg_conv;
14661         msg_conv.inner = untag_ptr(msg);
14662         msg_conv.is_owned = ptr_is_owned(msg);
14663         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14664         msg_conv.is_owned = false;
14665         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14666 }
14667
14668 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
14669         void* this_arg_ptr = untag_ptr(this_arg);
14670         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14671         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14672         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
14673         uint64_t ret_ref = 0;
14674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14676         return ret_ref;
14677 }
14678
14679 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
14680         void* this_arg_ptr = untag_ptr(this_arg);
14681         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14682         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14683         LDKPublicKey their_node_id_ref;
14684         CHECK(their_node_id->arr_len == 33);
14685         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14686         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
14687         uint64_t ret_ref = 0;
14688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14690         return ret_ref;
14691 }
14692
14693 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_get_chain_hashes"))) TS_ChannelMessageHandler_get_chain_hashes(uint64_t this_arg) {
14694         void* this_arg_ptr = untag_ptr(this_arg);
14695         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14696         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14697         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
14698         *ret_copy = (this_arg_conv->get_chain_hashes)(this_arg_conv->this_arg);
14699         uint64_t ret_ref = tag_ptr(ret_copy, true);
14700         return ret_ref;
14701 }
14702
14703 typedef struct LDKOffersMessageHandler_JCalls {
14704         atomic_size_t refcnt;
14705         uint32_t instance_ptr;
14706 } LDKOffersMessageHandler_JCalls;
14707 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
14708         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
14709         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14710                 FREE(j_calls);
14711         }
14712 }
14713 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
14714         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
14715         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
14716         *message_copy = message;
14717         uint64_t message_ref = tag_ptr(message_copy, true);
14718         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 116, message_ref, 0, 0, 0, 0, 0);
14719         void* ret_ptr = untag_ptr(ret);
14720         CHECK_ACCESS(ret_ptr);
14721         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
14722         FREE(untag_ptr(ret));
14723         return ret_conv;
14724 }
14725 LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages_LDKOffersMessageHandler_jcall(const void* this_arg) {
14726         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
14727         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 117, 0, 0, 0, 0, 0, 0);
14728         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_constr;
14729         ret_constr.datalen = ret->arr_len;
14730         if (ret_constr.datalen > 0)
14731                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
14732         else
14733                 ret_constr.data = NULL;
14734         uint64_t* ret_vals = ret->elems;
14735         for (size_t x = 0; x < ret_constr.datalen; x++) {
14736                 uint64_t ret_conv_49 = ret_vals[x];
14737                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
14738                 CHECK_ACCESS(ret_conv_49_ptr);
14739                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ ret_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(ret_conv_49_ptr);
14740                 FREE(untag_ptr(ret_conv_49));
14741                 ret_constr.data[x] = ret_conv_49_conv;
14742         }
14743         FREE(ret);
14744         return ret_constr;
14745 }
14746 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
14747         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
14748         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14749 }
14750 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JSValue o) {
14751         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
14752         atomic_init(&calls->refcnt, 1);
14753         calls->instance_ptr = o;
14754
14755         LDKOffersMessageHandler ret = {
14756                 .this_arg = (void*) calls,
14757                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
14758                 .release_pending_messages = release_pending_messages_LDKOffersMessageHandler_jcall,
14759                 .free = LDKOffersMessageHandler_JCalls_free,
14760         };
14761         return ret;
14762 }
14763 uint64_t  __attribute__((export_name("TS_LDKOffersMessageHandler_new"))) TS_LDKOffersMessageHandler_new(JSValue o) {
14764         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
14765         *res_ptr = LDKOffersMessageHandler_init(o);
14766         return tag_ptr(res_ptr, true);
14767 }
14768 uint64_t  __attribute__((export_name("TS_OffersMessageHandler_handle_message"))) TS_OffersMessageHandler_handle_message(uint64_t this_arg, uint64_t message) {
14769         void* this_arg_ptr = untag_ptr(this_arg);
14770         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14771         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
14772         void* message_ptr = untag_ptr(message);
14773         CHECK_ACCESS(message_ptr);
14774         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
14775         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
14776         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
14777         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
14778         uint64_t ret_ref = tag_ptr(ret_copy, true);
14779         return ret_ref;
14780 }
14781
14782 uint64_tArray  __attribute__((export_name("TS_OffersMessageHandler_release_pending_messages"))) TS_OffersMessageHandler_release_pending_messages(uint64_t this_arg) {
14783         void* this_arg_ptr = untag_ptr(this_arg);
14784         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14785         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
14786         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_messages)(this_arg_conv->this_arg);
14787         uint64_tArray ret_arr = NULL;
14788         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
14789         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
14790         for (size_t x = 0; x < ret_var.datalen; x++) {
14791                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
14792                 *ret_conv_49_conv = ret_var.data[x];
14793                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
14794         }
14795         
14796         FREE(ret_var.data);
14797         return ret_arr;
14798 }
14799
14800 typedef struct LDKRoutingMessageHandler_JCalls {
14801         atomic_size_t refcnt;
14802         uint32_t instance_ptr;
14803         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
14804 } LDKRoutingMessageHandler_JCalls;
14805 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
14806         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14807         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14808                 FREE(j_calls);
14809         }
14810 }
14811 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
14812         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14813         LDKNodeAnnouncement msg_var = *msg;
14814         uint64_t msg_ref = 0;
14815         msg_var = NodeAnnouncement_clone(&msg_var);
14816         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14817         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14818         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 118, msg_ref, 0, 0, 0, 0, 0);
14819         void* ret_ptr = untag_ptr(ret);
14820         CHECK_ACCESS(ret_ptr);
14821         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
14822         FREE(untag_ptr(ret));
14823         return ret_conv;
14824 }
14825 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
14826         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14827         LDKChannelAnnouncement msg_var = *msg;
14828         uint64_t msg_ref = 0;
14829         msg_var = ChannelAnnouncement_clone(&msg_var);
14830         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14831         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14832         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 119, msg_ref, 0, 0, 0, 0, 0);
14833         void* ret_ptr = untag_ptr(ret);
14834         CHECK_ACCESS(ret_ptr);
14835         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
14836         FREE(untag_ptr(ret));
14837         return ret_conv;
14838 }
14839 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
14840         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14841         LDKChannelUpdate msg_var = *msg;
14842         uint64_t msg_ref = 0;
14843         msg_var = ChannelUpdate_clone(&msg_var);
14844         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14845         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14846         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 120, msg_ref, 0, 0, 0, 0, 0);
14847         void* ret_ptr = untag_ptr(ret);
14848         CHECK_ACCESS(ret_ptr);
14849         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
14850         FREE(untag_ptr(ret));
14851         return ret_conv;
14852 }
14853 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
14854         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14855         int64_t starting_point_conv = starting_point;
14856         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 121, starting_point_conv, 0, 0, 0, 0, 0);
14857         void* ret_ptr = untag_ptr(ret);
14858         CHECK_ACCESS(ret_ptr);
14859         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
14860         FREE(untag_ptr(ret));
14861         return ret_conv;
14862 }
14863 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
14864         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14865         LDKNodeId starting_point_var = starting_point;
14866         uint64_t starting_point_ref = 0;
14867         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
14868         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
14869         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 122, starting_point_ref, 0, 0, 0, 0, 0);
14870         LDKNodeAnnouncement ret_conv;
14871         ret_conv.inner = untag_ptr(ret);
14872         ret_conv.is_owned = ptr_is_owned(ret);
14873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14874         return ret_conv;
14875 }
14876 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
14877         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14878         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14879         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14880         LDKInit init_var = *init;
14881         uint64_t init_ref = 0;
14882         init_var = Init_clone(&init_var);
14883         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
14884         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
14885         jboolean inbound_conv = inbound;
14886         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 123, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0);
14887         void* ret_ptr = untag_ptr(ret);
14888         CHECK_ACCESS(ret_ptr);
14889         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
14890         FREE(untag_ptr(ret));
14891         return ret_conv;
14892 }
14893 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
14894         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14895         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14896         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14897         LDKReplyChannelRange msg_var = msg;
14898         uint64_t msg_ref = 0;
14899         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14900         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14901         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 124, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
14902         void* ret_ptr = untag_ptr(ret);
14903         CHECK_ACCESS(ret_ptr);
14904         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
14905         FREE(untag_ptr(ret));
14906         return ret_conv;
14907 }
14908 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
14909         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14910         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14911         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14912         LDKReplyShortChannelIdsEnd msg_var = msg;
14913         uint64_t msg_ref = 0;
14914         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14915         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14916         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 125, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
14917         void* ret_ptr = untag_ptr(ret);
14918         CHECK_ACCESS(ret_ptr);
14919         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
14920         FREE(untag_ptr(ret));
14921         return ret_conv;
14922 }
14923 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
14924         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14925         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14926         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14927         LDKQueryChannelRange msg_var = msg;
14928         uint64_t msg_ref = 0;
14929         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14930         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14931         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 126, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
14932         void* ret_ptr = untag_ptr(ret);
14933         CHECK_ACCESS(ret_ptr);
14934         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
14935         FREE(untag_ptr(ret));
14936         return ret_conv;
14937 }
14938 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
14939         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14940         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14941         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14942         LDKQueryShortChannelIds msg_var = msg;
14943         uint64_t msg_ref = 0;
14944         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14945         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14946         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 127, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
14947         void* ret_ptr = untag_ptr(ret);
14948         CHECK_ACCESS(ret_ptr);
14949         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
14950         FREE(untag_ptr(ret));
14951         return ret_conv;
14952 }
14953 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
14954         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14955         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 128, 0, 0, 0, 0, 0, 0);
14956 }
14957 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
14958         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14959         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 129, 0, 0, 0, 0, 0, 0);
14960         LDKNodeFeatures ret_conv;
14961         ret_conv.inner = untag_ptr(ret);
14962         ret_conv.is_owned = ptr_is_owned(ret);
14963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14964         return ret_conv;
14965 }
14966 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14967         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14968         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14969         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14970         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 130, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
14971         LDKInitFeatures ret_conv;
14972         ret_conv.inner = untag_ptr(ret);
14973         ret_conv.is_owned = ptr_is_owned(ret);
14974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14975         return ret_conv;
14976 }
14977 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
14978         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
14979         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14980         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
14981 }
14982 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
14983         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
14984         atomic_init(&calls->refcnt, 1);
14985         calls->instance_ptr = o;
14986
14987         LDKRoutingMessageHandler ret = {
14988                 .this_arg = (void*) calls,
14989                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
14990                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
14991                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
14992                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
14993                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
14994                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
14995                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
14996                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
14997                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
14998                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
14999                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
15000                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
15001                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
15002                 .free = LDKRoutingMessageHandler_JCalls_free,
15003                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
15004         };
15005         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
15006         return ret;
15007 }
15008 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
15009         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
15010         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
15011         return tag_ptr(res_ptr, true);
15012 }
15013 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
15014         void* this_arg_ptr = untag_ptr(this_arg);
15015         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15016         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15017         LDKNodeAnnouncement msg_conv;
15018         msg_conv.inner = untag_ptr(msg);
15019         msg_conv.is_owned = ptr_is_owned(msg);
15020         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15021         msg_conv.is_owned = false;
15022         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15023         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
15024         return tag_ptr(ret_conv, true);
15025 }
15026
15027 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
15028         void* this_arg_ptr = untag_ptr(this_arg);
15029         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15030         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15031         LDKChannelAnnouncement msg_conv;
15032         msg_conv.inner = untag_ptr(msg);
15033         msg_conv.is_owned = ptr_is_owned(msg);
15034         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15035         msg_conv.is_owned = false;
15036         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15037         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
15038         return tag_ptr(ret_conv, true);
15039 }
15040
15041 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
15042         void* this_arg_ptr = untag_ptr(this_arg);
15043         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15044         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15045         LDKChannelUpdate msg_conv;
15046         msg_conv.inner = untag_ptr(msg);
15047         msg_conv.is_owned = ptr_is_owned(msg);
15048         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15049         msg_conv.is_owned = false;
15050         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15051         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
15052         return tag_ptr(ret_conv, true);
15053 }
15054
15055 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) {
15056         void* this_arg_ptr = untag_ptr(this_arg);
15057         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15058         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15059         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15060         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
15061         uint64_t ret_ref = tag_ptr(ret_copy, true);
15062         return ret_ref;
15063 }
15064
15065 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) {
15066         void* this_arg_ptr = untag_ptr(this_arg);
15067         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15068         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15069         LDKNodeId starting_point_conv;
15070         starting_point_conv.inner = untag_ptr(starting_point);
15071         starting_point_conv.is_owned = ptr_is_owned(starting_point);
15072         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
15073         starting_point_conv = NodeId_clone(&starting_point_conv);
15074         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
15075         uint64_t ret_ref = 0;
15076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15078         return ret_ref;
15079 }
15080
15081 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) {
15082         void* this_arg_ptr = untag_ptr(this_arg);
15083         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15084         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15085         LDKPublicKey their_node_id_ref;
15086         CHECK(their_node_id->arr_len == 33);
15087         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15088         LDKInit init_conv;
15089         init_conv.inner = untag_ptr(init);
15090         init_conv.is_owned = ptr_is_owned(init);
15091         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
15092         init_conv.is_owned = false;
15093         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15094         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
15095         return tag_ptr(ret_conv, true);
15096 }
15097
15098 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) {
15099         void* this_arg_ptr = untag_ptr(this_arg);
15100         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15101         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15102         LDKPublicKey their_node_id_ref;
15103         CHECK(their_node_id->arr_len == 33);
15104         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15105         LDKReplyChannelRange msg_conv;
15106         msg_conv.inner = untag_ptr(msg);
15107         msg_conv.is_owned = ptr_is_owned(msg);
15108         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15109         msg_conv = ReplyChannelRange_clone(&msg_conv);
15110         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15111         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
15112         return tag_ptr(ret_conv, true);
15113 }
15114
15115 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) {
15116         void* this_arg_ptr = untag_ptr(this_arg);
15117         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15118         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15119         LDKPublicKey their_node_id_ref;
15120         CHECK(their_node_id->arr_len == 33);
15121         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15122         LDKReplyShortChannelIdsEnd msg_conv;
15123         msg_conv.inner = untag_ptr(msg);
15124         msg_conv.is_owned = ptr_is_owned(msg);
15125         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15126         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
15127         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15128         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
15129         return tag_ptr(ret_conv, true);
15130 }
15131
15132 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) {
15133         void* this_arg_ptr = untag_ptr(this_arg);
15134         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15135         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15136         LDKPublicKey their_node_id_ref;
15137         CHECK(their_node_id->arr_len == 33);
15138         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15139         LDKQueryChannelRange msg_conv;
15140         msg_conv.inner = untag_ptr(msg);
15141         msg_conv.is_owned = ptr_is_owned(msg);
15142         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15143         msg_conv = QueryChannelRange_clone(&msg_conv);
15144         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15145         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
15146         return tag_ptr(ret_conv, true);
15147 }
15148
15149 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) {
15150         void* this_arg_ptr = untag_ptr(this_arg);
15151         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15152         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15153         LDKPublicKey their_node_id_ref;
15154         CHECK(their_node_id->arr_len == 33);
15155         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15156         LDKQueryShortChannelIds msg_conv;
15157         msg_conv.inner = untag_ptr(msg);
15158         msg_conv.is_owned = ptr_is_owned(msg);
15159         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15160         msg_conv = QueryShortChannelIds_clone(&msg_conv);
15161         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15162         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
15163         return tag_ptr(ret_conv, true);
15164 }
15165
15166 jboolean  __attribute__((export_name("TS_RoutingMessageHandler_processing_queue_high"))) TS_RoutingMessageHandler_processing_queue_high(uint64_t this_arg) {
15167         void* this_arg_ptr = untag_ptr(this_arg);
15168         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15169         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15170         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
15171         return ret_conv;
15172 }
15173
15174 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
15175         void* this_arg_ptr = untag_ptr(this_arg);
15176         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15177         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15178         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
15179         uint64_t ret_ref = 0;
15180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15182         return ret_ref;
15183 }
15184
15185 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
15186         void* this_arg_ptr = untag_ptr(this_arg);
15187         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15188         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15189         LDKPublicKey their_node_id_ref;
15190         CHECK(their_node_id->arr_len == 33);
15191         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15192         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
15193         uint64_t ret_ref = 0;
15194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15196         return ret_ref;
15197 }
15198
15199 typedef struct LDKOnionMessageHandler_JCalls {
15200         atomic_size_t refcnt;
15201         uint32_t instance_ptr;
15202 } LDKOnionMessageHandler_JCalls;
15203 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
15204         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15205         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15206                 FREE(j_calls);
15207         }
15208 }
15209 LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ get_and_clear_connections_needed_LDKOnionMessageHandler_jcall(const void* this_arg) {
15210         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15211         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 131, 0, 0, 0, 0, 0, 0);
15212         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_constr;
15213         ret_constr.datalen = ret->arr_len;
15214         if (ret_constr.datalen > 0)
15215                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
15216         else
15217                 ret_constr.data = NULL;
15218         uint64_t* ret_vals = ret->elems;
15219         for (size_t o = 0; o < ret_constr.datalen; o++) {
15220                 uint64_t ret_conv_40 = ret_vals[o];
15221                 void* ret_conv_40_ptr = untag_ptr(ret_conv_40);
15222                 CHECK_ACCESS(ret_conv_40_ptr);
15223                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ ret_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(ret_conv_40_ptr);
15224                 FREE(untag_ptr(ret_conv_40));
15225                 ret_constr.data[o] = ret_conv_40_conv;
15226         }
15227         FREE(ret);
15228         return ret_constr;
15229 }
15230 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
15231         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15232         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
15233         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
15234         LDKOnionMessage msg_var = *msg;
15235         uint64_t msg_ref = 0;
15236         msg_var = OnionMessage_clone(&msg_var);
15237         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15238         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15239         js_invoke_function_ubuuuu(j_calls->instance_ptr, 132, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
15240 }
15241 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
15242         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15243         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
15244         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
15245         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 133, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
15246         LDKOnionMessage ret_conv;
15247         ret_conv.inner = untag_ptr(ret);
15248         ret_conv.is_owned = ptr_is_owned(ret);
15249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15250         return ret_conv;
15251 }
15252 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
15253         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15254         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15255         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15256         LDKInit init_var = *init;
15257         uint64_t init_ref = 0;
15258         init_var = Init_clone(&init_var);
15259         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
15260         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
15261         jboolean inbound_conv = inbound;
15262         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 134, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0);
15263         void* ret_ptr = untag_ptr(ret);
15264         CHECK_ACCESS(ret_ptr);
15265         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
15266         FREE(untag_ptr(ret));
15267         return ret_conv;
15268 }
15269 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15270         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15271         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15272         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15273         js_invoke_function_uuuuuu(j_calls->instance_ptr, 135, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
15274 }
15275 void timer_tick_occurred_LDKOnionMessageHandler_jcall(const void* this_arg) {
15276         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15277         js_invoke_function_uuuuuu(j_calls->instance_ptr, 136, 0, 0, 0, 0, 0, 0);
15278 }
15279 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
15280         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15281         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 137, 0, 0, 0, 0, 0, 0);
15282         LDKNodeFeatures ret_conv;
15283         ret_conv.inner = untag_ptr(ret);
15284         ret_conv.is_owned = ptr_is_owned(ret);
15285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15286         return ret_conv;
15287 }
15288 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15289         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15290         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15291         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15292         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 138, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
15293         LDKInitFeatures ret_conv;
15294         ret_conv.inner = untag_ptr(ret);
15295         ret_conv.is_owned = ptr_is_owned(ret);
15296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15297         return ret_conv;
15298 }
15299 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
15300         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
15301         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15302 }
15303 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o) {
15304         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
15305         atomic_init(&calls->refcnt, 1);
15306         calls->instance_ptr = o;
15307
15308         LDKOnionMessageHandler ret = {
15309                 .this_arg = (void*) calls,
15310                 .get_and_clear_connections_needed = get_and_clear_connections_needed_LDKOnionMessageHandler_jcall,
15311                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
15312                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageHandler_jcall,
15313                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
15314                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
15315                 .timer_tick_occurred = timer_tick_occurred_LDKOnionMessageHandler_jcall,
15316                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
15317                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
15318                 .free = LDKOnionMessageHandler_JCalls_free,
15319         };
15320         return ret;
15321 }
15322 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o) {
15323         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
15324         *res_ptr = LDKOnionMessageHandler_init(o);
15325         return tag_ptr(res_ptr, true);
15326 }
15327 uint64_tArray  __attribute__((export_name("TS_OnionMessageHandler_get_and_clear_connections_needed"))) TS_OnionMessageHandler_get_and_clear_connections_needed(uint64_t this_arg) {
15328         void* this_arg_ptr = untag_ptr(this_arg);
15329         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15330         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15331         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_var = (this_arg_conv->get_and_clear_connections_needed)(this_arg_conv->this_arg);
15332         uint64_tArray ret_arr = NULL;
15333         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
15334         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
15335         for (size_t o = 0; o < ret_var.datalen; o++) {
15336                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
15337                 *ret_conv_40_conv = ret_var.data[o];
15338                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
15339         }
15340         
15341         FREE(ret_var.data);
15342         return ret_arr;
15343 }
15344
15345 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) {
15346         void* this_arg_ptr = untag_ptr(this_arg);
15347         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15348         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15349         LDKPublicKey peer_node_id_ref;
15350         CHECK(peer_node_id->arr_len == 33);
15351         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
15352         LDKOnionMessage msg_conv;
15353         msg_conv.inner = untag_ptr(msg);
15354         msg_conv.is_owned = ptr_is_owned(msg);
15355         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15356         msg_conv.is_owned = false;
15357         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
15358 }
15359
15360 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_next_onion_message_for_peer"))) TS_OnionMessageHandler_next_onion_message_for_peer(uint64_t this_arg, int8_tArray peer_node_id) {
15361         void* this_arg_ptr = untag_ptr(this_arg);
15362         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15363         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15364         LDKPublicKey peer_node_id_ref;
15365         CHECK(peer_node_id->arr_len == 33);
15366         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
15367         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
15368         uint64_t ret_ref = 0;
15369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15371         return ret_ref;
15372 }
15373
15374 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) {
15375         void* this_arg_ptr = untag_ptr(this_arg);
15376         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15377         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15378         LDKPublicKey their_node_id_ref;
15379         CHECK(their_node_id->arr_len == 33);
15380         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15381         LDKInit init_conv;
15382         init_conv.inner = untag_ptr(init);
15383         init_conv.is_owned = ptr_is_owned(init);
15384         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
15385         init_conv.is_owned = false;
15386         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15387         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
15388         return tag_ptr(ret_conv, true);
15389 }
15390
15391 void  __attribute__((export_name("TS_OnionMessageHandler_peer_disconnected"))) TS_OnionMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
15392         void* this_arg_ptr = untag_ptr(this_arg);
15393         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15394         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15395         LDKPublicKey their_node_id_ref;
15396         CHECK(their_node_id->arr_len == 33);
15397         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15398         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
15399 }
15400
15401 void  __attribute__((export_name("TS_OnionMessageHandler_timer_tick_occurred"))) TS_OnionMessageHandler_timer_tick_occurred(uint64_t this_arg) {
15402         void* this_arg_ptr = untag_ptr(this_arg);
15403         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15404         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15405         (this_arg_conv->timer_tick_occurred)(this_arg_conv->this_arg);
15406 }
15407
15408 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
15409         void* this_arg_ptr = untag_ptr(this_arg);
15410         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15411         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15412         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
15413         uint64_t ret_ref = 0;
15414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15416         return ret_ref;
15417 }
15418
15419 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
15420         void* this_arg_ptr = untag_ptr(this_arg);
15421         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15422         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15423         LDKPublicKey their_node_id_ref;
15424         CHECK(their_node_id->arr_len == 33);
15425         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15426         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
15427         uint64_t ret_ref = 0;
15428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15430         return ret_ref;
15431 }
15432
15433 typedef struct LDKCustomMessageReader_JCalls {
15434         atomic_size_t refcnt;
15435         uint32_t instance_ptr;
15436 } LDKCustomMessageReader_JCalls;
15437 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
15438         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
15439         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15440                 FREE(j_calls);
15441         }
15442 }
15443 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
15444         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
15445         int16_t message_type_conv = message_type;
15446         LDKu8slice buffer_var = buffer;
15447         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
15448         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
15449         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 139, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
15450         void* ret_ptr = untag_ptr(ret);
15451         CHECK_ACCESS(ret_ptr);
15452         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
15453         FREE(untag_ptr(ret));
15454         return ret_conv;
15455 }
15456 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
15457         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
15458         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15459 }
15460 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
15461         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
15462         atomic_init(&calls->refcnt, 1);
15463         calls->instance_ptr = o;
15464
15465         LDKCustomMessageReader ret = {
15466                 .this_arg = (void*) calls,
15467                 .read = read_LDKCustomMessageReader_jcall,
15468                 .free = LDKCustomMessageReader_JCalls_free,
15469         };
15470         return ret;
15471 }
15472 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
15473         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
15474         *res_ptr = LDKCustomMessageReader_init(o);
15475         return tag_ptr(res_ptr, true);
15476 }
15477 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
15478         void* this_arg_ptr = untag_ptr(this_arg);
15479         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15480         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
15481         LDKu8slice buffer_ref;
15482         buffer_ref.datalen = buffer->arr_len;
15483         buffer_ref.data = buffer->elems;
15484         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
15485         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
15486         FREE(buffer);
15487         return tag_ptr(ret_conv, true);
15488 }
15489
15490 typedef struct LDKCustomMessageHandler_JCalls {
15491         atomic_size_t refcnt;
15492         uint32_t instance_ptr;
15493         LDKCustomMessageReader_JCalls* CustomMessageReader;
15494 } LDKCustomMessageHandler_JCalls;
15495 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
15496         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15497         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15498                 FREE(j_calls);
15499         }
15500 }
15501 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
15502         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15503         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
15504         *msg_ret = msg;
15505         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
15506         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
15507         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 140, tag_ptr(msg_ret, true), (uint32_t)sender_node_id_arr, 0, 0, 0, 0);
15508         void* ret_ptr = untag_ptr(ret);
15509         CHECK_ACCESS(ret_ptr);
15510         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
15511         FREE(untag_ptr(ret));
15512         return ret_conv;
15513 }
15514 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
15515         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15516         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 141, 0, 0, 0, 0, 0, 0);
15517         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
15518         ret_constr.datalen = ret->arr_len;
15519         if (ret_constr.datalen > 0)
15520                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
15521         else
15522                 ret_constr.data = NULL;
15523         uint64_t* ret_vals = ret->elems;
15524         for (size_t z = 0; z < ret_constr.datalen; z++) {
15525                 uint64_t ret_conv_25 = ret_vals[z];
15526                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
15527                 CHECK_ACCESS(ret_conv_25_ptr);
15528                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
15529                 FREE(untag_ptr(ret_conv_25));
15530                 ret_constr.data[z] = ret_conv_25_conv;
15531         }
15532         FREE(ret);
15533         return ret_constr;
15534 }
15535 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
15536         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15537         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 142, 0, 0, 0, 0, 0, 0);
15538         LDKNodeFeatures ret_conv;
15539         ret_conv.inner = untag_ptr(ret);
15540         ret_conv.is_owned = ptr_is_owned(ret);
15541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15542         return ret_conv;
15543 }
15544 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15545         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15546         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15547         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15548         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 143, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
15549         LDKInitFeatures ret_conv;
15550         ret_conv.inner = untag_ptr(ret);
15551         ret_conv.is_owned = ptr_is_owned(ret);
15552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15553         return ret_conv;
15554 }
15555 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
15556         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
15557         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15558         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
15559 }
15560 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
15561         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
15562         atomic_init(&calls->refcnt, 1);
15563         calls->instance_ptr = o;
15564
15565         LDKCustomMessageHandler ret = {
15566                 .this_arg = (void*) calls,
15567                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
15568                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
15569                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
15570                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
15571                 .free = LDKCustomMessageHandler_JCalls_free,
15572                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
15573         };
15574         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
15575         return ret;
15576 }
15577 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
15578         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
15579         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
15580         return tag_ptr(res_ptr, true);
15581 }
15582 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) {
15583         void* this_arg_ptr = untag_ptr(this_arg);
15584         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15585         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
15586         void* msg_ptr = untag_ptr(msg);
15587         CHECK_ACCESS(msg_ptr);
15588         LDKType msg_conv = *(LDKType*)(msg_ptr);
15589         if (msg_conv.free == LDKType_JCalls_free) {
15590                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15591                 LDKType_JCalls_cloned(&msg_conv);
15592         }
15593         LDKPublicKey sender_node_id_ref;
15594         CHECK(sender_node_id->arr_len == 33);
15595         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
15596         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15597         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
15598         return tag_ptr(ret_conv, true);
15599 }
15600
15601 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
15602         void* this_arg_ptr = untag_ptr(this_arg);
15603         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15604         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
15605         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
15606         uint64_tArray ret_arr = NULL;
15607         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
15608         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
15609         for (size_t z = 0; z < ret_var.datalen; z++) {
15610                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
15611                 *ret_conv_25_conv = ret_var.data[z];
15612                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
15613         }
15614         
15615         FREE(ret_var.data);
15616         return ret_arr;
15617 }
15618
15619 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_node_features"))) TS_CustomMessageHandler_provided_node_features(uint64_t this_arg) {
15620         void* this_arg_ptr = untag_ptr(this_arg);
15621         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15622         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
15623         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
15624         uint64_t ret_ref = 0;
15625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15627         return ret_ref;
15628 }
15629
15630 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_init_features"))) TS_CustomMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
15631         void* this_arg_ptr = untag_ptr(this_arg);
15632         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15633         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
15634         LDKPublicKey their_node_id_ref;
15635         CHECK(their_node_id->arr_len == 33);
15636         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15637         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
15638         uint64_t ret_ref = 0;
15639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15641         return ret_ref;
15642 }
15643
15644 typedef struct LDKCustomOnionMessageHandler_JCalls {
15645         atomic_size_t refcnt;
15646         uint32_t instance_ptr;
15647 } LDKCustomOnionMessageHandler_JCalls;
15648 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
15649         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
15650         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15651                 FREE(j_calls);
15652         }
15653 }
15654 LDKCOption_OnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKOnionMessageContents msg) {
15655         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
15656         LDKOnionMessageContents* msg_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
15657         *msg_ret = msg;
15658         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 144, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0);
15659         void* ret_ptr = untag_ptr(ret);
15660         CHECK_ACCESS(ret_ptr);
15661         LDKCOption_OnionMessageContentsZ ret_conv = *(LDKCOption_OnionMessageContentsZ*)(ret_ptr);
15662         FREE(untag_ptr(ret));
15663         return ret_conv;
15664 }
15665 LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
15666         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
15667         int64_t message_type_conv = message_type;
15668         LDKu8slice buffer_var = buffer;
15669         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
15670         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
15671         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 145, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
15672         void* ret_ptr = untag_ptr(ret);
15673         CHECK_ACCESS(ret_ptr);
15674         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(ret_ptr);
15675         FREE(untag_ptr(ret));
15676         return ret_conv;
15677 }
15678 LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall(const void* this_arg) {
15679         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
15680         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 146, 0, 0, 0, 0, 0, 0);
15681         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_constr;
15682         ret_constr.datalen = ret->arr_len;
15683         if (ret_constr.datalen > 0)
15684                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
15685         else
15686                 ret_constr.data = NULL;
15687         uint64_t* ret_vals = ret->elems;
15688         for (size_t e = 0; e < ret_constr.datalen; e++) {
15689                 uint64_t ret_conv_56 = ret_vals[e];
15690                 void* ret_conv_56_ptr = untag_ptr(ret_conv_56);
15691                 CHECK_ACCESS(ret_conv_56_ptr);
15692                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(ret_conv_56_ptr);
15693                 FREE(untag_ptr(ret_conv_56));
15694                 ret_constr.data[e] = ret_conv_56_conv;
15695         }
15696         FREE(ret);
15697         return ret_constr;
15698 }
15699 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
15700         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
15701         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15702 }
15703 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JSValue o) {
15704         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
15705         atomic_init(&calls->refcnt, 1);
15706         calls->instance_ptr = o;
15707
15708         LDKCustomOnionMessageHandler ret = {
15709                 .this_arg = (void*) calls,
15710                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
15711                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
15712                 .release_pending_custom_messages = release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall,
15713                 .free = LDKCustomOnionMessageHandler_JCalls_free,
15714         };
15715         return ret;
15716 }
15717 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageHandler_new"))) TS_LDKCustomOnionMessageHandler_new(JSValue o) {
15718         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
15719         *res_ptr = LDKCustomOnionMessageHandler_init(o);
15720         return tag_ptr(res_ptr, true);
15721 }
15722 uint64_t  __attribute__((export_name("TS_CustomOnionMessageHandler_handle_custom_message"))) TS_CustomOnionMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg) {
15723         void* this_arg_ptr = untag_ptr(this_arg);
15724         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15725         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
15726         void* msg_ptr = untag_ptr(msg);
15727         CHECK_ACCESS(msg_ptr);
15728         LDKOnionMessageContents msg_conv = *(LDKOnionMessageContents*)(msg_ptr);
15729         if (msg_conv.free == LDKOnionMessageContents_JCalls_free) {
15730                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15731                 LDKOnionMessageContents_JCalls_cloned(&msg_conv);
15732         }
15733         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
15734         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
15735         uint64_t ret_ref = tag_ptr(ret_copy, true);
15736         return ret_ref;
15737 }
15738
15739 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) {
15740         void* this_arg_ptr = untag_ptr(this_arg);
15741         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15742         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
15743         LDKu8slice buffer_ref;
15744         buffer_ref.datalen = buffer->arr_len;
15745         buffer_ref.data = buffer->elems;
15746         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
15747         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
15748         FREE(buffer);
15749         return tag_ptr(ret_conv, true);
15750 }
15751
15752 uint64_tArray  __attribute__((export_name("TS_CustomOnionMessageHandler_release_pending_custom_messages"))) TS_CustomOnionMessageHandler_release_pending_custom_messages(uint64_t this_arg) {
15753         void* this_arg_ptr = untag_ptr(this_arg);
15754         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15755         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
15756         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_custom_messages)(this_arg_conv->this_arg);
15757         uint64_tArray ret_arr = NULL;
15758         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
15759         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
15760         for (size_t e = 0; e < ret_var.datalen; e++) {
15761                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv_56_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
15762                 *ret_conv_56_conv = ret_var.data[e];
15763                 ret_arr_ptr[e] = tag_ptr(ret_conv_56_conv, true);
15764         }
15765         
15766         FREE(ret_var.data);
15767         return ret_arr;
15768 }
15769
15770 typedef struct LDKSocketDescriptor_JCalls {
15771         atomic_size_t refcnt;
15772         uint32_t instance_ptr;
15773 } LDKSocketDescriptor_JCalls;
15774 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
15775         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
15776         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15777                 FREE(j_calls);
15778         }
15779 }
15780 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
15781         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
15782         LDKu8slice data_var = data;
15783         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
15784         memcpy(data_arr->elems, data_var.data, data_var.datalen);
15785         jboolean resume_read_conv = resume_read;
15786         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 147, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
15787 }
15788 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
15789         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
15790         js_invoke_function_uuuuuu(j_calls->instance_ptr, 148, 0, 0, 0, 0, 0, 0);
15791 }
15792 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
15793         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
15794         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
15795         *other_arg_clone = SocketDescriptor_clone(other_arg);
15796         return js_invoke_function_buuuuu(j_calls->instance_ptr, 149, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
15797 }
15798 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
15799         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
15800         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 150, 0, 0, 0, 0, 0, 0);
15801 }
15802 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
15803         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
15804         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15805 }
15806 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
15807         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
15808         atomic_init(&calls->refcnt, 1);
15809         calls->instance_ptr = o;
15810
15811         LDKSocketDescriptor ret = {
15812                 .this_arg = (void*) calls,
15813                 .send_data = send_data_LDKSocketDescriptor_jcall,
15814                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
15815                 .eq = eq_LDKSocketDescriptor_jcall,
15816                 .hash = hash_LDKSocketDescriptor_jcall,
15817                 .cloned = LDKSocketDescriptor_JCalls_cloned,
15818                 .free = LDKSocketDescriptor_JCalls_free,
15819         };
15820         return ret;
15821 }
15822 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
15823         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
15824         *res_ptr = LDKSocketDescriptor_init(o);
15825         return tag_ptr(res_ptr, true);
15826 }
15827 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
15828         void* this_arg_ptr = untag_ptr(this_arg);
15829         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15830         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
15831         LDKu8slice data_ref;
15832         data_ref.datalen = data->arr_len;
15833         data_ref.data = data->elems;
15834         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
15835         FREE(data);
15836         return ret_conv;
15837 }
15838
15839 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
15840         void* this_arg_ptr = untag_ptr(this_arg);
15841         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15842         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
15843         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
15844 }
15845
15846 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
15847         void* this_arg_ptr = untag_ptr(this_arg);
15848         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15849         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
15850         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
15851         return ret_conv;
15852 }
15853
15854 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
15855         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
15856         switch(obj->tag) {
15857                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
15858                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: return 1;
15859                 case LDKEffectiveCapacity_Total: return 2;
15860                 case LDKEffectiveCapacity_Infinite: return 3;
15861                 case LDKEffectiveCapacity_HintMaxHTLC: return 4;
15862                 case LDKEffectiveCapacity_Unknown: return 5;
15863                 default: abort();
15864         }
15865 }
15866 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
15867         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
15868         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
15869         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
15870         return liquidity_msat_conv;
15871 }
15872 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat(uint64_t ptr) {
15873         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
15874         assert(obj->tag == LDKEffectiveCapacity_AdvertisedMaxHTLC);
15875         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
15876         return amount_msat_conv;
15877 }
15878 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
15879         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
15880         assert(obj->tag == LDKEffectiveCapacity_Total);
15881         int64_t capacity_msat_conv = obj->total.capacity_msat;
15882         return capacity_msat_conv;
15883 }
15884 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
15885         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
15886         assert(obj->tag == LDKEffectiveCapacity_Total);
15887         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
15888         return htlc_maximum_msat_conv;
15889 }
15890 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat(uint64_t ptr) {
15891         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
15892         assert(obj->tag == LDKEffectiveCapacity_HintMaxHTLC);
15893         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
15894         return amount_msat_conv;
15895 }
15896 uint32_t __attribute__((export_name("TS_LDKPayee_ty_from_ptr"))) TS_LDKPayee_ty_from_ptr(uint64_t ptr) {
15897         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
15898         switch(obj->tag) {
15899                 case LDKPayee_Blinded: return 0;
15900                 case LDKPayee_Clear: return 1;
15901                 default: abort();
15902         }
15903 }
15904 uint64_tArray __attribute__((export_name("TS_LDKPayee_Blinded_get_route_hints"))) TS_LDKPayee_Blinded_get_route_hints(uint64_t ptr) {
15905         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
15906         assert(obj->tag == LDKPayee_Blinded);
15907         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
15908                         uint64_tArray route_hints_arr = NULL;
15909                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
15910                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
15911                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
15912                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
15913                                 *route_hints_conv_37_conv = route_hints_var.data[l];
15914                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
15915                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
15916                         }
15917                         
15918         return route_hints_arr;
15919 }
15920 uint64_t __attribute__((export_name("TS_LDKPayee_Blinded_get_features"))) TS_LDKPayee_Blinded_get_features(uint64_t ptr) {
15921         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
15922         assert(obj->tag == LDKPayee_Blinded);
15923         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
15924                         uint64_t features_ref = 0;
15925                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
15926                         features_ref = tag_ptr(features_var.inner, false);
15927         return features_ref;
15928 }
15929 int8_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_node_id"))) TS_LDKPayee_Clear_get_node_id(uint64_t ptr) {
15930         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
15931         assert(obj->tag == LDKPayee_Clear);
15932         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
15933         memcpy(node_id_arr->elems, obj->clear.node_id.compressed_form, 33);
15934         return node_id_arr;
15935 }
15936 uint64_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_route_hints"))) TS_LDKPayee_Clear_get_route_hints(uint64_t ptr) {
15937         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
15938         assert(obj->tag == LDKPayee_Clear);
15939         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
15940                         uint64_tArray route_hints_arr = NULL;
15941                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
15942                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
15943                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
15944                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
15945                                 uint64_t route_hints_conv_11_ref = 0;
15946                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
15947                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
15948                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
15949                         }
15950                         
15951         return route_hints_arr;
15952 }
15953 uint64_t __attribute__((export_name("TS_LDKPayee_Clear_get_features"))) TS_LDKPayee_Clear_get_features(uint64_t ptr) {
15954         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
15955         assert(obj->tag == LDKPayee_Clear);
15956         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
15957                         uint64_t features_ref = 0;
15958                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
15959                         features_ref = tag_ptr(features_var.inner, false);
15960         return features_ref;
15961 }
15962 int32_t __attribute__((export_name("TS_LDKPayee_Clear_get_final_cltv_expiry_delta"))) TS_LDKPayee_Clear_get_final_cltv_expiry_delta(uint64_t ptr) {
15963         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
15964         assert(obj->tag == LDKPayee_Clear);
15965         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
15966         return final_cltv_expiry_delta_conv;
15967 }
15968 typedef struct LDKScore_JCalls {
15969         atomic_size_t refcnt;
15970         uint32_t instance_ptr;
15971         LDKScoreLookUp_JCalls* ScoreLookUp;
15972         LDKScoreUpdate_JCalls* ScoreUpdate;
15973 } LDKScore_JCalls;
15974 static void LDKScore_JCalls_free(void* this_arg) {
15975         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
15976         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15977                 FREE(j_calls);
15978         }
15979 }
15980 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
15981         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
15982         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 151, 0, 0, 0, 0, 0, 0);
15983         LDKCVec_u8Z ret_ref;
15984         ret_ref.datalen = ret->arr_len;
15985         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
15986         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
15987         return ret_ref;
15988 }
15989 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
15990         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
15991         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15992         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
15993         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
15994 }
15995 static inline LDKScore LDKScore_init (JSValue o, JSValue ScoreLookUp, JSValue ScoreUpdate) {
15996         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
15997         atomic_init(&calls->refcnt, 1);
15998         calls->instance_ptr = o;
15999
16000         LDKScore ret = {
16001                 .this_arg = (void*) calls,
16002                 .write = write_LDKScore_jcall,
16003                 .free = LDKScore_JCalls_free,
16004                 .ScoreLookUp = LDKScoreLookUp_init(ScoreLookUp),
16005                 .ScoreUpdate = LDKScoreUpdate_init(ScoreUpdate),
16006         };
16007         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
16008         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
16009         return ret;
16010 }
16011 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o, JSValue ScoreLookUp, JSValue ScoreUpdate) {
16012         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
16013         *res_ptr = LDKScore_init(o, ScoreLookUp, ScoreUpdate);
16014         return tag_ptr(res_ptr, true);
16015 }
16016 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
16017         void* this_arg_ptr = untag_ptr(this_arg);
16018         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16019         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
16020         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
16021         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16022         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16023         CVec_u8Z_free(ret_var);
16024         return ret_arr;
16025 }
16026
16027 typedef struct LDKCoinSelectionSource_JCalls {
16028         atomic_size_t refcnt;
16029         uint32_t instance_ptr;
16030 } LDKCoinSelectionSource_JCalls;
16031 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
16032         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
16033         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16034                 FREE(j_calls);
16035         }
16036 }
16037 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) {
16038         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
16039         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
16040         memcpy(claim_id_arr->elems, claim_id.data, 32);
16041         LDKCVec_InputZ must_spend_var = must_spend;
16042         uint64_tArray must_spend_arr = NULL;
16043         must_spend_arr = init_uint64_tArray(must_spend_var.datalen, __LINE__);
16044         uint64_t *must_spend_arr_ptr = (uint64_t*)(((uint8_t*)must_spend_arr) + 8);
16045         for (size_t h = 0; h < must_spend_var.datalen; h++) {
16046                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
16047                 uint64_t must_spend_conv_7_ref = 0;
16048                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
16049                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
16050                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
16051         }
16052         
16053         FREE(must_spend_var.data);
16054         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
16055         uint64_tArray must_pay_to_arr = NULL;
16056         must_pay_to_arr = init_uint64_tArray(must_pay_to_var.datalen, __LINE__);
16057         uint64_t *must_pay_to_arr_ptr = (uint64_t*)(((uint8_t*)must_pay_to_arr) + 8);
16058         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
16059                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
16060                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
16061                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
16062         }
16063         
16064         FREE(must_pay_to_var.data);
16065         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
16066         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 152, (uint32_t)claim_id_arr, (uint32_t)must_spend_arr, (uint32_t)must_pay_to_arr, target_feerate_sat_per_1000_weight_conv, 0, 0);
16067         void* ret_ptr = untag_ptr(ret);
16068         CHECK_ACCESS(ret_ptr);
16069         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
16070         FREE(untag_ptr(ret));
16071         return ret_conv;
16072 }
16073 LDKCResult_TransactionNoneZ sign_psbt_LDKCoinSelectionSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
16074         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
16075         LDKCVec_u8Z psbt_var = psbt;
16076         int8_tArray psbt_arr = init_int8_tArray(psbt_var.datalen, __LINE__);
16077         memcpy(psbt_arr->elems, psbt_var.data, psbt_var.datalen);
16078         CVec_u8Z_free(psbt_var);
16079         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 153, (uint32_t)psbt_arr, 0, 0, 0, 0, 0);
16080         void* ret_ptr = untag_ptr(ret);
16081         CHECK_ACCESS(ret_ptr);
16082         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
16083         FREE(untag_ptr(ret));
16084         return ret_conv;
16085 }
16086 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
16087         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
16088         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16089 }
16090 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JSValue o) {
16091         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
16092         atomic_init(&calls->refcnt, 1);
16093         calls->instance_ptr = o;
16094
16095         LDKCoinSelectionSource ret = {
16096                 .this_arg = (void*) calls,
16097                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
16098                 .sign_psbt = sign_psbt_LDKCoinSelectionSource_jcall,
16099                 .free = LDKCoinSelectionSource_JCalls_free,
16100         };
16101         return ret;
16102 }
16103 uint64_t  __attribute__((export_name("TS_LDKCoinSelectionSource_new"))) TS_LDKCoinSelectionSource_new(JSValue o) {
16104         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
16105         *res_ptr = LDKCoinSelectionSource_init(o);
16106         return tag_ptr(res_ptr, true);
16107 }
16108 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) {
16109         void* this_arg_ptr = untag_ptr(this_arg);
16110         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16111         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
16112         LDKThirtyTwoBytes claim_id_ref;
16113         CHECK(claim_id->arr_len == 32);
16114         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
16115         LDKCVec_InputZ must_spend_constr;
16116         must_spend_constr.datalen = must_spend->arr_len;
16117         if (must_spend_constr.datalen > 0)
16118                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
16119         else
16120                 must_spend_constr.data = NULL;
16121         uint64_t* must_spend_vals = must_spend->elems;
16122         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
16123                 uint64_t must_spend_conv_7 = must_spend_vals[h];
16124                 LDKInput must_spend_conv_7_conv;
16125                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
16126                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
16127                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
16128                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
16129                 must_spend_constr.data[h] = must_spend_conv_7_conv;
16130         }
16131         FREE(must_spend);
16132         LDKCVec_TxOutZ must_pay_to_constr;
16133         must_pay_to_constr.datalen = must_pay_to->arr_len;
16134         if (must_pay_to_constr.datalen > 0)
16135                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16136         else
16137                 must_pay_to_constr.data = NULL;
16138         uint64_t* must_pay_to_vals = must_pay_to->elems;
16139         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
16140                 uint64_t must_pay_to_conv_7 = must_pay_to_vals[h];
16141                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
16142                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
16143                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
16144                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
16145                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
16146         }
16147         FREE(must_pay_to);
16148         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
16149         *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);
16150         return tag_ptr(ret_conv, true);
16151 }
16152
16153 uint64_t  __attribute__((export_name("TS_CoinSelectionSource_sign_psbt"))) TS_CoinSelectionSource_sign_psbt(uint64_t this_arg, int8_tArray psbt) {
16154         void* this_arg_ptr = untag_ptr(this_arg);
16155         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16156         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
16157         LDKCVec_u8Z psbt_ref;
16158         psbt_ref.datalen = psbt->arr_len;
16159         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
16160         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
16161         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16162         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
16163         return tag_ptr(ret_conv, true);
16164 }
16165
16166 typedef struct LDKWalletSource_JCalls {
16167         atomic_size_t refcnt;
16168         uint32_t instance_ptr;
16169 } LDKWalletSource_JCalls;
16170 static void LDKWalletSource_JCalls_free(void* this_arg) {
16171         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
16172         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16173                 FREE(j_calls);
16174         }
16175 }
16176 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
16177         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
16178         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 154, 0, 0, 0, 0, 0, 0);
16179         void* ret_ptr = untag_ptr(ret);
16180         CHECK_ACCESS(ret_ptr);
16181         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
16182         FREE(untag_ptr(ret));
16183         return ret_conv;
16184 }
16185 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
16186         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
16187         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 155, 0, 0, 0, 0, 0, 0);
16188         void* ret_ptr = untag_ptr(ret);
16189         CHECK_ACCESS(ret_ptr);
16190         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
16191         FREE(untag_ptr(ret));
16192         return ret_conv;
16193 }
16194 LDKCResult_TransactionNoneZ sign_psbt_LDKWalletSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
16195         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
16196         LDKCVec_u8Z psbt_var = psbt;
16197         int8_tArray psbt_arr = init_int8_tArray(psbt_var.datalen, __LINE__);
16198         memcpy(psbt_arr->elems, psbt_var.data, psbt_var.datalen);
16199         CVec_u8Z_free(psbt_var);
16200         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 156, (uint32_t)psbt_arr, 0, 0, 0, 0, 0);
16201         void* ret_ptr = untag_ptr(ret);
16202         CHECK_ACCESS(ret_ptr);
16203         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
16204         FREE(untag_ptr(ret));
16205         return ret_conv;
16206 }
16207 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
16208         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
16209         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16210 }
16211 static inline LDKWalletSource LDKWalletSource_init (JSValue o) {
16212         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
16213         atomic_init(&calls->refcnt, 1);
16214         calls->instance_ptr = o;
16215
16216         LDKWalletSource ret = {
16217                 .this_arg = (void*) calls,
16218                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
16219                 .get_change_script = get_change_script_LDKWalletSource_jcall,
16220                 .sign_psbt = sign_psbt_LDKWalletSource_jcall,
16221                 .free = LDKWalletSource_JCalls_free,
16222         };
16223         return ret;
16224 }
16225 uint64_t  __attribute__((export_name("TS_LDKWalletSource_new"))) TS_LDKWalletSource_new(JSValue o) {
16226         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
16227         *res_ptr = LDKWalletSource_init(o);
16228         return tag_ptr(res_ptr, true);
16229 }
16230 uint64_t  __attribute__((export_name("TS_WalletSource_list_confirmed_utxos"))) TS_WalletSource_list_confirmed_utxos(uint64_t this_arg) {
16231         void* this_arg_ptr = untag_ptr(this_arg);
16232         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16233         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
16234         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
16235         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
16236         return tag_ptr(ret_conv, true);
16237 }
16238
16239 uint64_t  __attribute__((export_name("TS_WalletSource_get_change_script"))) TS_WalletSource_get_change_script(uint64_t this_arg) {
16240         void* this_arg_ptr = untag_ptr(this_arg);
16241         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16242         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
16243         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
16244         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
16245         return tag_ptr(ret_conv, true);
16246 }
16247
16248 uint64_t  __attribute__((export_name("TS_WalletSource_sign_psbt"))) TS_WalletSource_sign_psbt(uint64_t this_arg, int8_tArray psbt) {
16249         void* this_arg_ptr = untag_ptr(this_arg);
16250         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16251         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
16252         LDKCVec_u8Z psbt_ref;
16253         psbt_ref.datalen = psbt->arr_len;
16254         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
16255         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
16256         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16257         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
16258         return tag_ptr(ret_conv, true);
16259 }
16260
16261 uint32_t __attribute__((export_name("TS_LDKGossipSync_ty_from_ptr"))) TS_LDKGossipSync_ty_from_ptr(uint64_t ptr) {
16262         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
16263         switch(obj->tag) {
16264                 case LDKGossipSync_P2P: return 0;
16265                 case LDKGossipSync_Rapid: return 1;
16266                 case LDKGossipSync_None: return 2;
16267                 default: abort();
16268         }
16269 }
16270 uint64_t __attribute__((export_name("TS_LDKGossipSync_P2P_get_p2p"))) TS_LDKGossipSync_P2P_get_p2p(uint64_t ptr) {
16271         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
16272         assert(obj->tag == LDKGossipSync_P2P);
16273         LDKP2PGossipSync p2p_var = obj->p2p;
16274                         uint64_t p2p_ref = 0;
16275                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
16276                         p2p_ref = tag_ptr(p2p_var.inner, false);
16277         return p2p_ref;
16278 }
16279 uint64_t __attribute__((export_name("TS_LDKGossipSync_Rapid_get_rapid"))) TS_LDKGossipSync_Rapid_get_rapid(uint64_t ptr) {
16280         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
16281         assert(obj->tag == LDKGossipSync_Rapid);
16282         LDKRapidGossipSync rapid_var = obj->rapid;
16283                         uint64_t rapid_ref = 0;
16284                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
16285                         rapid_ref = tag_ptr(rapid_var.inner, false);
16286         return rapid_ref;
16287 }
16288 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
16289         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16290         switch(obj->tag) {
16291                 case LDKFallback_SegWitProgram: return 0;
16292                 case LDKFallback_PubKeyHash: return 1;
16293                 case LDKFallback_ScriptHash: return 2;
16294                 default: abort();
16295         }
16296 }
16297 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
16298         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16299         assert(obj->tag == LDKFallback_SegWitProgram);
16300         uint8_t version_val = obj->seg_wit_program.version._0;
16301         return version_val;
16302 }
16303 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
16304         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16305         assert(obj->tag == LDKFallback_SegWitProgram);
16306         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
16307                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
16308                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
16309         return program_arr;
16310 }
16311 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
16312         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16313         assert(obj->tag == LDKFallback_PubKeyHash);
16314         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
16315         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
16316         return pub_key_hash_arr;
16317 }
16318 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
16319         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16320         assert(obj->tag == LDKFallback_ScriptHash);
16321         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
16322         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
16323         return script_hash_arr;
16324 }
16325 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
16326         LDKStr ret_str = _ldk_get_compiled_version();
16327         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
16328         Str_free(ret_str);
16329         return ret_conv;
16330 }
16331
16332 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
16333         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
16334         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
16335         Str_free(ret_str);
16336         return ret_conv;
16337 }
16338
16339 int8_tArray  __attribute__((export_name("TS_U128_le_bytes"))) TS_U128_le_bytes(int8_tArray val) {
16340         LDKU128 val_ref;
16341         CHECK(val->arr_len == 16);
16342         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
16343         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
16344         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
16345         return ret_arr;
16346 }
16347
16348 int8_tArray  __attribute__((export_name("TS_U128_new"))) TS_U128_new(int8_tArray le_bytes) {
16349         LDKSixteenBytes le_bytes_ref;
16350         CHECK(le_bytes->arr_len == 16);
16351         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
16352         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
16353         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
16354         return ret_arr;
16355 }
16356
16357 uint64_t  __attribute__((export_name("TS_WitnessProgram_new"))) TS_WitnessProgram_new(int8_t version, int8_tArray program) {
16358         
16359         LDKCVec_u8Z program_ref;
16360         program_ref.datalen = program->arr_len;
16361         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
16362         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
16363         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
16364         *ret_ref = WitnessProgram_new((LDKWitnessVersion){ ._0 = version }, program_ref);
16365         return tag_ptr(ret_ref, true);
16366 }
16367
16368 int8_t  __attribute__((export_name("TS_WitnessProgram_get_version"))) TS_WitnessProgram_get_version(uint64_t prog) {
16369         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
16370         uint8_t ret_val = WitnessProgram_get_version(prog_conv)._0;
16371         return ret_val;
16372 }
16373
16374 int8_tArray  __attribute__((export_name("TS_WitnessProgram_get_program"))) TS_WitnessProgram_get_program(uint64_t prog) {
16375         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
16376         LDKu8slice ret_var = WitnessProgram_get_program(prog_conv);
16377         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16378         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16379         return ret_arr;
16380 }
16381
16382 static inline uint64_t WitnessProgram_clone_ptr(LDKWitnessProgram *NONNULL_PTR arg) {
16383         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
16384         *ret_ref = WitnessProgram_clone(arg);
16385         return tag_ptr(ret_ref, true);
16386 }
16387 int64_t  __attribute__((export_name("TS_WitnessProgram_clone_ptr"))) TS_WitnessProgram_clone_ptr(uint64_t arg) {
16388         LDKWitnessProgram* arg_conv = (LDKWitnessProgram*)untag_ptr(arg);
16389         int64_t ret_conv = WitnessProgram_clone_ptr(arg_conv);
16390         return ret_conv;
16391 }
16392
16393 uint64_t  __attribute__((export_name("TS_WitnessProgram_clone"))) TS_WitnessProgram_clone(uint64_t orig) {
16394         LDKWitnessProgram* orig_conv = (LDKWitnessProgram*)untag_ptr(orig);
16395         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
16396         *ret_ref = WitnessProgram_clone(orig_conv);
16397         return tag_ptr(ret_ref, true);
16398 }
16399
16400 void  __attribute__((export_name("TS_WitnessProgram_free"))) TS_WitnessProgram_free(uint64_t o) {
16401         if (!ptr_is_owned(o)) return;
16402         void* o_ptr = untag_ptr(o);
16403         CHECK_ACCESS(o_ptr);
16404         LDKWitnessProgram o_conv = *(LDKWitnessProgram*)(o_ptr);
16405         FREE(untag_ptr(o));
16406         WitnessProgram_free(o_conv);
16407 }
16408
16409 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
16410         LDKThirtyTwoBytes big_endian_bytes_ref;
16411         CHECK(big_endian_bytes->arr_len == 32);
16412         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
16413         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
16414         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
16415         return tag_ptr(ret_ref, true);
16416 }
16417
16418 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
16419         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
16420         *ret_copy = Bech32Error_clone(arg);
16421         uint64_t ret_ref = tag_ptr(ret_copy, true);
16422         return ret_ref;
16423 }
16424 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
16425         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
16426         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
16427         return ret_conv;
16428 }
16429
16430 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
16431         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
16432         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
16433         *ret_copy = Bech32Error_clone(orig_conv);
16434         uint64_t ret_ref = tag_ptr(ret_copy, true);
16435         return ret_ref;
16436 }
16437
16438 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
16439         if (!ptr_is_owned(o)) return;
16440         void* o_ptr = untag_ptr(o);
16441         CHECK_ACCESS(o_ptr);
16442         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
16443         FREE(untag_ptr(o));
16444         Bech32Error_free(o_conv);
16445 }
16446
16447 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
16448         LDKTransaction _res_ref;
16449         _res_ref.datalen = _res->arr_len;
16450         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
16451         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
16452         _res_ref.data_is_owned = true;
16453         Transaction_free(_res_ref);
16454 }
16455
16456 void  __attribute__((export_name("TS_Witness_free"))) TS_Witness_free(int8_tArray _res) {
16457         LDKWitness _res_ref;
16458         _res_ref.datalen = _res->arr_len;
16459         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
16460         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
16461         _res_ref.data_is_owned = true;
16462         Witness_free(_res_ref);
16463 }
16464
16465 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) {
16466         LDKWitness witness_ref;
16467         witness_ref.datalen = witness->arr_len;
16468         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
16469         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
16470         witness_ref.data_is_owned = true;
16471         LDKCVec_u8Z script_sig_ref;
16472         script_sig_ref.datalen = script_sig->arr_len;
16473         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
16474         memcpy(script_sig_ref.data, script_sig->elems, script_sig_ref.datalen); FREE(script_sig);
16475         LDKThirtyTwoBytes previous_txid_ref;
16476         CHECK(previous_txid->arr_len == 32);
16477         memcpy(previous_txid_ref.data, previous_txid->elems, 32); FREE(previous_txid);
16478         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
16479         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
16480         return tag_ptr(ret_ref, true);
16481 }
16482
16483 int8_tArray  __attribute__((export_name("TS_TxIn_get_witness"))) TS_TxIn_get_witness(uint64_t txin) {
16484         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16485         LDKWitness ret_var = TxIn_get_witness(txin_conv);
16486         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16487         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16488         Witness_free(ret_var);
16489         return ret_arr;
16490 }
16491
16492 int8_tArray  __attribute__((export_name("TS_TxIn_get_script_sig"))) TS_TxIn_get_script_sig(uint64_t txin) {
16493         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16494         LDKu8slice ret_var = TxIn_get_script_sig(txin_conv);
16495         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16496         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16497         return ret_arr;
16498 }
16499
16500 int32_t  __attribute__((export_name("TS_TxIn_get_sequence"))) TS_TxIn_get_sequence(uint64_t txin) {
16501         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16502         int32_t ret_conv = TxIn_get_sequence(txin_conv);
16503         return ret_conv;
16504 }
16505
16506 int8_tArray  __attribute__((export_name("TS_TxIn_get_previous_txid"))) TS_TxIn_get_previous_txid(uint64_t txin) {
16507         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16508         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
16509         memcpy(ret_arr->elems, TxIn_get_previous_txid(txin_conv).data, 32);
16510         return ret_arr;
16511 }
16512
16513 int32_t  __attribute__((export_name("TS_TxIn_get_previous_vout"))) TS_TxIn_get_previous_vout(uint64_t txin) {
16514         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16515         int32_t ret_conv = TxIn_get_previous_vout(txin_conv);
16516         return ret_conv;
16517 }
16518
16519 void  __attribute__((export_name("TS_TxIn_free"))) TS_TxIn_free(uint64_t _res) {
16520         if (!ptr_is_owned(_res)) return;
16521         void* _res_ptr = untag_ptr(_res);
16522         CHECK_ACCESS(_res_ptr);
16523         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
16524         FREE(untag_ptr(_res));
16525         TxIn_free(_res_conv);
16526 }
16527
16528 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
16529         LDKCVec_u8Z script_pubkey_ref;
16530         script_pubkey_ref.datalen = script_pubkey->arr_len;
16531         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
16532         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
16533         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
16534         *ret_ref = TxOut_new(script_pubkey_ref, value);
16535         return tag_ptr(ret_ref, true);
16536 }
16537
16538 int8_tArray  __attribute__((export_name("TS_TxOut_get_script_pubkey"))) TS_TxOut_get_script_pubkey(uint64_t txout) {
16539         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
16540         LDKu8slice ret_var = TxOut_get_script_pubkey(txout_conv);
16541         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16542         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16543         return ret_arr;
16544 }
16545
16546 int64_t  __attribute__((export_name("TS_TxOut_get_value"))) TS_TxOut_get_value(uint64_t txout) {
16547         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
16548         int64_t ret_conv = TxOut_get_value(txout_conv);
16549         return ret_conv;
16550 }
16551
16552 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
16553         if (!ptr_is_owned(_res)) return;
16554         void* _res_ptr = untag_ptr(_res);
16555         CHECK_ACCESS(_res_ptr);
16556         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
16557         FREE(untag_ptr(_res));
16558         TxOut_free(_res_conv);
16559 }
16560
16561 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
16562         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
16563         *ret_ref = TxOut_clone(arg);
16564         return tag_ptr(ret_ref, true);
16565 }
16566 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
16567         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
16568         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
16569         return ret_conv;
16570 }
16571
16572 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
16573         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
16574         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
16575         *ret_ref = TxOut_clone(orig_conv);
16576         return tag_ptr(ret_ref, true);
16577 }
16578
16579 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
16580         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
16581         Str_free(dummy);
16582 }
16583
16584 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
16585         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16586         *ret_copy = COption_u64Z_some(o);
16587         uint64_t ret_ref = tag_ptr(ret_copy, true);
16588         return ret_ref;
16589 }
16590
16591 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
16592         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16593         *ret_copy = COption_u64Z_none();
16594         uint64_t ret_ref = tag_ptr(ret_copy, true);
16595         return ret_ref;
16596 }
16597
16598 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
16599         if (!ptr_is_owned(_res)) return;
16600         void* _res_ptr = untag_ptr(_res);
16601         CHECK_ACCESS(_res_ptr);
16602         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
16603         FREE(untag_ptr(_res));
16604         COption_u64Z_free(_res_conv);
16605 }
16606
16607 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
16608         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16609         *ret_copy = COption_u64Z_clone(arg);
16610         uint64_t ret_ref = tag_ptr(ret_copy, true);
16611         return ret_ref;
16612 }
16613 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
16614         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
16615         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
16616         return ret_conv;
16617 }
16618
16619 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
16620         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
16621         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16622         *ret_copy = COption_u64Z_clone(orig_conv);
16623         uint64_t ret_ref = tag_ptr(ret_copy, true);
16624         return ret_ref;
16625 }
16626
16627 void  __attribute__((export_name("TS_CVec_BlindedPathZ_free"))) TS_CVec_BlindedPathZ_free(uint64_tArray _res) {
16628         LDKCVec_BlindedPathZ _res_constr;
16629         _res_constr.datalen = _res->arr_len;
16630         if (_res_constr.datalen > 0)
16631                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
16632         else
16633                 _res_constr.data = NULL;
16634         uint64_t* _res_vals = _res->elems;
16635         for (size_t n = 0; n < _res_constr.datalen; n++) {
16636                 uint64_t _res_conv_13 = _res_vals[n];
16637                 LDKBlindedPath _res_conv_13_conv;
16638                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
16639                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
16640                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
16641                 _res_constr.data[n] = _res_conv_13_conv;
16642         }
16643         FREE(_res);
16644         CVec_BlindedPathZ_free(_res_constr);
16645 }
16646
16647 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_ok"))) TS_CResult_RefundBolt12ParseErrorZ_ok(uint64_t o) {
16648         LDKRefund o_conv;
16649         o_conv.inner = untag_ptr(o);
16650         o_conv.is_owned = ptr_is_owned(o);
16651         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16652         o_conv = Refund_clone(&o_conv);
16653         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
16654         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
16655         return tag_ptr(ret_conv, true);
16656 }
16657
16658 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_err"))) TS_CResult_RefundBolt12ParseErrorZ_err(uint64_t e) {
16659         LDKBolt12ParseError e_conv;
16660         e_conv.inner = untag_ptr(e);
16661         e_conv.is_owned = ptr_is_owned(e);
16662         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16663         e_conv = Bolt12ParseError_clone(&e_conv);
16664         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
16665         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
16666         return tag_ptr(ret_conv, true);
16667 }
16668
16669 jboolean  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_is_ok"))) TS_CResult_RefundBolt12ParseErrorZ_is_ok(uint64_t o) {
16670         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
16671         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
16672         return ret_conv;
16673 }
16674
16675 void  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_free"))) TS_CResult_RefundBolt12ParseErrorZ_free(uint64_t _res) {
16676         if (!ptr_is_owned(_res)) return;
16677         void* _res_ptr = untag_ptr(_res);
16678         CHECK_ACCESS(_res_ptr);
16679         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
16680         FREE(untag_ptr(_res));
16681         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
16682 }
16683
16684 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
16685         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
16686         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
16687         return tag_ptr(ret_conv, true);
16688 }
16689 int64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone_ptr"))) TS_CResult_RefundBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
16690         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
16691         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
16692         return ret_conv;
16693 }
16694
16695 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone"))) TS_CResult_RefundBolt12ParseErrorZ_clone(uint64_t orig) {
16696         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
16697         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
16698         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
16699         return tag_ptr(ret_conv, true);
16700 }
16701
16702 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_ok"))) TS_CResult_RetryDecodeErrorZ_ok(uint64_t o) {
16703         void* o_ptr = untag_ptr(o);
16704         CHECK_ACCESS(o_ptr);
16705         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
16706         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
16707         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
16708         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
16709         return tag_ptr(ret_conv, true);
16710 }
16711
16712 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_err"))) TS_CResult_RetryDecodeErrorZ_err(uint64_t e) {
16713         void* e_ptr = untag_ptr(e);
16714         CHECK_ACCESS(e_ptr);
16715         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16716         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16717         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
16718         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
16719         return tag_ptr(ret_conv, true);
16720 }
16721
16722 jboolean  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_is_ok"))) TS_CResult_RetryDecodeErrorZ_is_ok(uint64_t o) {
16723         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
16724         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
16725         return ret_conv;
16726 }
16727
16728 void  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_free"))) TS_CResult_RetryDecodeErrorZ_free(uint64_t _res) {
16729         if (!ptr_is_owned(_res)) return;
16730         void* _res_ptr = untag_ptr(_res);
16731         CHECK_ACCESS(_res_ptr);
16732         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
16733         FREE(untag_ptr(_res));
16734         CResult_RetryDecodeErrorZ_free(_res_conv);
16735 }
16736
16737 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
16738         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
16739         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
16740         return tag_ptr(ret_conv, true);
16741 }
16742 int64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_clone_ptr"))) TS_CResult_RetryDecodeErrorZ_clone_ptr(uint64_t arg) {
16743         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
16744         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
16745         return ret_conv;
16746 }
16747
16748 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_clone"))) TS_CResult_RetryDecodeErrorZ_clone(uint64_t orig) {
16749         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
16750         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
16751         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
16752         return tag_ptr(ret_conv, true);
16753 }
16754
16755 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
16756         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16757         *ret_conv = CResult_NoneAPIErrorZ_ok();
16758         return tag_ptr(ret_conv, true);
16759 }
16760
16761 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
16762         void* e_ptr = untag_ptr(e);
16763         CHECK_ACCESS(e_ptr);
16764         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16765         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16766         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16767         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
16768         return tag_ptr(ret_conv, true);
16769 }
16770
16771 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
16772         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
16773         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
16774         return ret_conv;
16775 }
16776
16777 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
16778         if (!ptr_is_owned(_res)) return;
16779         void* _res_ptr = untag_ptr(_res);
16780         CHECK_ACCESS(_res_ptr);
16781         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
16782         FREE(untag_ptr(_res));
16783         CResult_NoneAPIErrorZ_free(_res_conv);
16784 }
16785
16786 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
16787         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16788         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
16789         return tag_ptr(ret_conv, true);
16790 }
16791 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
16792         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
16793         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
16794         return ret_conv;
16795 }
16796
16797 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
16798         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
16799         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16800         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
16801         return tag_ptr(ret_conv, true);
16802 }
16803
16804 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
16805         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
16806         _res_constr.datalen = _res->arr_len;
16807         if (_res_constr.datalen > 0)
16808                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
16809         else
16810                 _res_constr.data = NULL;
16811         uint64_t* _res_vals = _res->elems;
16812         for (size_t w = 0; w < _res_constr.datalen; w++) {
16813                 uint64_t _res_conv_22 = _res_vals[w];
16814                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
16815                 CHECK_ACCESS(_res_conv_22_ptr);
16816                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
16817                 FREE(untag_ptr(_res_conv_22));
16818                 _res_constr.data[w] = _res_conv_22_conv;
16819         }
16820         FREE(_res);
16821         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
16822 }
16823
16824 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
16825         LDKCVec_APIErrorZ _res_constr;
16826         _res_constr.datalen = _res->arr_len;
16827         if (_res_constr.datalen > 0)
16828                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
16829         else
16830                 _res_constr.data = NULL;
16831         uint64_t* _res_vals = _res->elems;
16832         for (size_t k = 0; k < _res_constr.datalen; k++) {
16833                 uint64_t _res_conv_10 = _res_vals[k];
16834                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
16835                 CHECK_ACCESS(_res_conv_10_ptr);
16836                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
16837                 FREE(untag_ptr(_res_conv_10));
16838                 _res_constr.data[k] = _res_conv_10_conv;
16839         }
16840         FREE(_res);
16841         CVec_APIErrorZ_free(_res_constr);
16842 }
16843
16844 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_some"))) TS_COption_ThirtyTwoBytesZ_some(int8_tArray o) {
16845         LDKThirtyTwoBytes o_ref;
16846         CHECK(o->arr_len == 32);
16847         memcpy(o_ref.data, o->elems, 32); FREE(o);
16848         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
16849         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
16850         uint64_t ret_ref = tag_ptr(ret_copy, true);
16851         return ret_ref;
16852 }
16853
16854 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_none"))) TS_COption_ThirtyTwoBytesZ_none() {
16855         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
16856         *ret_copy = COption_ThirtyTwoBytesZ_none();
16857         uint64_t ret_ref = tag_ptr(ret_copy, true);
16858         return ret_ref;
16859 }
16860
16861 void  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_free"))) TS_COption_ThirtyTwoBytesZ_free(uint64_t _res) {
16862         if (!ptr_is_owned(_res)) return;
16863         void* _res_ptr = untag_ptr(_res);
16864         CHECK_ACCESS(_res_ptr);
16865         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
16866         FREE(untag_ptr(_res));
16867         COption_ThirtyTwoBytesZ_free(_res_conv);
16868 }
16869
16870 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
16871         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
16872         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
16873         uint64_t ret_ref = tag_ptr(ret_copy, true);
16874         return ret_ref;
16875 }
16876 int64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_clone_ptr"))) TS_COption_ThirtyTwoBytesZ_clone_ptr(uint64_t arg) {
16877         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
16878         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
16879         return ret_conv;
16880 }
16881
16882 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_clone"))) TS_COption_ThirtyTwoBytesZ_clone(uint64_t orig) {
16883         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
16884         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
16885         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
16886         uint64_t ret_ref = tag_ptr(ret_copy, true);
16887         return ret_ref;
16888 }
16889
16890 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
16891         LDKCVec_u8Z _res_ref;
16892         _res_ref.datalen = _res->arr_len;
16893         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
16894         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
16895         CVec_u8Z_free(_res_ref);
16896 }
16897
16898 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_some"))) TS_COption_CVec_u8ZZ_some(int8_tArray o) {
16899         LDKCVec_u8Z o_ref;
16900         o_ref.datalen = o->arr_len;
16901         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
16902         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16903         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
16904         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
16905         uint64_t ret_ref = tag_ptr(ret_copy, true);
16906         return ret_ref;
16907 }
16908
16909 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_none"))) TS_COption_CVec_u8ZZ_none() {
16910         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
16911         *ret_copy = COption_CVec_u8ZZ_none();
16912         uint64_t ret_ref = tag_ptr(ret_copy, true);
16913         return ret_ref;
16914 }
16915
16916 void  __attribute__((export_name("TS_COption_CVec_u8ZZ_free"))) TS_COption_CVec_u8ZZ_free(uint64_t _res) {
16917         if (!ptr_is_owned(_res)) return;
16918         void* _res_ptr = untag_ptr(_res);
16919         CHECK_ACCESS(_res_ptr);
16920         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
16921         FREE(untag_ptr(_res));
16922         COption_CVec_u8ZZ_free(_res_conv);
16923 }
16924
16925 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
16926         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
16927         *ret_copy = COption_CVec_u8ZZ_clone(arg);
16928         uint64_t ret_ref = tag_ptr(ret_copy, true);
16929         return ret_ref;
16930 }
16931 int64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone_ptr"))) TS_COption_CVec_u8ZZ_clone_ptr(uint64_t arg) {
16932         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
16933         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
16934         return ret_conv;
16935 }
16936
16937 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone"))) TS_COption_CVec_u8ZZ_clone(uint64_t orig) {
16938         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
16939         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
16940         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
16941         uint64_t ret_ref = tag_ptr(ret_copy, true);
16942         return ret_ref;
16943 }
16944
16945 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok(uint64_t o) {
16946         LDKRecipientOnionFields o_conv;
16947         o_conv.inner = untag_ptr(o);
16948         o_conv.is_owned = ptr_is_owned(o);
16949         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16950         o_conv = RecipientOnionFields_clone(&o_conv);
16951         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
16952         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
16953         return tag_ptr(ret_conv, true);
16954 }
16955
16956 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_err(uint64_t e) {
16957         void* e_ptr = untag_ptr(e);
16958         CHECK_ACCESS(e_ptr);
16959         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16960         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16961         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
16962         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
16963         return tag_ptr(ret_conv, true);
16964 }
16965
16966 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(uint64_t o) {
16967         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
16968         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
16969         return ret_conv;
16970 }
16971
16972 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_free"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_free(uint64_t _res) {
16973         if (!ptr_is_owned(_res)) return;
16974         void* _res_ptr = untag_ptr(_res);
16975         CHECK_ACCESS(_res_ptr);
16976         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
16977         FREE(untag_ptr(_res));
16978         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
16979 }
16980
16981 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
16982         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
16983         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
16984         return tag_ptr(ret_conv, true);
16985 }
16986 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(uint64_t arg) {
16987         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
16988         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
16989         return ret_conv;
16990 }
16991
16992 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone(uint64_t orig) {
16993         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
16994         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
16995         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
16996         return tag_ptr(ret_conv, true);
16997 }
16998
16999 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
17000         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
17001         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
17002         return tag_ptr(ret_conv, true);
17003 }
17004 int64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_clone_ptr"))) TS_C2Tuple_u64CVec_u8ZZ_clone_ptr(uint64_t arg) {
17005         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
17006         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
17007         return ret_conv;
17008 }
17009
17010 uint64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_clone"))) TS_C2Tuple_u64CVec_u8ZZ_clone(uint64_t orig) {
17011         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
17012         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
17013         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
17014         return tag_ptr(ret_conv, true);
17015 }
17016
17017 uint64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_new"))) TS_C2Tuple_u64CVec_u8ZZ_new(int64_t a, int8_tArray b) {
17018         LDKCVec_u8Z b_ref;
17019         b_ref.datalen = b->arr_len;
17020         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17021         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17022         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
17023         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
17024         return tag_ptr(ret_conv, true);
17025 }
17026
17027 void  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_free"))) TS_C2Tuple_u64CVec_u8ZZ_free(uint64_t _res) {
17028         if (!ptr_is_owned(_res)) return;
17029         void* _res_ptr = untag_ptr(_res);
17030         CHECK_ACCESS(_res_ptr);
17031         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
17032         FREE(untag_ptr(_res));
17033         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
17034 }
17035
17036 void  __attribute__((export_name("TS_CVec_C2Tuple_u64CVec_u8ZZZ_free"))) TS_CVec_C2Tuple_u64CVec_u8ZZZ_free(uint64_tArray _res) {
17037         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
17038         _res_constr.datalen = _res->arr_len;
17039         if (_res_constr.datalen > 0)
17040                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
17041         else
17042                 _res_constr.data = NULL;
17043         uint64_t* _res_vals = _res->elems;
17044         for (size_t x = 0; x < _res_constr.datalen; x++) {
17045                 uint64_t _res_conv_23 = _res_vals[x];
17046                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
17047                 CHECK_ACCESS(_res_conv_23_ptr);
17048                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
17049                 FREE(untag_ptr(_res_conv_23));
17050                 _res_constr.data[x] = _res_conv_23_conv;
17051         }
17052         FREE(_res);
17053         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
17054 }
17055
17056 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_ok(uint64_t o) {
17057         LDKRecipientOnionFields o_conv;
17058         o_conv.inner = untag_ptr(o);
17059         o_conv.is_owned = ptr_is_owned(o);
17060         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17061         o_conv = RecipientOnionFields_clone(&o_conv);
17062         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
17063         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
17064         return tag_ptr(ret_conv, true);
17065 }
17066
17067 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_err"))) TS_CResult_RecipientOnionFieldsNoneZ_err() {
17068         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
17069         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
17070         return tag_ptr(ret_conv, true);
17071 }
17072
17073 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_is_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_is_ok(uint64_t o) {
17074         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
17075         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
17076         return ret_conv;
17077 }
17078
17079 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_free"))) TS_CResult_RecipientOnionFieldsNoneZ_free(uint64_t _res) {
17080         if (!ptr_is_owned(_res)) return;
17081         void* _res_ptr = untag_ptr(_res);
17082         CHECK_ACCESS(_res_ptr);
17083         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
17084         FREE(untag_ptr(_res));
17085         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
17086 }
17087
17088 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
17089         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
17090         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
17091         return tag_ptr(ret_conv, true);
17092 }
17093 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsNoneZ_clone_ptr(uint64_t arg) {
17094         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
17095         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
17096         return ret_conv;
17097 }
17098
17099 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_clone"))) TS_CResult_RecipientOnionFieldsNoneZ_clone(uint64_t orig) {
17100         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
17101         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
17102         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
17103         return tag_ptr(ret_conv, true);
17104 }
17105
17106 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
17107         LDKCVec_ThirtyTwoBytesZ _res_constr;
17108         _res_constr.datalen = _res->arr_len;
17109         if (_res_constr.datalen > 0)
17110                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
17111         else
17112                 _res_constr.data = NULL;
17113         int8_tArray* _res_vals = (void*) _res->elems;
17114         for (size_t m = 0; m < _res_constr.datalen; m++) {
17115                 int8_tArray _res_conv_12 = _res_vals[m];
17116                 LDKThirtyTwoBytes _res_conv_12_ref;
17117                 CHECK(_res_conv_12->arr_len == 32);
17118                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
17119                 _res_constr.data[m] = _res_conv_12_ref;
17120         }
17121         FREE(_res);
17122         CVec_ThirtyTwoBytesZ_free(_res_constr);
17123 }
17124
17125 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_some"))) TS_COption_CVec_ThirtyTwoBytesZZ_some(ptrArray o) {
17126         LDKCVec_ThirtyTwoBytesZ o_constr;
17127         o_constr.datalen = o->arr_len;
17128         if (o_constr.datalen > 0)
17129                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
17130         else
17131                 o_constr.data = NULL;
17132         int8_tArray* o_vals = (void*) o->elems;
17133         for (size_t m = 0; m < o_constr.datalen; m++) {
17134                 int8_tArray o_conv_12 = o_vals[m];
17135                 LDKThirtyTwoBytes o_conv_12_ref;
17136                 CHECK(o_conv_12->arr_len == 32);
17137                 memcpy(o_conv_12_ref.data, o_conv_12->elems, 32); FREE(o_conv_12);
17138                 o_constr.data[m] = o_conv_12_ref;
17139         }
17140         FREE(o);
17141         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17142         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
17143         uint64_t ret_ref = tag_ptr(ret_copy, true);
17144         return ret_ref;
17145 }
17146
17147 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_none"))) TS_COption_CVec_ThirtyTwoBytesZZ_none() {
17148         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17149         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
17150         uint64_t ret_ref = tag_ptr(ret_copy, true);
17151         return ret_ref;
17152 }
17153
17154 void  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_free"))) TS_COption_CVec_ThirtyTwoBytesZZ_free(uint64_t _res) {
17155         if (!ptr_is_owned(_res)) return;
17156         void* _res_ptr = untag_ptr(_res);
17157         CHECK_ACCESS(_res_ptr);
17158         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
17159         FREE(untag_ptr(_res));
17160         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
17161 }
17162
17163 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
17164         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17165         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
17166         uint64_t ret_ref = tag_ptr(ret_copy, true);
17167         return ret_ref;
17168 }
17169 int64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_clone_ptr"))) TS_COption_CVec_ThirtyTwoBytesZZ_clone_ptr(uint64_t arg) {
17170         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
17171         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
17172         return ret_conv;
17173 }
17174
17175 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_clone"))) TS_COption_CVec_ThirtyTwoBytesZZ_clone(uint64_t orig) {
17176         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
17177         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17178         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
17179         uint64_t ret_ref = tag_ptr(ret_copy, true);
17180         return ret_ref;
17181 }
17182
17183 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_ok(int8_tArray o) {
17184         LDKThirtyTwoBytes o_ref;
17185         CHECK(o->arr_len == 32);
17186         memcpy(o_ref.data, o->elems, 32); FREE(o);
17187         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
17188         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
17189         return tag_ptr(ret_conv, true);
17190 }
17191
17192 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_err"))) TS_CResult_ThirtyTwoBytesNoneZ_err() {
17193         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
17194         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
17195         return tag_ptr(ret_conv, true);
17196 }
17197
17198 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_is_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_is_ok(uint64_t o) {
17199         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
17200         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
17201         return ret_conv;
17202 }
17203
17204 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_free"))) TS_CResult_ThirtyTwoBytesNoneZ_free(uint64_t _res) {
17205         if (!ptr_is_owned(_res)) return;
17206         void* _res_ptr = untag_ptr(_res);
17207         CHECK_ACCESS(_res_ptr);
17208         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
17209         FREE(untag_ptr(_res));
17210         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
17211 }
17212
17213 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
17214         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
17215         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
17216         return tag_ptr(ret_conv, true);
17217 }
17218 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesNoneZ_clone_ptr(uint64_t arg) {
17219         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
17220         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
17221         return ret_conv;
17222 }
17223
17224 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_clone"))) TS_CResult_ThirtyTwoBytesNoneZ_clone(uint64_t orig) {
17225         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
17226         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
17227         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
17228         return tag_ptr(ret_conv, true);
17229 }
17230
17231 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_ok(uint64_t o) {
17232         LDKBlindedPayInfo o_conv;
17233         o_conv.inner = untag_ptr(o);
17234         o_conv.is_owned = ptr_is_owned(o);
17235         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17236         o_conv = BlindedPayInfo_clone(&o_conv);
17237         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
17238         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
17239         return tag_ptr(ret_conv, true);
17240 }
17241
17242 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_err(uint64_t e) {
17243         void* e_ptr = untag_ptr(e);
17244         CHECK_ACCESS(e_ptr);
17245         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17246         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17247         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
17248         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
17249         return tag_ptr(ret_conv, true);
17250 }
17251
17252 jboolean  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok(uint64_t o) {
17253         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
17254         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
17255         return ret_conv;
17256 }
17257
17258 void  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_free"))) TS_CResult_BlindedPayInfoDecodeErrorZ_free(uint64_t _res) {
17259         if (!ptr_is_owned(_res)) return;
17260         void* _res_ptr = untag_ptr(_res);
17261         CHECK_ACCESS(_res_ptr);
17262         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
17263         FREE(untag_ptr(_res));
17264         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
17265 }
17266
17267 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
17268         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
17269         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
17270         return tag_ptr(ret_conv, true);
17271 }
17272 int64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
17273         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
17274         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
17275         return ret_conv;
17276 }
17277
17278 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone(uint64_t orig) {
17279         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
17280         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
17281         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
17282         return tag_ptr(ret_conv, true);
17283 }
17284
17285 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
17286         LDKDelayedPaymentOutputDescriptor o_conv;
17287         o_conv.inner = untag_ptr(o);
17288         o_conv.is_owned = ptr_is_owned(o);
17289         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17290         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
17291         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17292         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
17293         return tag_ptr(ret_conv, true);
17294 }
17295
17296 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
17297         void* e_ptr = untag_ptr(e);
17298         CHECK_ACCESS(e_ptr);
17299         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17300         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17301         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17302         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
17303         return tag_ptr(ret_conv, true);
17304 }
17305
17306 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
17307         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17308         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17309         return ret_conv;
17310 }
17311
17312 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
17313         if (!ptr_is_owned(_res)) return;
17314         void* _res_ptr = untag_ptr(_res);
17315         CHECK_ACCESS(_res_ptr);
17316         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
17317         FREE(untag_ptr(_res));
17318         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
17319 }
17320
17321 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17322         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17323         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
17324         return tag_ptr(ret_conv, true);
17325 }
17326 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
17327         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17328         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17329         return ret_conv;
17330 }
17331
17332 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
17333         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17334         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17335         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
17336         return tag_ptr(ret_conv, true);
17337 }
17338
17339 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
17340         LDKStaticPaymentOutputDescriptor o_conv;
17341         o_conv.inner = untag_ptr(o);
17342         o_conv.is_owned = ptr_is_owned(o);
17343         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17344         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
17345         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17346         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
17347         return tag_ptr(ret_conv, true);
17348 }
17349
17350 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
17351         void* e_ptr = untag_ptr(e);
17352         CHECK_ACCESS(e_ptr);
17353         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17354         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17355         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17356         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
17357         return tag_ptr(ret_conv, true);
17358 }
17359
17360 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
17361         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17362         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17363         return ret_conv;
17364 }
17365
17366 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
17367         if (!ptr_is_owned(_res)) return;
17368         void* _res_ptr = untag_ptr(_res);
17369         CHECK_ACCESS(_res_ptr);
17370         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
17371         FREE(untag_ptr(_res));
17372         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
17373 }
17374
17375 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17376         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17377         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
17378         return tag_ptr(ret_conv, true);
17379 }
17380 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
17381         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17382         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17383         return ret_conv;
17384 }
17385
17386 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
17387         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17388         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17389         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
17390         return tag_ptr(ret_conv, true);
17391 }
17392
17393 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
17394         void* o_ptr = untag_ptr(o);
17395         CHECK_ACCESS(o_ptr);
17396         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
17397         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
17398         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17399         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
17400         return tag_ptr(ret_conv, true);
17401 }
17402
17403 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
17404         void* e_ptr = untag_ptr(e);
17405         CHECK_ACCESS(e_ptr);
17406         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17407         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17408         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17409         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
17410         return tag_ptr(ret_conv, true);
17411 }
17412
17413 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
17414         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17415         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17416         return ret_conv;
17417 }
17418
17419 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
17420         if (!ptr_is_owned(_res)) return;
17421         void* _res_ptr = untag_ptr(_res);
17422         CHECK_ACCESS(_res_ptr);
17423         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
17424         FREE(untag_ptr(_res));
17425         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
17426 }
17427
17428 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17429         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17430         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
17431         return tag_ptr(ret_conv, true);
17432 }
17433 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
17434         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17435         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17436         return ret_conv;
17437 }
17438
17439 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
17440         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17441         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17442         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
17443         return tag_ptr(ret_conv, true);
17444 }
17445
17446 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
17447         LDKCVec_SpendableOutputDescriptorZ _res_constr;
17448         _res_constr.datalen = _res->arr_len;
17449         if (_res_constr.datalen > 0)
17450                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
17451         else
17452                 _res_constr.data = NULL;
17453         uint64_t* _res_vals = _res->elems;
17454         for (size_t b = 0; b < _res_constr.datalen; b++) {
17455                 uint64_t _res_conv_27 = _res_vals[b];
17456                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
17457                 CHECK_ACCESS(_res_conv_27_ptr);
17458                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
17459                 FREE(untag_ptr(_res_conv_27));
17460                 _res_constr.data[b] = _res_conv_27_conv;
17461         }
17462         FREE(_res);
17463         CVec_SpendableOutputDescriptorZ_free(_res_constr);
17464 }
17465
17466 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
17467         LDKCVec_TxOutZ _res_constr;
17468         _res_constr.datalen = _res->arr_len;
17469         if (_res_constr.datalen > 0)
17470                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
17471         else
17472                 _res_constr.data = NULL;
17473         uint64_t* _res_vals = _res->elems;
17474         for (size_t h = 0; h < _res_constr.datalen; h++) {
17475                 uint64_t _res_conv_7 = _res_vals[h];
17476                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
17477                 CHECK_ACCESS(_res_conv_7_ptr);
17478                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
17479                 FREE(untag_ptr(_res_conv_7));
17480                 _res_constr.data[h] = _res_conv_7_conv;
17481         }
17482         FREE(_res);
17483         CVec_TxOutZ_free(_res_constr);
17484 }
17485
17486 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
17487         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17488         *ret_copy = COption_u32Z_some(o);
17489         uint64_t ret_ref = tag_ptr(ret_copy, true);
17490         return ret_ref;
17491 }
17492
17493 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
17494         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17495         *ret_copy = COption_u32Z_none();
17496         uint64_t ret_ref = tag_ptr(ret_copy, true);
17497         return ret_ref;
17498 }
17499
17500 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
17501         if (!ptr_is_owned(_res)) return;
17502         void* _res_ptr = untag_ptr(_res);
17503         CHECK_ACCESS(_res_ptr);
17504         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
17505         FREE(untag_ptr(_res));
17506         COption_u32Z_free(_res_conv);
17507 }
17508
17509 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
17510         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17511         *ret_copy = COption_u32Z_clone(arg);
17512         uint64_t ret_ref = tag_ptr(ret_copy, true);
17513         return ret_ref;
17514 }
17515 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
17516         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
17517         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
17518         return ret_conv;
17519 }
17520
17521 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
17522         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
17523         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17524         *ret_copy = COption_u32Z_clone(orig_conv);
17525         uint64_t ret_ref = tag_ptr(ret_copy, true);
17526         return ret_ref;
17527 }
17528
17529 static inline uint64_t C2Tuple_CVec_u8Zu64Z_clone_ptr(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR arg) {
17530         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
17531         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(arg);
17532         return tag_ptr(ret_conv, true);
17533 }
17534 int64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_clone_ptr"))) TS_C2Tuple_CVec_u8Zu64Z_clone_ptr(uint64_t arg) {
17535         LDKC2Tuple_CVec_u8Zu64Z* arg_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(arg);
17536         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_clone_ptr(arg_conv);
17537         return ret_conv;
17538 }
17539
17540 uint64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_clone"))) TS_C2Tuple_CVec_u8Zu64Z_clone(uint64_t orig) {
17541         LDKC2Tuple_CVec_u8Zu64Z* orig_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(orig);
17542         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
17543         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(orig_conv);
17544         return tag_ptr(ret_conv, true);
17545 }
17546
17547 uint64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_new"))) TS_C2Tuple_CVec_u8Zu64Z_new(int8_tArray a, int64_t b) {
17548         LDKCVec_u8Z a_ref;
17549         a_ref.datalen = a->arr_len;
17550         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
17551         memcpy(a_ref.data, a->elems, a_ref.datalen); FREE(a);
17552         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
17553         *ret_conv = C2Tuple_CVec_u8Zu64Z_new(a_ref, b);
17554         return tag_ptr(ret_conv, true);
17555 }
17556
17557 void  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_free"))) TS_C2Tuple_CVec_u8Zu64Z_free(uint64_t _res) {
17558         if (!ptr_is_owned(_res)) return;
17559         void* _res_ptr = untag_ptr(_res);
17560         CHECK_ACCESS(_res_ptr);
17561         LDKC2Tuple_CVec_u8Zu64Z _res_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(_res_ptr);
17562         FREE(untag_ptr(_res));
17563         C2Tuple_CVec_u8Zu64Z_free(_res_conv);
17564 }
17565
17566 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(uint64_t o) {
17567         void* o_ptr = untag_ptr(o);
17568         CHECK_ACCESS(o_ptr);
17569         LDKC2Tuple_CVec_u8Zu64Z o_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(o_ptr);
17570         o_conv = C2Tuple_CVec_u8Zu64Z_clone((LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(o));
17571         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
17572         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o_conv);
17573         return tag_ptr(ret_conv, true);
17574 }
17575
17576 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err() {
17577         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
17578         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err();
17579         return tag_ptr(ret_conv, true);
17580 }
17581
17582 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(uint64_t o) {
17583         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(o);
17584         jboolean ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o_conv);
17585         return ret_conv;
17586 }
17587
17588 void  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(uint64_t _res) {
17589         if (!ptr_is_owned(_res)) return;
17590         void* _res_ptr = untag_ptr(_res);
17591         CHECK_ACCESS(_res_ptr);
17592         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)(_res_ptr);
17593         FREE(untag_ptr(_res));
17594         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res_conv);
17595 }
17596
17597 static inline uint64_t CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR arg) {
17598         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
17599         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(arg);
17600         return tag_ptr(ret_conv, true);
17601 }
17602 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(uint64_t arg) {
17603         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(arg);
17604         int64_t ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(arg_conv);
17605         return ret_conv;
17606 }
17607
17608 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(uint64_t orig) {
17609         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(orig);
17610         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
17611         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig_conv);
17612         return tag_ptr(ret_conv, true);
17613 }
17614
17615 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_ok(uint64_t o) {
17616         LDKChannelDerivationParameters o_conv;
17617         o_conv.inner = untag_ptr(o);
17618         o_conv.is_owned = ptr_is_owned(o);
17619         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17620         o_conv = ChannelDerivationParameters_clone(&o_conv);
17621         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
17622         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
17623         return tag_ptr(ret_conv, true);
17624 }
17625
17626 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_err"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_err(uint64_t e) {
17627         void* e_ptr = untag_ptr(e);
17628         CHECK_ACCESS(e_ptr);
17629         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17630         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17631         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
17632         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
17633         return tag_ptr(ret_conv, true);
17634 }
17635
17636 jboolean  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(uint64_t o) {
17637         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
17638         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
17639         return ret_conv;
17640 }
17641
17642 void  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_free"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_free(uint64_t _res) {
17643         if (!ptr_is_owned(_res)) return;
17644         void* _res_ptr = untag_ptr(_res);
17645         CHECK_ACCESS(_res_ptr);
17646         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
17647         FREE(untag_ptr(_res));
17648         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
17649 }
17650
17651 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
17652         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
17653         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
17654         return tag_ptr(ret_conv, true);
17655 }
17656 int64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
17657         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
17658         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
17659         return ret_conv;
17660 }
17661
17662 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone(uint64_t orig) {
17663         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
17664         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
17665         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
17666         return tag_ptr(ret_conv, true);
17667 }
17668
17669 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_ok(uint64_t o) {
17670         LDKHTLCDescriptor o_conv;
17671         o_conv.inner = untag_ptr(o);
17672         o_conv.is_owned = ptr_is_owned(o);
17673         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17674         o_conv = HTLCDescriptor_clone(&o_conv);
17675         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
17676         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
17677         return tag_ptr(ret_conv, true);
17678 }
17679
17680 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_err"))) TS_CResult_HTLCDescriptorDecodeErrorZ_err(uint64_t e) {
17681         void* e_ptr = untag_ptr(e);
17682         CHECK_ACCESS(e_ptr);
17683         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17684         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17685         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
17686         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
17687         return tag_ptr(ret_conv, true);
17688 }
17689
17690 jboolean  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_is_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_is_ok(uint64_t o) {
17691         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
17692         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
17693         return ret_conv;
17694 }
17695
17696 void  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_free"))) TS_CResult_HTLCDescriptorDecodeErrorZ_free(uint64_t _res) {
17697         if (!ptr_is_owned(_res)) return;
17698         void* _res_ptr = untag_ptr(_res);
17699         CHECK_ACCESS(_res_ptr);
17700         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
17701         FREE(untag_ptr(_res));
17702         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
17703 }
17704
17705 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17706         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
17707         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
17708         return tag_ptr(ret_conv, true);
17709 }
17710 int64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
17711         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
17712         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17713         return ret_conv;
17714 }
17715
17716 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_clone"))) TS_CResult_HTLCDescriptorDecodeErrorZ_clone(uint64_t orig) {
17717         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
17718         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
17719         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
17720         return tag_ptr(ret_conv, true);
17721 }
17722
17723 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
17724         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17725         *ret_conv = CResult_NoneNoneZ_ok();
17726         return tag_ptr(ret_conv, true);
17727 }
17728
17729 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
17730         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17731         *ret_conv = CResult_NoneNoneZ_err();
17732         return tag_ptr(ret_conv, true);
17733 }
17734
17735 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
17736         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
17737         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
17738         return ret_conv;
17739 }
17740
17741 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
17742         if (!ptr_is_owned(_res)) return;
17743         void* _res_ptr = untag_ptr(_res);
17744         CHECK_ACCESS(_res_ptr);
17745         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
17746         FREE(untag_ptr(_res));
17747         CResult_NoneNoneZ_free(_res_conv);
17748 }
17749
17750 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
17751         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17752         *ret_conv = CResult_NoneNoneZ_clone(arg);
17753         return tag_ptr(ret_conv, true);
17754 }
17755 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
17756         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
17757         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
17758         return ret_conv;
17759 }
17760
17761 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
17762         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
17763         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17764         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
17765         return tag_ptr(ret_conv, true);
17766 }
17767
17768 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
17769         LDKPublicKey o_ref;
17770         CHECK(o->arr_len == 33);
17771         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
17772         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
17773         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
17774         return tag_ptr(ret_conv, true);
17775 }
17776
17777 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_err"))) TS_CResult_PublicKeyNoneZ_err() {
17778         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
17779         *ret_conv = CResult_PublicKeyNoneZ_err();
17780         return tag_ptr(ret_conv, true);
17781 }
17782
17783 jboolean  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_is_ok"))) TS_CResult_PublicKeyNoneZ_is_ok(uint64_t o) {
17784         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
17785         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
17786         return ret_conv;
17787 }
17788
17789 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_free"))) TS_CResult_PublicKeyNoneZ_free(uint64_t _res) {
17790         if (!ptr_is_owned(_res)) return;
17791         void* _res_ptr = untag_ptr(_res);
17792         CHECK_ACCESS(_res_ptr);
17793         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
17794         FREE(untag_ptr(_res));
17795         CResult_PublicKeyNoneZ_free(_res_conv);
17796 }
17797
17798 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
17799         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
17800         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
17801         return tag_ptr(ret_conv, true);
17802 }
17803 int64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone_ptr"))) TS_CResult_PublicKeyNoneZ_clone_ptr(uint64_t arg) {
17804         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
17805         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
17806         return ret_conv;
17807 }
17808
17809 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone"))) TS_CResult_PublicKeyNoneZ_clone(uint64_t orig) {
17810         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
17811         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
17812         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
17813         return tag_ptr(ret_conv, true);
17814 }
17815
17816 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_some"))) TS_COption_BigEndianScalarZ_some(uint64_t o) {
17817         void* o_ptr = untag_ptr(o);
17818         CHECK_ACCESS(o_ptr);
17819         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
17820         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
17821         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
17822         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
17823         uint64_t ret_ref = tag_ptr(ret_copy, true);
17824         return ret_ref;
17825 }
17826
17827 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_none"))) TS_COption_BigEndianScalarZ_none() {
17828         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
17829         *ret_copy = COption_BigEndianScalarZ_none();
17830         uint64_t ret_ref = tag_ptr(ret_copy, true);
17831         return ret_ref;
17832 }
17833
17834 void  __attribute__((export_name("TS_COption_BigEndianScalarZ_free"))) TS_COption_BigEndianScalarZ_free(uint64_t _res) {
17835         if (!ptr_is_owned(_res)) return;
17836         void* _res_ptr = untag_ptr(_res);
17837         CHECK_ACCESS(_res_ptr);
17838         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
17839         FREE(untag_ptr(_res));
17840         COption_BigEndianScalarZ_free(_res_conv);
17841 }
17842
17843 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
17844         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
17845         *ret_copy = COption_BigEndianScalarZ_clone(arg);
17846         uint64_t ret_ref = tag_ptr(ret_copy, true);
17847         return ret_ref;
17848 }
17849 int64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_clone_ptr"))) TS_COption_BigEndianScalarZ_clone_ptr(uint64_t arg) {
17850         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
17851         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
17852         return ret_conv;
17853 }
17854
17855 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_clone"))) TS_COption_BigEndianScalarZ_clone(uint64_t orig) {
17856         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
17857         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
17858         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
17859         uint64_t ret_ref = tag_ptr(ret_copy, true);
17860         return ret_ref;
17861 }
17862
17863 void  __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) {
17864         LDKCVec_U5Z _res_constr;
17865         _res_constr.datalen = _res->arr_len;
17866         if (_res_constr.datalen > 0)
17867                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
17868         else
17869                 _res_constr.data = NULL;
17870         int8_t* _res_vals = (void*) _res->elems;
17871         for (size_t h = 0; h < _res_constr.datalen; h++) {
17872                 int8_t _res_conv_7 = _res_vals[h];
17873                 
17874                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
17875         }
17876         FREE(_res);
17877         CVec_U5Z_free(_res_constr);
17878 }
17879
17880 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
17881         LDKRecoverableSignature o_ref;
17882         CHECK(o->arr_len == 68);
17883         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
17884         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17885         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
17886         return tag_ptr(ret_conv, true);
17887 }
17888
17889 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
17890         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17891         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
17892         return tag_ptr(ret_conv, true);
17893 }
17894
17895 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
17896         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
17897         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
17898         return ret_conv;
17899 }
17900
17901 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
17902         if (!ptr_is_owned(_res)) return;
17903         void* _res_ptr = untag_ptr(_res);
17904         CHECK_ACCESS(_res_ptr);
17905         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
17906         FREE(untag_ptr(_res));
17907         CResult_RecoverableSignatureNoneZ_free(_res_conv);
17908 }
17909
17910 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
17911         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17912         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
17913         return tag_ptr(ret_conv, true);
17914 }
17915 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
17916         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
17917         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
17918         return ret_conv;
17919 }
17920
17921 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
17922         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
17923         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17924         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
17925         return tag_ptr(ret_conv, true);
17926 }
17927
17928 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_ok"))) TS_CResult_SchnorrSignatureNoneZ_ok(int8_tArray o) {
17929         LDKSchnorrSignature o_ref;
17930         CHECK(o->arr_len == 64);
17931         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
17932         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
17933         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
17934         return tag_ptr(ret_conv, true);
17935 }
17936
17937 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_err"))) TS_CResult_SchnorrSignatureNoneZ_err() {
17938         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
17939         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
17940         return tag_ptr(ret_conv, true);
17941 }
17942
17943 jboolean  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_is_ok"))) TS_CResult_SchnorrSignatureNoneZ_is_ok(uint64_t o) {
17944         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
17945         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
17946         return ret_conv;
17947 }
17948
17949 void  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_free"))) TS_CResult_SchnorrSignatureNoneZ_free(uint64_t _res) {
17950         if (!ptr_is_owned(_res)) return;
17951         void* _res_ptr = untag_ptr(_res);
17952         CHECK_ACCESS(_res_ptr);
17953         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
17954         FREE(untag_ptr(_res));
17955         CResult_SchnorrSignatureNoneZ_free(_res_conv);
17956 }
17957
17958 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
17959         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
17960         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
17961         return tag_ptr(ret_conv, true);
17962 }
17963 int64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_clone_ptr"))) TS_CResult_SchnorrSignatureNoneZ_clone_ptr(uint64_t arg) {
17964         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
17965         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
17966         return ret_conv;
17967 }
17968
17969 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_clone"))) TS_CResult_SchnorrSignatureNoneZ_clone(uint64_t orig) {
17970         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
17971         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
17972         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
17973         return tag_ptr(ret_conv, true);
17974 }
17975
17976 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_ok"))) TS_CResult_ECDSASignatureNoneZ_ok(int8_tArray o) {
17977         LDKECDSASignature o_ref;
17978         CHECK(o->arr_len == 64);
17979         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
17980         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
17981         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
17982         return tag_ptr(ret_conv, true);
17983 }
17984
17985 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_err"))) TS_CResult_ECDSASignatureNoneZ_err() {
17986         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
17987         *ret_conv = CResult_ECDSASignatureNoneZ_err();
17988         return tag_ptr(ret_conv, true);
17989 }
17990
17991 jboolean  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_is_ok"))) TS_CResult_ECDSASignatureNoneZ_is_ok(uint64_t o) {
17992         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
17993         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
17994         return ret_conv;
17995 }
17996
17997 void  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_free"))) TS_CResult_ECDSASignatureNoneZ_free(uint64_t _res) {
17998         if (!ptr_is_owned(_res)) return;
17999         void* _res_ptr = untag_ptr(_res);
18000         CHECK_ACCESS(_res_ptr);
18001         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
18002         FREE(untag_ptr(_res));
18003         CResult_ECDSASignatureNoneZ_free(_res_conv);
18004 }
18005
18006 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
18007         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
18008         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
18009         return tag_ptr(ret_conv, true);
18010 }
18011 int64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_clone_ptr"))) TS_CResult_ECDSASignatureNoneZ_clone_ptr(uint64_t arg) {
18012         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
18013         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
18014         return ret_conv;
18015 }
18016
18017 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_clone"))) TS_CResult_ECDSASignatureNoneZ_clone(uint64_t orig) {
18018         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
18019         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
18020         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
18021         return tag_ptr(ret_conv, true);
18022 }
18023
18024 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(uint64_t o) {
18025         void* o_ptr = untag_ptr(o);
18026         CHECK_ACCESS(o_ptr);
18027         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
18028         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
18029                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18030                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
18031         }
18032         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
18033         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
18034         return tag_ptr(ret_conv, true);
18035 }
18036
18037 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(uint64_t e) {
18038         void* e_ptr = untag_ptr(e);
18039         CHECK_ACCESS(e_ptr);
18040         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18041         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18042         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
18043         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
18044         return tag_ptr(ret_conv, true);
18045 }
18046
18047 jboolean  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(uint64_t o) {
18048         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
18049         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
18050         return ret_conv;
18051 }
18052
18053 void  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(uint64_t _res) {
18054         if (!ptr_is_owned(_res)) return;
18055         void* _res_ptr = untag_ptr(_res);
18056         CHECK_ACCESS(_res_ptr);
18057         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
18058         FREE(untag_ptr(_res));
18059         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
18060 }
18061
18062 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
18063         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
18064         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
18065         return tag_ptr(ret_conv, true);
18066 }
18067 int64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(uint64_t arg) {
18068         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
18069         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
18070         return ret_conv;
18071 }
18072
18073 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(uint64_t orig) {
18074         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
18075         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
18076         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
18077         return tag_ptr(ret_conv, true);
18078 }
18079
18080 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_ok"))) TS_CResult_CVec_u8ZNoneZ_ok(int8_tArray o) {
18081         LDKCVec_u8Z o_ref;
18082         o_ref.datalen = o->arr_len;
18083         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
18084         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18085         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
18086         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
18087         return tag_ptr(ret_conv, true);
18088 }
18089
18090 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_err"))) TS_CResult_CVec_u8ZNoneZ_err() {
18091         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
18092         *ret_conv = CResult_CVec_u8ZNoneZ_err();
18093         return tag_ptr(ret_conv, true);
18094 }
18095
18096 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_is_ok"))) TS_CResult_CVec_u8ZNoneZ_is_ok(uint64_t o) {
18097         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
18098         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
18099         return ret_conv;
18100 }
18101
18102 void  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_free"))) TS_CResult_CVec_u8ZNoneZ_free(uint64_t _res) {
18103         if (!ptr_is_owned(_res)) return;
18104         void* _res_ptr = untag_ptr(_res);
18105         CHECK_ACCESS(_res_ptr);
18106         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
18107         FREE(untag_ptr(_res));
18108         CResult_CVec_u8ZNoneZ_free(_res_conv);
18109 }
18110
18111 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
18112         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
18113         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
18114         return tag_ptr(ret_conv, true);
18115 }
18116 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_clone_ptr"))) TS_CResult_CVec_u8ZNoneZ_clone_ptr(uint64_t arg) {
18117         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
18118         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
18119         return ret_conv;
18120 }
18121
18122 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_clone"))) TS_CResult_CVec_u8ZNoneZ_clone(uint64_t orig) {
18123         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
18124         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
18125         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
18126         return tag_ptr(ret_conv, true);
18127 }
18128
18129 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_ok"))) TS_CResult_ShutdownScriptNoneZ_ok(uint64_t o) {
18130         LDKShutdownScript o_conv;
18131         o_conv.inner = untag_ptr(o);
18132         o_conv.is_owned = ptr_is_owned(o);
18133         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18134         o_conv = ShutdownScript_clone(&o_conv);
18135         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
18136         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
18137         return tag_ptr(ret_conv, true);
18138 }
18139
18140 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_err"))) TS_CResult_ShutdownScriptNoneZ_err() {
18141         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
18142         *ret_conv = CResult_ShutdownScriptNoneZ_err();
18143         return tag_ptr(ret_conv, true);
18144 }
18145
18146 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_is_ok"))) TS_CResult_ShutdownScriptNoneZ_is_ok(uint64_t o) {
18147         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
18148         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
18149         return ret_conv;
18150 }
18151
18152 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_free"))) TS_CResult_ShutdownScriptNoneZ_free(uint64_t _res) {
18153         if (!ptr_is_owned(_res)) return;
18154         void* _res_ptr = untag_ptr(_res);
18155         CHECK_ACCESS(_res_ptr);
18156         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
18157         FREE(untag_ptr(_res));
18158         CResult_ShutdownScriptNoneZ_free(_res_conv);
18159 }
18160
18161 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
18162         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
18163         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
18164         return tag_ptr(ret_conv, true);
18165 }
18166 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone_ptr"))) TS_CResult_ShutdownScriptNoneZ_clone_ptr(uint64_t arg) {
18167         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
18168         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
18169         return ret_conv;
18170 }
18171
18172 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone"))) TS_CResult_ShutdownScriptNoneZ_clone(uint64_t orig) {
18173         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
18174         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
18175         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
18176         return tag_ptr(ret_conv, true);
18177 }
18178
18179 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
18180         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18181         *ret_copy = COption_u16Z_some(o);
18182         uint64_t ret_ref = tag_ptr(ret_copy, true);
18183         return ret_ref;
18184 }
18185
18186 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
18187         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18188         *ret_copy = COption_u16Z_none();
18189         uint64_t ret_ref = tag_ptr(ret_copy, true);
18190         return ret_ref;
18191 }
18192
18193 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
18194         if (!ptr_is_owned(_res)) return;
18195         void* _res_ptr = untag_ptr(_res);
18196         CHECK_ACCESS(_res_ptr);
18197         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
18198         FREE(untag_ptr(_res));
18199         COption_u16Z_free(_res_conv);
18200 }
18201
18202 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
18203         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18204         *ret_copy = COption_u16Z_clone(arg);
18205         uint64_t ret_ref = tag_ptr(ret_copy, true);
18206         return ret_ref;
18207 }
18208 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
18209         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
18210         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
18211         return ret_conv;
18212 }
18213
18214 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
18215         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
18216         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18217         *ret_copy = COption_u16Z_clone(orig_conv);
18218         uint64_t ret_ref = tag_ptr(ret_copy, true);
18219         return ret_ref;
18220 }
18221
18222 uint64_t  __attribute__((export_name("TS_COption_boolZ_some"))) TS_COption_boolZ_some(jboolean o) {
18223         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
18224         *ret_copy = COption_boolZ_some(o);
18225         uint64_t ret_ref = tag_ptr(ret_copy, true);
18226         return ret_ref;
18227 }
18228
18229 uint64_t  __attribute__((export_name("TS_COption_boolZ_none"))) TS_COption_boolZ_none() {
18230         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
18231         *ret_copy = COption_boolZ_none();
18232         uint64_t ret_ref = tag_ptr(ret_copy, true);
18233         return ret_ref;
18234 }
18235
18236 void  __attribute__((export_name("TS_COption_boolZ_free"))) TS_COption_boolZ_free(uint64_t _res) {
18237         if (!ptr_is_owned(_res)) return;
18238         void* _res_ptr = untag_ptr(_res);
18239         CHECK_ACCESS(_res_ptr);
18240         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
18241         FREE(untag_ptr(_res));
18242         COption_boolZ_free(_res_conv);
18243 }
18244
18245 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
18246         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
18247         *ret_copy = COption_boolZ_clone(arg);
18248         uint64_t ret_ref = tag_ptr(ret_copy, true);
18249         return ret_ref;
18250 }
18251 int64_t  __attribute__((export_name("TS_COption_boolZ_clone_ptr"))) TS_COption_boolZ_clone_ptr(uint64_t arg) {
18252         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
18253         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
18254         return ret_conv;
18255 }
18256
18257 uint64_t  __attribute__((export_name("TS_COption_boolZ_clone"))) TS_COption_boolZ_clone(uint64_t orig) {
18258         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
18259         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
18260         *ret_copy = COption_boolZ_clone(orig_conv);
18261         uint64_t ret_ref = tag_ptr(ret_copy, true);
18262         return ret_ref;
18263 }
18264
18265 uint64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_ok"))) TS_CResult_WitnessNoneZ_ok(int8_tArray o) {
18266         LDKWitness o_ref;
18267         o_ref.datalen = o->arr_len;
18268         o_ref.data = MALLOC(o_ref.datalen, "LDKWitness Bytes");
18269         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18270         o_ref.data_is_owned = true;
18271         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
18272         *ret_conv = CResult_WitnessNoneZ_ok(o_ref);
18273         return tag_ptr(ret_conv, true);
18274 }
18275
18276 uint64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_err"))) TS_CResult_WitnessNoneZ_err() {
18277         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
18278         *ret_conv = CResult_WitnessNoneZ_err();
18279         return tag_ptr(ret_conv, true);
18280 }
18281
18282 jboolean  __attribute__((export_name("TS_CResult_WitnessNoneZ_is_ok"))) TS_CResult_WitnessNoneZ_is_ok(uint64_t o) {
18283         LDKCResult_WitnessNoneZ* o_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(o);
18284         jboolean ret_conv = CResult_WitnessNoneZ_is_ok(o_conv);
18285         return ret_conv;
18286 }
18287
18288 void  __attribute__((export_name("TS_CResult_WitnessNoneZ_free"))) TS_CResult_WitnessNoneZ_free(uint64_t _res) {
18289         if (!ptr_is_owned(_res)) return;
18290         void* _res_ptr = untag_ptr(_res);
18291         CHECK_ACCESS(_res_ptr);
18292         LDKCResult_WitnessNoneZ _res_conv = *(LDKCResult_WitnessNoneZ*)(_res_ptr);
18293         FREE(untag_ptr(_res));
18294         CResult_WitnessNoneZ_free(_res_conv);
18295 }
18296
18297 static inline uint64_t CResult_WitnessNoneZ_clone_ptr(LDKCResult_WitnessNoneZ *NONNULL_PTR arg) {
18298         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
18299         *ret_conv = CResult_WitnessNoneZ_clone(arg);
18300         return tag_ptr(ret_conv, true);
18301 }
18302 int64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_clone_ptr"))) TS_CResult_WitnessNoneZ_clone_ptr(uint64_t arg) {
18303         LDKCResult_WitnessNoneZ* arg_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(arg);
18304         int64_t ret_conv = CResult_WitnessNoneZ_clone_ptr(arg_conv);
18305         return ret_conv;
18306 }
18307
18308 uint64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_clone"))) TS_CResult_WitnessNoneZ_clone(uint64_t orig) {
18309         LDKCResult_WitnessNoneZ* orig_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(orig);
18310         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
18311         *ret_conv = CResult_WitnessNoneZ_clone(orig_conv);
18312         return tag_ptr(ret_conv, true);
18313 }
18314
18315 void  __attribute__((export_name("TS_CVec_ECDSASignatureZ_free"))) TS_CVec_ECDSASignatureZ_free(ptrArray _res) {
18316         LDKCVec_ECDSASignatureZ _res_constr;
18317         _res_constr.datalen = _res->arr_len;
18318         if (_res_constr.datalen > 0)
18319                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
18320         else
18321                 _res_constr.data = NULL;
18322         int8_tArray* _res_vals = (void*) _res->elems;
18323         for (size_t m = 0; m < _res_constr.datalen; m++) {
18324                 int8_tArray _res_conv_12 = _res_vals[m];
18325                 LDKECDSASignature _res_conv_12_ref;
18326                 CHECK(_res_conv_12->arr_len == 64);
18327                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
18328                 _res_constr.data[m] = _res_conv_12_ref;
18329         }
18330         FREE(_res);
18331         CVec_ECDSASignatureZ_free(_res_constr);
18332 }
18333
18334 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
18335         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
18336         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
18337         return tag_ptr(ret_conv, true);
18338 }
18339 int64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(uint64_t arg) {
18340         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
18341         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
18342         return ret_conv;
18343 }
18344
18345 uint64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(uint64_t orig) {
18346         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
18347         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
18348         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
18349         return tag_ptr(ret_conv, true);
18350 }
18351
18352 uint64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(int8_tArray a, ptrArray b) {
18353         LDKECDSASignature a_ref;
18354         CHECK(a->arr_len == 64);
18355         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
18356         LDKCVec_ECDSASignatureZ b_constr;
18357         b_constr.datalen = b->arr_len;
18358         if (b_constr.datalen > 0)
18359                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
18360         else
18361                 b_constr.data = NULL;
18362         int8_tArray* b_vals = (void*) b->elems;
18363         for (size_t m = 0; m < b_constr.datalen; m++) {
18364                 int8_tArray b_conv_12 = b_vals[m];
18365                 LDKECDSASignature b_conv_12_ref;
18366                 CHECK(b_conv_12->arr_len == 64);
18367                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
18368                 b_constr.data[m] = b_conv_12_ref;
18369         }
18370         FREE(b);
18371         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
18372         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
18373         return tag_ptr(ret_conv, true);
18374 }
18375
18376 void  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(uint64_t _res) {
18377         if (!ptr_is_owned(_res)) return;
18378         void* _res_ptr = untag_ptr(_res);
18379         CHECK_ACCESS(_res_ptr);
18380         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
18381         FREE(untag_ptr(_res));
18382         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
18383 }
18384
18385 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(uint64_t o) {
18386         void* o_ptr = untag_ptr(o);
18387         CHECK_ACCESS(o_ptr);
18388         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
18389         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
18390         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
18391         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
18392         return tag_ptr(ret_conv, true);
18393 }
18394
18395 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() {
18396         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
18397         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
18398         return tag_ptr(ret_conv, true);
18399 }
18400
18401 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(uint64_t o) {
18402         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
18403         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
18404         return ret_conv;
18405 }
18406
18407 void  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(uint64_t _res) {
18408         if (!ptr_is_owned(_res)) return;
18409         void* _res_ptr = untag_ptr(_res);
18410         CHECK_ACCESS(_res_ptr);
18411         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
18412         FREE(untag_ptr(_res));
18413         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
18414 }
18415
18416 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
18417         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
18418         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
18419         return tag_ptr(ret_conv, true);
18420 }
18421 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(uint64_t arg) {
18422         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
18423         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
18424         return ret_conv;
18425 }
18426
18427 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(uint64_t orig) {
18428         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
18429         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
18430         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
18431         return tag_ptr(ret_conv, true);
18432 }
18433
18434 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
18435         LDKInMemorySigner o_conv;
18436         o_conv.inner = untag_ptr(o);
18437         o_conv.is_owned = ptr_is_owned(o);
18438         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18439         o_conv = InMemorySigner_clone(&o_conv);
18440         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18441         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
18442         return tag_ptr(ret_conv, true);
18443 }
18444
18445 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
18446         void* e_ptr = untag_ptr(e);
18447         CHECK_ACCESS(e_ptr);
18448         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18449         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18450         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18451         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
18452         return tag_ptr(ret_conv, true);
18453 }
18454
18455 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
18456         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
18457         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
18458         return ret_conv;
18459 }
18460
18461 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
18462         if (!ptr_is_owned(_res)) return;
18463         void* _res_ptr = untag_ptr(_res);
18464         CHECK_ACCESS(_res_ptr);
18465         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
18466         FREE(untag_ptr(_res));
18467         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
18468 }
18469
18470 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
18471         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18472         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
18473         return tag_ptr(ret_conv, true);
18474 }
18475 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
18476         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
18477         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
18478         return ret_conv;
18479 }
18480
18481 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
18482         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
18483         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18484         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
18485         return tag_ptr(ret_conv, true);
18486 }
18487
18488 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
18489         LDKTransaction o_ref;
18490         o_ref.datalen = o->arr_len;
18491         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
18492         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18493         o_ref.data_is_owned = true;
18494         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18495         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
18496         return tag_ptr(ret_conv, true);
18497 }
18498
18499 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
18500         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18501         *ret_conv = CResult_TransactionNoneZ_err();
18502         return tag_ptr(ret_conv, true);
18503 }
18504
18505 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
18506         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
18507         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
18508         return ret_conv;
18509 }
18510
18511 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
18512         if (!ptr_is_owned(_res)) return;
18513         void* _res_ptr = untag_ptr(_res);
18514         CHECK_ACCESS(_res_ptr);
18515         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
18516         FREE(untag_ptr(_res));
18517         CResult_TransactionNoneZ_free(_res_conv);
18518 }
18519
18520 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
18521         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18522         *ret_conv = CResult_TransactionNoneZ_clone(arg);
18523         return tag_ptr(ret_conv, true);
18524 }
18525 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
18526         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
18527         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
18528         return ret_conv;
18529 }
18530
18531 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
18532         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
18533         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18534         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
18535         return tag_ptr(ret_conv, true);
18536 }
18537
18538 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
18539         LDKCVec_ChannelDetailsZ _res_constr;
18540         _res_constr.datalen = _res->arr_len;
18541         if (_res_constr.datalen > 0)
18542                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
18543         else
18544                 _res_constr.data = NULL;
18545         uint64_t* _res_vals = _res->elems;
18546         for (size_t q = 0; q < _res_constr.datalen; q++) {
18547                 uint64_t _res_conv_16 = _res_vals[q];
18548                 LDKChannelDetails _res_conv_16_conv;
18549                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
18550                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
18551                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
18552                 _res_constr.data[q] = _res_conv_16_conv;
18553         }
18554         FREE(_res);
18555         CVec_ChannelDetailsZ_free(_res_constr);
18556 }
18557
18558 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
18559         LDKRoute o_conv;
18560         o_conv.inner = untag_ptr(o);
18561         o_conv.is_owned = ptr_is_owned(o);
18562         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18563         o_conv = Route_clone(&o_conv);
18564         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18565         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
18566         return tag_ptr(ret_conv, true);
18567 }
18568
18569 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
18570         LDKLightningError e_conv;
18571         e_conv.inner = untag_ptr(e);
18572         e_conv.is_owned = ptr_is_owned(e);
18573         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18574         e_conv = LightningError_clone(&e_conv);
18575         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18576         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
18577         return tag_ptr(ret_conv, true);
18578 }
18579
18580 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
18581         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
18582         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
18583         return ret_conv;
18584 }
18585
18586 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
18587         if (!ptr_is_owned(_res)) return;
18588         void* _res_ptr = untag_ptr(_res);
18589         CHECK_ACCESS(_res_ptr);
18590         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
18591         FREE(untag_ptr(_res));
18592         CResult_RouteLightningErrorZ_free(_res_conv);
18593 }
18594
18595 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
18596         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18597         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
18598         return tag_ptr(ret_conv, true);
18599 }
18600 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
18601         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
18602         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
18603         return ret_conv;
18604 }
18605
18606 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
18607         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
18608         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18609         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
18610         return tag_ptr(ret_conv, true);
18611 }
18612
18613 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
18614         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
18615         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
18616         return tag_ptr(ret_conv, true);
18617 }
18618 int64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(uint64_t arg) {
18619         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
18620         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
18621         return ret_conv;
18622 }
18623
18624 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone(uint64_t orig) {
18625         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
18626         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
18627         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
18628         return tag_ptr(ret_conv, true);
18629 }
18630
18631 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_new"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_new(uint64_t a, uint64_t b) {
18632         LDKBlindedPayInfo a_conv;
18633         a_conv.inner = untag_ptr(a);
18634         a_conv.is_owned = ptr_is_owned(a);
18635         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18636         a_conv = BlindedPayInfo_clone(&a_conv);
18637         LDKBlindedPath b_conv;
18638         b_conv.inner = untag_ptr(b);
18639         b_conv.is_owned = ptr_is_owned(b);
18640         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18641         b_conv = BlindedPath_clone(&b_conv);
18642         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
18643         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
18644         return tag_ptr(ret_conv, true);
18645 }
18646
18647 void  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_free"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_free(uint64_t _res) {
18648         if (!ptr_is_owned(_res)) return;
18649         void* _res_ptr = untag_ptr(_res);
18650         CHECK_ACCESS(_res_ptr);
18651         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
18652         FREE(untag_ptr(_res));
18653         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
18654 }
18655
18656 void  __attribute__((export_name("TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free"))) TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(uint64_tArray _res) {
18657         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
18658         _res_constr.datalen = _res->arr_len;
18659         if (_res_constr.datalen > 0)
18660                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
18661         else
18662                 _res_constr.data = NULL;
18663         uint64_t* _res_vals = _res->elems;
18664         for (size_t l = 0; l < _res_constr.datalen; l++) {
18665                 uint64_t _res_conv_37 = _res_vals[l];
18666                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
18667                 CHECK_ACCESS(_res_conv_37_ptr);
18668                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
18669                 FREE(untag_ptr(_res_conv_37));
18670                 _res_constr.data[l] = _res_conv_37_conv;
18671         }
18672         FREE(_res);
18673         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
18674 }
18675
18676 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(uint64_tArray o) {
18677         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ o_constr;
18678         o_constr.datalen = o->arr_len;
18679         if (o_constr.datalen > 0)
18680                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
18681         else
18682                 o_constr.data = NULL;
18683         uint64_t* o_vals = o->elems;
18684         for (size_t l = 0; l < o_constr.datalen; l++) {
18685                 uint64_t o_conv_37 = o_vals[l];
18686                 void* o_conv_37_ptr = untag_ptr(o_conv_37);
18687                 CHECK_ACCESS(o_conv_37_ptr);
18688                 LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_conv_37_ptr);
18689                 o_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o_conv_37));
18690                 o_constr.data[l] = o_conv_37_conv;
18691         }
18692         FREE(o);
18693         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
18694         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o_constr);
18695         return tag_ptr(ret_conv, true);
18696 }
18697
18698 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err() {
18699         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
18700         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err();
18701         return tag_ptr(ret_conv, true);
18702 }
18703
18704 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(uint64_t o) {
18705         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* o_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(o);
18706         jboolean ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o_conv);
18707         return ret_conv;
18708 }
18709
18710 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(uint64_t _res) {
18711         if (!ptr_is_owned(_res)) return;
18712         void* _res_ptr = untag_ptr(_res);
18713         CHECK_ACCESS(_res_ptr);
18714         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(_res_ptr);
18715         FREE(untag_ptr(_res));
18716         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res_conv);
18717 }
18718
18719 static inline uint64_t CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR arg) {
18720         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
18721         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(arg);
18722         return tag_ptr(ret_conv, true);
18723 }
18724 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(uint64_t arg) {
18725         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(arg);
18726         int64_t ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(arg_conv);
18727         return ret_conv;
18728 }
18729
18730 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(uint64_t orig) {
18731         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(orig);
18732         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
18733         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig_conv);
18734         return tag_ptr(ret_conv, true);
18735 }
18736
18737 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
18738         LDKCVec_PublicKeyZ _res_constr;
18739         _res_constr.datalen = _res->arr_len;
18740         if (_res_constr.datalen > 0)
18741                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
18742         else
18743                 _res_constr.data = NULL;
18744         int8_tArray* _res_vals = (void*) _res->elems;
18745         for (size_t m = 0; m < _res_constr.datalen; m++) {
18746                 int8_tArray _res_conv_12 = _res_vals[m];
18747                 LDKPublicKey _res_conv_12_ref;
18748                 CHECK(_res_conv_12->arr_len == 33);
18749                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
18750                 _res_constr.data[m] = _res_conv_12_ref;
18751         }
18752         FREE(_res);
18753         CVec_PublicKeyZ_free(_res_constr);
18754 }
18755
18756 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_ok"))) TS_CResult_OnionMessagePathNoneZ_ok(uint64_t o) {
18757         LDKOnionMessagePath o_conv;
18758         o_conv.inner = untag_ptr(o);
18759         o_conv.is_owned = ptr_is_owned(o);
18760         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18761         o_conv = OnionMessagePath_clone(&o_conv);
18762         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
18763         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
18764         return tag_ptr(ret_conv, true);
18765 }
18766
18767 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_err"))) TS_CResult_OnionMessagePathNoneZ_err() {
18768         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
18769         *ret_conv = CResult_OnionMessagePathNoneZ_err();
18770         return tag_ptr(ret_conv, true);
18771 }
18772
18773 jboolean  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_is_ok"))) TS_CResult_OnionMessagePathNoneZ_is_ok(uint64_t o) {
18774         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
18775         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
18776         return ret_conv;
18777 }
18778
18779 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_free"))) TS_CResult_OnionMessagePathNoneZ_free(uint64_t _res) {
18780         if (!ptr_is_owned(_res)) return;
18781         void* _res_ptr = untag_ptr(_res);
18782         CHECK_ACCESS(_res_ptr);
18783         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
18784         FREE(untag_ptr(_res));
18785         CResult_OnionMessagePathNoneZ_free(_res_conv);
18786 }
18787
18788 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
18789         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
18790         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
18791         return tag_ptr(ret_conv, true);
18792 }
18793 int64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone_ptr"))) TS_CResult_OnionMessagePathNoneZ_clone_ptr(uint64_t arg) {
18794         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
18795         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
18796         return ret_conv;
18797 }
18798
18799 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone"))) TS_CResult_OnionMessagePathNoneZ_clone(uint64_t orig) {
18800         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
18801         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
18802         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
18803         return tag_ptr(ret_conv, true);
18804 }
18805
18806 uint64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_ok"))) TS_CResult_CVec_BlindedPathZNoneZ_ok(uint64_tArray o) {
18807         LDKCVec_BlindedPathZ o_constr;
18808         o_constr.datalen = o->arr_len;
18809         if (o_constr.datalen > 0)
18810                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
18811         else
18812                 o_constr.data = NULL;
18813         uint64_t* o_vals = o->elems;
18814         for (size_t n = 0; n < o_constr.datalen; n++) {
18815                 uint64_t o_conv_13 = o_vals[n];
18816                 LDKBlindedPath o_conv_13_conv;
18817                 o_conv_13_conv.inner = untag_ptr(o_conv_13);
18818                 o_conv_13_conv.is_owned = ptr_is_owned(o_conv_13);
18819                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_13_conv);
18820                 o_conv_13_conv = BlindedPath_clone(&o_conv_13_conv);
18821                 o_constr.data[n] = o_conv_13_conv;
18822         }
18823         FREE(o);
18824         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
18825         *ret_conv = CResult_CVec_BlindedPathZNoneZ_ok(o_constr);
18826         return tag_ptr(ret_conv, true);
18827 }
18828
18829 uint64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_err"))) TS_CResult_CVec_BlindedPathZNoneZ_err() {
18830         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
18831         *ret_conv = CResult_CVec_BlindedPathZNoneZ_err();
18832         return tag_ptr(ret_conv, true);
18833 }
18834
18835 jboolean  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_is_ok"))) TS_CResult_CVec_BlindedPathZNoneZ_is_ok(uint64_t o) {
18836         LDKCResult_CVec_BlindedPathZNoneZ* o_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(o);
18837         jboolean ret_conv = CResult_CVec_BlindedPathZNoneZ_is_ok(o_conv);
18838         return ret_conv;
18839 }
18840
18841 void  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_free"))) TS_CResult_CVec_BlindedPathZNoneZ_free(uint64_t _res) {
18842         if (!ptr_is_owned(_res)) return;
18843         void* _res_ptr = untag_ptr(_res);
18844         CHECK_ACCESS(_res_ptr);
18845         LDKCResult_CVec_BlindedPathZNoneZ _res_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(_res_ptr);
18846         FREE(untag_ptr(_res));
18847         CResult_CVec_BlindedPathZNoneZ_free(_res_conv);
18848 }
18849
18850 static inline uint64_t CResult_CVec_BlindedPathZNoneZ_clone_ptr(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR arg) {
18851         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
18852         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(arg);
18853         return tag_ptr(ret_conv, true);
18854 }
18855 int64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_clone_ptr"))) TS_CResult_CVec_BlindedPathZNoneZ_clone_ptr(uint64_t arg) {
18856         LDKCResult_CVec_BlindedPathZNoneZ* arg_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(arg);
18857         int64_t ret_conv = CResult_CVec_BlindedPathZNoneZ_clone_ptr(arg_conv);
18858         return ret_conv;
18859 }
18860
18861 uint64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_clone"))) TS_CResult_CVec_BlindedPathZNoneZ_clone(uint64_t orig) {
18862         LDKCResult_CVec_BlindedPathZNoneZ* orig_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(orig);
18863         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
18864         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(orig_conv);
18865         return tag_ptr(ret_conv, true);
18866 }
18867
18868 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
18869         LDKInFlightHtlcs o_conv;
18870         o_conv.inner = untag_ptr(o);
18871         o_conv.is_owned = ptr_is_owned(o);
18872         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18873         o_conv = InFlightHtlcs_clone(&o_conv);
18874         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
18875         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
18876         return tag_ptr(ret_conv, true);
18877 }
18878
18879 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
18880         void* e_ptr = untag_ptr(e);
18881         CHECK_ACCESS(e_ptr);
18882         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18883         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18884         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
18885         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
18886         return tag_ptr(ret_conv, true);
18887 }
18888
18889 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
18890         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
18891         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
18892         return ret_conv;
18893 }
18894
18895 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
18896         if (!ptr_is_owned(_res)) return;
18897         void* _res_ptr = untag_ptr(_res);
18898         CHECK_ACCESS(_res_ptr);
18899         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
18900         FREE(untag_ptr(_res));
18901         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
18902 }
18903
18904 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
18905         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
18906         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
18907         return tag_ptr(ret_conv, true);
18908 }
18909 int64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(uint64_t arg) {
18910         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
18911         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
18912         return ret_conv;
18913 }
18914
18915 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone(uint64_t orig) {
18916         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
18917         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
18918         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
18919         return tag_ptr(ret_conv, true);
18920 }
18921
18922 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
18923         LDKRouteHop o_conv;
18924         o_conv.inner = untag_ptr(o);
18925         o_conv.is_owned = ptr_is_owned(o);
18926         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18927         o_conv = RouteHop_clone(&o_conv);
18928         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
18929         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
18930         return tag_ptr(ret_conv, true);
18931 }
18932
18933 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
18934         void* e_ptr = untag_ptr(e);
18935         CHECK_ACCESS(e_ptr);
18936         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18937         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18938         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
18939         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
18940         return tag_ptr(ret_conv, true);
18941 }
18942
18943 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
18944         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
18945         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
18946         return ret_conv;
18947 }
18948
18949 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
18950         if (!ptr_is_owned(_res)) return;
18951         void* _res_ptr = untag_ptr(_res);
18952         CHECK_ACCESS(_res_ptr);
18953         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
18954         FREE(untag_ptr(_res));
18955         CResult_RouteHopDecodeErrorZ_free(_res_conv);
18956 }
18957
18958 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
18959         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
18960         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
18961         return tag_ptr(ret_conv, true);
18962 }
18963 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
18964         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
18965         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
18966         return ret_conv;
18967 }
18968
18969 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
18970         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
18971         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
18972         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
18973         return tag_ptr(ret_conv, true);
18974 }
18975
18976 void  __attribute__((export_name("TS_CVec_BlindedHopZ_free"))) TS_CVec_BlindedHopZ_free(uint64_tArray _res) {
18977         LDKCVec_BlindedHopZ _res_constr;
18978         _res_constr.datalen = _res->arr_len;
18979         if (_res_constr.datalen > 0)
18980                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
18981         else
18982                 _res_constr.data = NULL;
18983         uint64_t* _res_vals = _res->elems;
18984         for (size_t m = 0; m < _res_constr.datalen; m++) {
18985                 uint64_t _res_conv_12 = _res_vals[m];
18986                 LDKBlindedHop _res_conv_12_conv;
18987                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
18988                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
18989                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
18990                 _res_constr.data[m] = _res_conv_12_conv;
18991         }
18992         FREE(_res);
18993         CVec_BlindedHopZ_free(_res_constr);
18994 }
18995
18996 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_ok"))) TS_CResult_BlindedTailDecodeErrorZ_ok(uint64_t o) {
18997         LDKBlindedTail o_conv;
18998         o_conv.inner = untag_ptr(o);
18999         o_conv.is_owned = ptr_is_owned(o);
19000         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19001         o_conv = BlindedTail_clone(&o_conv);
19002         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
19003         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
19004         return tag_ptr(ret_conv, true);
19005 }
19006
19007 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_err"))) TS_CResult_BlindedTailDecodeErrorZ_err(uint64_t e) {
19008         void* e_ptr = untag_ptr(e);
19009         CHECK_ACCESS(e_ptr);
19010         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19011         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19012         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
19013         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
19014         return tag_ptr(ret_conv, true);
19015 }
19016
19017 jboolean  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_is_ok"))) TS_CResult_BlindedTailDecodeErrorZ_is_ok(uint64_t o) {
19018         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
19019         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
19020         return ret_conv;
19021 }
19022
19023 void  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_free"))) TS_CResult_BlindedTailDecodeErrorZ_free(uint64_t _res) {
19024         if (!ptr_is_owned(_res)) return;
19025         void* _res_ptr = untag_ptr(_res);
19026         CHECK_ACCESS(_res_ptr);
19027         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
19028         FREE(untag_ptr(_res));
19029         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
19030 }
19031
19032 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
19033         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
19034         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
19035         return tag_ptr(ret_conv, true);
19036 }
19037 int64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedTailDecodeErrorZ_clone_ptr(uint64_t arg) {
19038         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
19039         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
19040         return ret_conv;
19041 }
19042
19043 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone"))) TS_CResult_BlindedTailDecodeErrorZ_clone(uint64_t orig) {
19044         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
19045         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
19046         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
19047         return tag_ptr(ret_conv, true);
19048 }
19049
19050 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
19051         LDKCVec_RouteHopZ _res_constr;
19052         _res_constr.datalen = _res->arr_len;
19053         if (_res_constr.datalen > 0)
19054                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19055         else
19056                 _res_constr.data = NULL;
19057         uint64_t* _res_vals = _res->elems;
19058         for (size_t k = 0; k < _res_constr.datalen; k++) {
19059                 uint64_t _res_conv_10 = _res_vals[k];
19060                 LDKRouteHop _res_conv_10_conv;
19061                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
19062                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
19063                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
19064                 _res_constr.data[k] = _res_conv_10_conv;
19065         }
19066         FREE(_res);
19067         CVec_RouteHopZ_free(_res_constr);
19068 }
19069
19070 void  __attribute__((export_name("TS_CVec_PathZ_free"))) TS_CVec_PathZ_free(uint64_tArray _res) {
19071         LDKCVec_PathZ _res_constr;
19072         _res_constr.datalen = _res->arr_len;
19073         if (_res_constr.datalen > 0)
19074                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
19075         else
19076                 _res_constr.data = NULL;
19077         uint64_t* _res_vals = _res->elems;
19078         for (size_t g = 0; g < _res_constr.datalen; g++) {
19079                 uint64_t _res_conv_6 = _res_vals[g];
19080                 LDKPath _res_conv_6_conv;
19081                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
19082                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
19083                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
19084                 _res_constr.data[g] = _res_conv_6_conv;
19085         }
19086         FREE(_res);
19087         CVec_PathZ_free(_res_constr);
19088 }
19089
19090 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
19091         LDKRoute o_conv;
19092         o_conv.inner = untag_ptr(o);
19093         o_conv.is_owned = ptr_is_owned(o);
19094         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19095         o_conv = Route_clone(&o_conv);
19096         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
19097         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
19098         return tag_ptr(ret_conv, true);
19099 }
19100
19101 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
19102         void* e_ptr = untag_ptr(e);
19103         CHECK_ACCESS(e_ptr);
19104         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19105         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19106         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
19107         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
19108         return tag_ptr(ret_conv, true);
19109 }
19110
19111 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
19112         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
19113         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
19114         return ret_conv;
19115 }
19116
19117 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
19118         if (!ptr_is_owned(_res)) return;
19119         void* _res_ptr = untag_ptr(_res);
19120         CHECK_ACCESS(_res_ptr);
19121         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
19122         FREE(untag_ptr(_res));
19123         CResult_RouteDecodeErrorZ_free(_res_conv);
19124 }
19125
19126 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
19127         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
19128         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
19129         return tag_ptr(ret_conv, true);
19130 }
19131 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
19132         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
19133         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
19134         return ret_conv;
19135 }
19136
19137 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
19138         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
19139         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
19140         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
19141         return tag_ptr(ret_conv, true);
19142 }
19143
19144 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
19145         LDKRouteParameters o_conv;
19146         o_conv.inner = untag_ptr(o);
19147         o_conv.is_owned = ptr_is_owned(o);
19148         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19149         o_conv = RouteParameters_clone(&o_conv);
19150         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
19151         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
19152         return tag_ptr(ret_conv, true);
19153 }
19154
19155 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
19156         void* e_ptr = untag_ptr(e);
19157         CHECK_ACCESS(e_ptr);
19158         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19159         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19160         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
19161         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
19162         return tag_ptr(ret_conv, true);
19163 }
19164
19165 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
19166         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
19167         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
19168         return ret_conv;
19169 }
19170
19171 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
19172         if (!ptr_is_owned(_res)) return;
19173         void* _res_ptr = untag_ptr(_res);
19174         CHECK_ACCESS(_res_ptr);
19175         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
19176         FREE(untag_ptr(_res));
19177         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
19178 }
19179
19180 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
19181         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
19182         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
19183         return tag_ptr(ret_conv, true);
19184 }
19185 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
19186         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
19187         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
19188         return ret_conv;
19189 }
19190
19191 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
19192         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
19193         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
19194         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
19195         return tag_ptr(ret_conv, true);
19196 }
19197
19198 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
19199         LDKCVec_u64Z _res_constr;
19200         _res_constr.datalen = _res->arr_len;
19201         if (_res_constr.datalen > 0)
19202                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19203         else
19204                 _res_constr.data = NULL;
19205         int64_t* _res_vals = _res->elems;
19206         for (size_t i = 0; i < _res_constr.datalen; i++) {
19207                 int64_t _res_conv_8 = _res_vals[i];
19208                 _res_constr.data[i] = _res_conv_8;
19209         }
19210         FREE(_res);
19211         CVec_u64Z_free(_res_constr);
19212 }
19213
19214 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
19215         LDKPaymentParameters o_conv;
19216         o_conv.inner = untag_ptr(o);
19217         o_conv.is_owned = ptr_is_owned(o);
19218         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19219         o_conv = PaymentParameters_clone(&o_conv);
19220         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
19221         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
19222         return tag_ptr(ret_conv, true);
19223 }
19224
19225 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
19226         void* e_ptr = untag_ptr(e);
19227         CHECK_ACCESS(e_ptr);
19228         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19229         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19230         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
19231         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
19232         return tag_ptr(ret_conv, true);
19233 }
19234
19235 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
19236         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
19237         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
19238         return ret_conv;
19239 }
19240
19241 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
19242         if (!ptr_is_owned(_res)) return;
19243         void* _res_ptr = untag_ptr(_res);
19244         CHECK_ACCESS(_res_ptr);
19245         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
19246         FREE(untag_ptr(_res));
19247         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
19248 }
19249
19250 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
19251         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
19252         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
19253         return tag_ptr(ret_conv, true);
19254 }
19255 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
19256         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
19257         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
19258         return ret_conv;
19259 }
19260
19261 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
19262         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
19263         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
19264         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
19265         return tag_ptr(ret_conv, true);
19266 }
19267
19268 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
19269         LDKCVec_RouteHintZ _res_constr;
19270         _res_constr.datalen = _res->arr_len;
19271         if (_res_constr.datalen > 0)
19272                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
19273         else
19274                 _res_constr.data = NULL;
19275         uint64_t* _res_vals = _res->elems;
19276         for (size_t l = 0; l < _res_constr.datalen; l++) {
19277                 uint64_t _res_conv_11 = _res_vals[l];
19278                 LDKRouteHint _res_conv_11_conv;
19279                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
19280                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
19281                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
19282                 _res_constr.data[l] = _res_conv_11_conv;
19283         }
19284         FREE(_res);
19285         CVec_RouteHintZ_free(_res_constr);
19286 }
19287
19288 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
19289         LDKCVec_RouteHintHopZ _res_constr;
19290         _res_constr.datalen = _res->arr_len;
19291         if (_res_constr.datalen > 0)
19292                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
19293         else
19294                 _res_constr.data = NULL;
19295         uint64_t* _res_vals = _res->elems;
19296         for (size_t o = 0; o < _res_constr.datalen; o++) {
19297                 uint64_t _res_conv_14 = _res_vals[o];
19298                 LDKRouteHintHop _res_conv_14_conv;
19299                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
19300                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
19301                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
19302                 _res_constr.data[o] = _res_conv_14_conv;
19303         }
19304         FREE(_res);
19305         CVec_RouteHintHopZ_free(_res_constr);
19306 }
19307
19308 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
19309         LDKRouteHint o_conv;
19310         o_conv.inner = untag_ptr(o);
19311         o_conv.is_owned = ptr_is_owned(o);
19312         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19313         o_conv = RouteHint_clone(&o_conv);
19314         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
19315         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
19316         return tag_ptr(ret_conv, true);
19317 }
19318
19319 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
19320         void* e_ptr = untag_ptr(e);
19321         CHECK_ACCESS(e_ptr);
19322         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19323         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19324         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
19325         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
19326         return tag_ptr(ret_conv, true);
19327 }
19328
19329 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
19330         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
19331         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
19332         return ret_conv;
19333 }
19334
19335 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
19336         if (!ptr_is_owned(_res)) return;
19337         void* _res_ptr = untag_ptr(_res);
19338         CHECK_ACCESS(_res_ptr);
19339         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
19340         FREE(untag_ptr(_res));
19341         CResult_RouteHintDecodeErrorZ_free(_res_conv);
19342 }
19343
19344 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
19345         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
19346         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
19347         return tag_ptr(ret_conv, true);
19348 }
19349 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
19350         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
19351         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
19352         return ret_conv;
19353 }
19354
19355 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
19356         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
19357         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
19358         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
19359         return tag_ptr(ret_conv, true);
19360 }
19361
19362 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
19363         LDKRouteHintHop o_conv;
19364         o_conv.inner = untag_ptr(o);
19365         o_conv.is_owned = ptr_is_owned(o);
19366         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19367         o_conv = RouteHintHop_clone(&o_conv);
19368         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
19369         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
19370         return tag_ptr(ret_conv, true);
19371 }
19372
19373 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
19374         void* e_ptr = untag_ptr(e);
19375         CHECK_ACCESS(e_ptr);
19376         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19377         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19378         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
19379         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
19380         return tag_ptr(ret_conv, true);
19381 }
19382
19383 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
19384         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
19385         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
19386         return ret_conv;
19387 }
19388
19389 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
19390         if (!ptr_is_owned(_res)) return;
19391         void* _res_ptr = untag_ptr(_res);
19392         CHECK_ACCESS(_res_ptr);
19393         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
19394         FREE(untag_ptr(_res));
19395         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
19396 }
19397
19398 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
19399         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
19400         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
19401         return tag_ptr(ret_conv, true);
19402 }
19403 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
19404         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
19405         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
19406         return ret_conv;
19407 }
19408
19409 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
19410         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
19411         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
19412         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
19413         return tag_ptr(ret_conv, true);
19414 }
19415
19416 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
19417         LDKFixedPenaltyScorer o_conv;
19418         o_conv.inner = untag_ptr(o);
19419         o_conv.is_owned = ptr_is_owned(o);
19420         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19421         o_conv = FixedPenaltyScorer_clone(&o_conv);
19422         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
19423         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
19424         return tag_ptr(ret_conv, true);
19425 }
19426
19427 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
19428         void* e_ptr = untag_ptr(e);
19429         CHECK_ACCESS(e_ptr);
19430         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19431         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19432         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
19433         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
19434         return tag_ptr(ret_conv, true);
19435 }
19436
19437 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
19438         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
19439         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
19440         return ret_conv;
19441 }
19442
19443 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
19444         if (!ptr_is_owned(_res)) return;
19445         void* _res_ptr = untag_ptr(_res);
19446         CHECK_ACCESS(_res_ptr);
19447         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
19448         FREE(untag_ptr(_res));
19449         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
19450 }
19451
19452 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
19453         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
19454         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
19455         return tag_ptr(ret_conv, true);
19456 }
19457 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
19458         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
19459         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
19460         return ret_conv;
19461 }
19462
19463 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
19464         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
19465         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
19466         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
19467         return tag_ptr(ret_conv, true);
19468 }
19469
19470 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
19471         LDKCVec_NodeIdZ _res_constr;
19472         _res_constr.datalen = _res->arr_len;
19473         if (_res_constr.datalen > 0)
19474                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
19475         else
19476                 _res_constr.data = NULL;
19477         uint64_t* _res_vals = _res->elems;
19478         for (size_t i = 0; i < _res_constr.datalen; i++) {
19479                 uint64_t _res_conv_8 = _res_vals[i];
19480                 LDKNodeId _res_conv_8_conv;
19481                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
19482                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
19483                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
19484                 _res_constr.data[i] = _res_conv_8_conv;
19485         }
19486         FREE(_res);
19487         CVec_NodeIdZ_free(_res_constr);
19488 }
19489
19490 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
19491         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
19492         *ret_conv = C2Tuple_u64u64Z_clone(arg);
19493         return tag_ptr(ret_conv, true);
19494 }
19495 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
19496         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
19497         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
19498         return ret_conv;
19499 }
19500
19501 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
19502         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
19503         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
19504         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
19505         return tag_ptr(ret_conv, true);
19506 }
19507
19508 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
19509         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
19510         *ret_conv = C2Tuple_u64u64Z_new(a, b);
19511         return tag_ptr(ret_conv, true);
19512 }
19513
19514 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
19515         if (!ptr_is_owned(_res)) return;
19516         void* _res_ptr = untag_ptr(_res);
19517         CHECK_ACCESS(_res_ptr);
19518         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
19519         FREE(untag_ptr(_res));
19520         C2Tuple_u64u64Z_free(_res_conv);
19521 }
19522
19523 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
19524         void* o_ptr = untag_ptr(o);
19525         CHECK_ACCESS(o_ptr);
19526         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
19527         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
19528         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
19529         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
19530         uint64_t ret_ref = tag_ptr(ret_copy, true);
19531         return ret_ref;
19532 }
19533
19534 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
19535         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
19536         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
19537         uint64_t ret_ref = tag_ptr(ret_copy, true);
19538         return ret_ref;
19539 }
19540
19541 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
19542         if (!ptr_is_owned(_res)) return;
19543         void* _res_ptr = untag_ptr(_res);
19544         CHECK_ACCESS(_res_ptr);
19545         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
19546         FREE(untag_ptr(_res));
19547         COption_C2Tuple_u64u64ZZ_free(_res_conv);
19548 }
19549
19550 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
19551         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
19552         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
19553         uint64_t ret_ref = tag_ptr(ret_copy, true);
19554         return ret_ref;
19555 }
19556 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
19557         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
19558         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
19559         return ret_conv;
19560 }
19561
19562 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
19563         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
19564         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
19565         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
19566         uint64_t ret_ref = tag_ptr(ret_copy, true);
19567         return ret_ref;
19568 }
19569
19570 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_new"))) TS_C2Tuple_Z_new(int16_tArray a, int16_tArray b) {
19571         LDKThirtyTwoU16s a_ref;
19572         CHECK(a->arr_len == 32);
19573         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
19574         LDKThirtyTwoU16s b_ref;
19575         CHECK(b->arr_len == 32);
19576         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
19577         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
19578         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
19579         return tag_ptr(ret_conv, true);
19580 }
19581
19582 void  __attribute__((export_name("TS_C2Tuple_Z_free"))) TS_C2Tuple_Z_free(uint64_t _res) {
19583         if (!ptr_is_owned(_res)) return;
19584         void* _res_ptr = untag_ptr(_res);
19585         CHECK_ACCESS(_res_ptr);
19586         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
19587         FREE(untag_ptr(_res));
19588         C2Tuple_Z_free(_res_conv);
19589 }
19590
19591 uint64_t  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_new"))) TS_C2Tuple__u1632_u1632Z_new(int16_tArray a, int16_tArray b) {
19592         LDKThirtyTwoU16s a_ref;
19593         CHECK(a->arr_len == 32);
19594         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
19595         LDKThirtyTwoU16s b_ref;
19596         CHECK(b->arr_len == 32);
19597         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
19598         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
19599         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
19600         return tag_ptr(ret_conv, true);
19601 }
19602
19603 void  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_free"))) TS_C2Tuple__u1632_u1632Z_free(uint64_t _res) {
19604         if (!ptr_is_owned(_res)) return;
19605         void* _res_ptr = untag_ptr(_res);
19606         CHECK_ACCESS(_res_ptr);
19607         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
19608         FREE(untag_ptr(_res));
19609         C2Tuple__u1632_u1632Z_free(_res_conv);
19610 }
19611
19612 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(uint64_t o) {
19613         void* o_ptr = untag_ptr(o);
19614         CHECK_ACCESS(o_ptr);
19615         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
19616         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
19617         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
19618         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
19619         uint64_t ret_ref = tag_ptr(ret_copy, true);
19620         return ret_ref;
19621 }
19622
19623 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() {
19624         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
19625         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
19626         uint64_t ret_ref = tag_ptr(ret_copy, true);
19627         return ret_ref;
19628 }
19629
19630 void  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(uint64_t _res) {
19631         if (!ptr_is_owned(_res)) return;
19632         void* _res_ptr = untag_ptr(_res);
19633         CHECK_ACCESS(_res_ptr);
19634         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
19635         FREE(untag_ptr(_res));
19636         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
19637 }
19638
19639 uint64_t  __attribute__((export_name("TS_COption_f64Z_some"))) TS_COption_f64Z_some(double o) {
19640         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
19641         *ret_copy = COption_f64Z_some(o);
19642         uint64_t ret_ref = tag_ptr(ret_copy, true);
19643         return ret_ref;
19644 }
19645
19646 uint64_t  __attribute__((export_name("TS_COption_f64Z_none"))) TS_COption_f64Z_none() {
19647         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
19648         *ret_copy = COption_f64Z_none();
19649         uint64_t ret_ref = tag_ptr(ret_copy, true);
19650         return ret_ref;
19651 }
19652
19653 void  __attribute__((export_name("TS_COption_f64Z_free"))) TS_COption_f64Z_free(uint64_t _res) {
19654         if (!ptr_is_owned(_res)) return;
19655         void* _res_ptr = untag_ptr(_res);
19656         CHECK_ACCESS(_res_ptr);
19657         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
19658         FREE(untag_ptr(_res));
19659         COption_f64Z_free(_res_conv);
19660 }
19661
19662 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
19663         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
19664         *ret_copy = COption_f64Z_clone(arg);
19665         uint64_t ret_ref = tag_ptr(ret_copy, true);
19666         return ret_ref;
19667 }
19668 int64_t  __attribute__((export_name("TS_COption_f64Z_clone_ptr"))) TS_COption_f64Z_clone_ptr(uint64_t arg) {
19669         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
19670         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
19671         return ret_conv;
19672 }
19673
19674 uint64_t  __attribute__((export_name("TS_COption_f64Z_clone"))) TS_COption_f64Z_clone(uint64_t orig) {
19675         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
19676         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
19677         *ret_copy = COption_f64Z_clone(orig_conv);
19678         uint64_t ret_ref = tag_ptr(ret_copy, true);
19679         return ret_ref;
19680 }
19681
19682 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
19683         LDKProbabilisticScorer o_conv;
19684         o_conv.inner = untag_ptr(o);
19685         o_conv.is_owned = ptr_is_owned(o);
19686         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19687         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
19688         
19689         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
19690         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
19691         return tag_ptr(ret_conv, true);
19692 }
19693
19694 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
19695         void* e_ptr = untag_ptr(e);
19696         CHECK_ACCESS(e_ptr);
19697         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19698         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19699         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
19700         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
19701         return tag_ptr(ret_conv, true);
19702 }
19703
19704 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
19705         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
19706         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
19707         return ret_conv;
19708 }
19709
19710 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
19711         if (!ptr_is_owned(_res)) return;
19712         void* _res_ptr = untag_ptr(_res);
19713         CHECK_ACCESS(_res_ptr);
19714         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
19715         FREE(untag_ptr(_res));
19716         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
19717 }
19718
19719 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
19720         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
19721         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
19722         return tag_ptr(ret_conv, true);
19723 }
19724 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
19725         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
19726         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
19727         return ret_conv;
19728 }
19729
19730 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
19731         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
19732         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
19733         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
19734         return tag_ptr(ret_conv, true);
19735 }
19736
19737 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
19738         LDKTransaction b_ref;
19739         b_ref.datalen = b->arr_len;
19740         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
19741         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
19742         b_ref.data_is_owned = true;
19743         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
19744         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
19745         return tag_ptr(ret_conv, true);
19746 }
19747
19748 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
19749         if (!ptr_is_owned(_res)) return;
19750         void* _res_ptr = untag_ptr(_res);
19751         CHECK_ACCESS(_res_ptr);
19752         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
19753         FREE(untag_ptr(_res));
19754         C2Tuple_usizeTransactionZ_free(_res_conv);
19755 }
19756
19757 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
19758         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
19759         _res_constr.datalen = _res->arr_len;
19760         if (_res_constr.datalen > 0)
19761                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
19762         else
19763                 _res_constr.data = NULL;
19764         uint64_t* _res_vals = _res->elems;
19765         for (size_t c = 0; c < _res_constr.datalen; c++) {
19766                 uint64_t _res_conv_28 = _res_vals[c];
19767                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
19768                 CHECK_ACCESS(_res_conv_28_ptr);
19769                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
19770                 FREE(untag_ptr(_res_conv_28));
19771                 _res_constr.data[c] = _res_conv_28_conv;
19772         }
19773         FREE(_res);
19774         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
19775 }
19776
19777 static inline uint64_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
19778         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
19779         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(arg);
19780         return tag_ptr(ret_conv, true);
19781 }
19782 int64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(uint64_t arg) {
19783         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(arg);
19784         int64_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
19785         return ret_conv;
19786 }
19787
19788 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(uint64_t orig) {
19789         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(orig);
19790         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
19791         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig_conv);
19792         return tag_ptr(ret_conv, true);
19793 }
19794
19795 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(int8_tArray a, int32_t b, uint64_t c) {
19796         LDKThirtyTwoBytes a_ref;
19797         CHECK(a->arr_len == 32);
19798         memcpy(a_ref.data, a->elems, 32); FREE(a);
19799         void* c_ptr = untag_ptr(c);
19800         CHECK_ACCESS(c_ptr);
19801         LDKCOption_ThirtyTwoBytesZ c_conv = *(LDKCOption_ThirtyTwoBytesZ*)(c_ptr);
19802         c_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(c));
19803         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
19804         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a_ref, b, c_conv);
19805         return tag_ptr(ret_conv, true);
19806 }
19807
19808 void  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(uint64_t _res) {
19809         if (!ptr_is_owned(_res)) return;
19810         void* _res_ptr = untag_ptr(_res);
19811         CHECK_ACCESS(_res_ptr);
19812         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_ptr);
19813         FREE(untag_ptr(_res));
19814         C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res_conv);
19815 }
19816
19817 void  __attribute__((export_name("TS_CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free"))) TS_CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(uint64_tArray _res) {
19818         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ _res_constr;
19819         _res_constr.datalen = _res->arr_len;
19820         if (_res_constr.datalen > 0)
19821                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
19822         else
19823                 _res_constr.data = NULL;
19824         uint64_t* _res_vals = _res->elems;
19825         for (size_t c = 0; c < _res_constr.datalen; c++) {
19826                 uint64_t _res_conv_54 = _res_vals[c];
19827                 void* _res_conv_54_ptr = untag_ptr(_res_conv_54);
19828                 CHECK_ACCESS(_res_conv_54_ptr);
19829                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_conv_54_ptr);
19830                 FREE(untag_ptr(_res_conv_54));
19831                 _res_constr.data[c] = _res_conv_54_conv;
19832         }
19833         FREE(_res);
19834         CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res_constr);
19835 }
19836
19837 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_ok(uint32_t o) {
19838         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_js(o);
19839         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
19840         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
19841         return tag_ptr(ret_conv, true);
19842 }
19843
19844 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_err"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_err() {
19845         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
19846         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
19847         return tag_ptr(ret_conv, true);
19848 }
19849
19850 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(uint64_t o) {
19851         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
19852         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
19853         return ret_conv;
19854 }
19855
19856 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_free"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_free(uint64_t _res) {
19857         if (!ptr_is_owned(_res)) return;
19858         void* _res_ptr = untag_ptr(_res);
19859         CHECK_ACCESS(_res_ptr);
19860         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
19861         FREE(untag_ptr(_res));
19862         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
19863 }
19864
19865 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
19866         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
19867         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
19868         return tag_ptr(ret_conv, true);
19869 }
19870 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(uint64_t arg) {
19871         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
19872         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
19873         return ret_conv;
19874 }
19875
19876 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone(uint64_t orig) {
19877         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
19878         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
19879         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
19880         return tag_ptr(ret_conv, true);
19881 }
19882
19883 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
19884         LDKCVec_MonitorEventZ _res_constr;
19885         _res_constr.datalen = _res->arr_len;
19886         if (_res_constr.datalen > 0)
19887                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
19888         else
19889                 _res_constr.data = NULL;
19890         uint64_t* _res_vals = _res->elems;
19891         for (size_t o = 0; o < _res_constr.datalen; o++) {
19892                 uint64_t _res_conv_14 = _res_vals[o];
19893                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
19894                 CHECK_ACCESS(_res_conv_14_ptr);
19895                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
19896                 FREE(untag_ptr(_res_conv_14));
19897                 _res_constr.data[o] = _res_conv_14_conv;
19898         }
19899         FREE(_res);
19900         CVec_MonitorEventZ_free(_res_constr);
19901 }
19902
19903 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
19904         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
19905         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
19906         return tag_ptr(ret_conv, true);
19907 }
19908 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
19909         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
19910         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
19911         return ret_conv;
19912 }
19913
19914 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
19915         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
19916         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
19917         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
19918         return tag_ptr(ret_conv, true);
19919 }
19920
19921 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
19922         LDKOutPoint a_conv;
19923         a_conv.inner = untag_ptr(a);
19924         a_conv.is_owned = ptr_is_owned(a);
19925         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19926         a_conv = OutPoint_clone(&a_conv);
19927         LDKCVec_MonitorEventZ b_constr;
19928         b_constr.datalen = b->arr_len;
19929         if (b_constr.datalen > 0)
19930                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
19931         else
19932                 b_constr.data = NULL;
19933         uint64_t* b_vals = b->elems;
19934         for (size_t o = 0; o < b_constr.datalen; o++) {
19935                 uint64_t b_conv_14 = b_vals[o];
19936                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
19937                 CHECK_ACCESS(b_conv_14_ptr);
19938                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
19939                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
19940                 b_constr.data[o] = b_conv_14_conv;
19941         }
19942         FREE(b);
19943         LDKPublicKey c_ref;
19944         CHECK(c->arr_len == 33);
19945         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
19946         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
19947         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
19948         return tag_ptr(ret_conv, true);
19949 }
19950
19951 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
19952         if (!ptr_is_owned(_res)) return;
19953         void* _res_ptr = untag_ptr(_res);
19954         CHECK_ACCESS(_res_ptr);
19955         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
19956         FREE(untag_ptr(_res));
19957         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
19958 }
19959
19960 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
19961         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
19962         _res_constr.datalen = _res->arr_len;
19963         if (_res_constr.datalen > 0)
19964                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
19965         else
19966                 _res_constr.data = NULL;
19967         uint64_t* _res_vals = _res->elems;
19968         for (size_t x = 0; x < _res_constr.datalen; x++) {
19969                 uint64_t _res_conv_49 = _res_vals[x];
19970                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
19971                 CHECK_ACCESS(_res_conv_49_ptr);
19972                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
19973                 FREE(untag_ptr(_res_conv_49));
19974                 _res_constr.data[x] = _res_conv_49_conv;
19975         }
19976         FREE(_res);
19977         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
19978 }
19979
19980 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
19981         LDKInitFeatures o_conv;
19982         o_conv.inner = untag_ptr(o);
19983         o_conv.is_owned = ptr_is_owned(o);
19984         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19985         o_conv = InitFeatures_clone(&o_conv);
19986         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
19987         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
19988         return tag_ptr(ret_conv, true);
19989 }
19990
19991 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
19992         void* e_ptr = untag_ptr(e);
19993         CHECK_ACCESS(e_ptr);
19994         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19995         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19996         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
19997         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
19998         return tag_ptr(ret_conv, true);
19999 }
20000
20001 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
20002         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
20003         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
20004         return ret_conv;
20005 }
20006
20007 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
20008         if (!ptr_is_owned(_res)) return;
20009         void* _res_ptr = untag_ptr(_res);
20010         CHECK_ACCESS(_res_ptr);
20011         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
20012         FREE(untag_ptr(_res));
20013         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
20014 }
20015
20016 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20017         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
20018         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
20019         return tag_ptr(ret_conv, true);
20020 }
20021 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
20022         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
20023         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20024         return ret_conv;
20025 }
20026
20027 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
20028         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
20029         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
20030         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
20031         return tag_ptr(ret_conv, true);
20032 }
20033
20034 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
20035         LDKChannelFeatures o_conv;
20036         o_conv.inner = untag_ptr(o);
20037         o_conv.is_owned = ptr_is_owned(o);
20038         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20039         o_conv = ChannelFeatures_clone(&o_conv);
20040         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
20041         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
20042         return tag_ptr(ret_conv, true);
20043 }
20044
20045 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
20046         void* e_ptr = untag_ptr(e);
20047         CHECK_ACCESS(e_ptr);
20048         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20049         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20050         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
20051         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
20052         return tag_ptr(ret_conv, true);
20053 }
20054
20055 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
20056         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
20057         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
20058         return ret_conv;
20059 }
20060
20061 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
20062         if (!ptr_is_owned(_res)) return;
20063         void* _res_ptr = untag_ptr(_res);
20064         CHECK_ACCESS(_res_ptr);
20065         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
20066         FREE(untag_ptr(_res));
20067         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
20068 }
20069
20070 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20071         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
20072         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
20073         return tag_ptr(ret_conv, true);
20074 }
20075 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
20076         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
20077         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20078         return ret_conv;
20079 }
20080
20081 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
20082         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
20083         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
20084         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
20085         return tag_ptr(ret_conv, true);
20086 }
20087
20088 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
20089         LDKNodeFeatures o_conv;
20090         o_conv.inner = untag_ptr(o);
20091         o_conv.is_owned = ptr_is_owned(o);
20092         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20093         o_conv = NodeFeatures_clone(&o_conv);
20094         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
20095         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
20096         return tag_ptr(ret_conv, true);
20097 }
20098
20099 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
20100         void* e_ptr = untag_ptr(e);
20101         CHECK_ACCESS(e_ptr);
20102         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20103         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20104         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
20105         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
20106         return tag_ptr(ret_conv, true);
20107 }
20108
20109 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
20110         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
20111         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
20112         return ret_conv;
20113 }
20114
20115 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
20116         if (!ptr_is_owned(_res)) return;
20117         void* _res_ptr = untag_ptr(_res);
20118         CHECK_ACCESS(_res_ptr);
20119         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
20120         FREE(untag_ptr(_res));
20121         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
20122 }
20123
20124 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20125         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
20126         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
20127         return tag_ptr(ret_conv, true);
20128 }
20129 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
20130         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
20131         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20132         return ret_conv;
20133 }
20134
20135 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
20136         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
20137         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
20138         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
20139         return tag_ptr(ret_conv, true);
20140 }
20141
20142 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
20143         LDKBolt11InvoiceFeatures o_conv;
20144         o_conv.inner = untag_ptr(o);
20145         o_conv.is_owned = ptr_is_owned(o);
20146         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20147         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
20148         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
20149         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
20150         return tag_ptr(ret_conv, true);
20151 }
20152
20153 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
20154         void* e_ptr = untag_ptr(e);
20155         CHECK_ACCESS(e_ptr);
20156         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20157         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20158         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
20159         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
20160         return tag_ptr(ret_conv, true);
20161 }
20162
20163 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
20164         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
20165         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
20166         return ret_conv;
20167 }
20168
20169 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
20170         if (!ptr_is_owned(_res)) return;
20171         void* _res_ptr = untag_ptr(_res);
20172         CHECK_ACCESS(_res_ptr);
20173         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
20174         FREE(untag_ptr(_res));
20175         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
20176 }
20177
20178 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20179         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
20180         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
20181         return tag_ptr(ret_conv, true);
20182 }
20183 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
20184         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
20185         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20186         return ret_conv;
20187 }
20188
20189 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
20190         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
20191         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
20192         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
20193         return tag_ptr(ret_conv, true);
20194 }
20195
20196 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
20197         LDKBolt12InvoiceFeatures o_conv;
20198         o_conv.inner = untag_ptr(o);
20199         o_conv.is_owned = ptr_is_owned(o);
20200         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20201         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
20202         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
20203         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
20204         return tag_ptr(ret_conv, true);
20205 }
20206
20207 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
20208         void* e_ptr = untag_ptr(e);
20209         CHECK_ACCESS(e_ptr);
20210         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20211         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20212         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
20213         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
20214         return tag_ptr(ret_conv, true);
20215 }
20216
20217 jboolean  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
20218         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
20219         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
20220         return ret_conv;
20221 }
20222
20223 void  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
20224         if (!ptr_is_owned(_res)) return;
20225         void* _res_ptr = untag_ptr(_res);
20226         CHECK_ACCESS(_res_ptr);
20227         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
20228         FREE(untag_ptr(_res));
20229         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
20230 }
20231
20232 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20233         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
20234         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
20235         return tag_ptr(ret_conv, true);
20236 }
20237 int64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
20238         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
20239         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20240         return ret_conv;
20241 }
20242
20243 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
20244         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
20245         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
20246         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
20247         return tag_ptr(ret_conv, true);
20248 }
20249
20250 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok(uint64_t o) {
20251         LDKBlindedHopFeatures o_conv;
20252         o_conv.inner = untag_ptr(o);
20253         o_conv.is_owned = ptr_is_owned(o);
20254         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20255         o_conv = BlindedHopFeatures_clone(&o_conv);
20256         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
20257         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
20258         return tag_ptr(ret_conv, true);
20259 }
20260
20261 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_err(uint64_t e) {
20262         void* e_ptr = untag_ptr(e);
20263         CHECK_ACCESS(e_ptr);
20264         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20265         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20266         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
20267         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
20268         return tag_ptr(ret_conv, true);
20269 }
20270
20271 jboolean  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(uint64_t o) {
20272         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
20273         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
20274         return ret_conv;
20275 }
20276
20277 void  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_free"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_free(uint64_t _res) {
20278         if (!ptr_is_owned(_res)) return;
20279         void* _res_ptr = untag_ptr(_res);
20280         CHECK_ACCESS(_res_ptr);
20281         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
20282         FREE(untag_ptr(_res));
20283         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
20284 }
20285
20286 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20287         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
20288         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
20289         return tag_ptr(ret_conv, true);
20290 }
20291 int64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
20292         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
20293         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20294         return ret_conv;
20295 }
20296
20297 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone(uint64_t orig) {
20298         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
20299         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
20300         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
20301         return tag_ptr(ret_conv, true);
20302 }
20303
20304 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
20305         LDKChannelTypeFeatures o_conv;
20306         o_conv.inner = untag_ptr(o);
20307         o_conv.is_owned = ptr_is_owned(o);
20308         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20309         o_conv = ChannelTypeFeatures_clone(&o_conv);
20310         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
20311         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
20312         return tag_ptr(ret_conv, true);
20313 }
20314
20315 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
20316         void* e_ptr = untag_ptr(e);
20317         CHECK_ACCESS(e_ptr);
20318         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20319         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20320         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
20321         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
20322         return tag_ptr(ret_conv, true);
20323 }
20324
20325 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
20326         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
20327         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
20328         return ret_conv;
20329 }
20330
20331 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
20332         if (!ptr_is_owned(_res)) return;
20333         void* _res_ptr = untag_ptr(_res);
20334         CHECK_ACCESS(_res_ptr);
20335         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
20336         FREE(untag_ptr(_res));
20337         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
20338 }
20339
20340 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20341         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
20342         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
20343         return tag_ptr(ret_conv, true);
20344 }
20345 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
20346         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
20347         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20348         return ret_conv;
20349 }
20350
20351 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
20352         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
20353         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
20354         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
20355         return tag_ptr(ret_conv, true);
20356 }
20357
20358 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_ok"))) TS_CResult_OfferBolt12ParseErrorZ_ok(uint64_t o) {
20359         LDKOffer o_conv;
20360         o_conv.inner = untag_ptr(o);
20361         o_conv.is_owned = ptr_is_owned(o);
20362         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20363         o_conv = Offer_clone(&o_conv);
20364         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
20365         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
20366         return tag_ptr(ret_conv, true);
20367 }
20368
20369 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_err"))) TS_CResult_OfferBolt12ParseErrorZ_err(uint64_t e) {
20370         LDKBolt12ParseError e_conv;
20371         e_conv.inner = untag_ptr(e);
20372         e_conv.is_owned = ptr_is_owned(e);
20373         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20374         e_conv = Bolt12ParseError_clone(&e_conv);
20375         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
20376         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
20377         return tag_ptr(ret_conv, true);
20378 }
20379
20380 jboolean  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_is_ok"))) TS_CResult_OfferBolt12ParseErrorZ_is_ok(uint64_t o) {
20381         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
20382         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
20383         return ret_conv;
20384 }
20385
20386 void  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_free"))) TS_CResult_OfferBolt12ParseErrorZ_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_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
20391         FREE(untag_ptr(_res));
20392         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
20393 }
20394
20395 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
20396         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
20397         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
20398         return tag_ptr(ret_conv, true);
20399 }
20400 int64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone_ptr"))) TS_CResult_OfferBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
20401         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
20402         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
20403         return ret_conv;
20404 }
20405
20406 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone"))) TS_CResult_OfferBolt12ParseErrorZ_clone(uint64_t orig) {
20407         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
20408         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
20409         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
20410         return tag_ptr(ret_conv, true);
20411 }
20412
20413 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_ok(int8_tArray o) {
20414         LDKPublicKey o_ref;
20415         CHECK(o->arr_len == 33);
20416         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
20417         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
20418         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
20419         return tag_ptr(ret_conv, true);
20420 }
20421
20422 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_err"))) TS_CResult_PublicKeySecp256k1ErrorZ_err(uint32_t e) {
20423         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
20424         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
20425         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
20426         return tag_ptr(ret_conv, true);
20427 }
20428
20429 jboolean  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_is_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_is_ok(uint64_t o) {
20430         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
20431         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
20432         return ret_conv;
20433 }
20434
20435 void  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_free"))) TS_CResult_PublicKeySecp256k1ErrorZ_free(uint64_t _res) {
20436         if (!ptr_is_owned(_res)) return;
20437         void* _res_ptr = untag_ptr(_res);
20438         CHECK_ACCESS(_res_ptr);
20439         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
20440         FREE(untag_ptr(_res));
20441         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
20442 }
20443
20444 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
20445         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
20446         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
20447         return tag_ptr(ret_conv, true);
20448 }
20449 int64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_clone_ptr"))) TS_CResult_PublicKeySecp256k1ErrorZ_clone_ptr(uint64_t arg) {
20450         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
20451         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
20452         return ret_conv;
20453 }
20454
20455 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_clone"))) TS_CResult_PublicKeySecp256k1ErrorZ_clone(uint64_t orig) {
20456         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
20457         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
20458         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
20459         return tag_ptr(ret_conv, true);
20460 }
20461
20462 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
20463         LDKNodeId o_conv;
20464         o_conv.inner = untag_ptr(o);
20465         o_conv.is_owned = ptr_is_owned(o);
20466         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20467         o_conv = NodeId_clone(&o_conv);
20468         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20469         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
20470         return tag_ptr(ret_conv, true);
20471 }
20472
20473 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
20474         void* e_ptr = untag_ptr(e);
20475         CHECK_ACCESS(e_ptr);
20476         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20477         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20478         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20479         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
20480         return tag_ptr(ret_conv, true);
20481 }
20482
20483 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
20484         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
20485         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
20486         return ret_conv;
20487 }
20488
20489 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
20490         if (!ptr_is_owned(_res)) return;
20491         void* _res_ptr = untag_ptr(_res);
20492         CHECK_ACCESS(_res_ptr);
20493         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
20494         FREE(untag_ptr(_res));
20495         CResult_NodeIdDecodeErrorZ_free(_res_conv);
20496 }
20497
20498 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
20499         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20500         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
20501         return tag_ptr(ret_conv, true);
20502 }
20503 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
20504         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
20505         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
20506         return ret_conv;
20507 }
20508
20509 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
20510         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
20511         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20512         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
20513         return tag_ptr(ret_conv, true);
20514 }
20515
20516 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
20517         void* o_ptr = untag_ptr(o);
20518         CHECK_ACCESS(o_ptr);
20519         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
20520         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
20521         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
20522         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
20523         uint64_t ret_ref = tag_ptr(ret_copy, true);
20524         return ret_ref;
20525 }
20526
20527 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
20528         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
20529         *ret_copy = COption_NetworkUpdateZ_none();
20530         uint64_t ret_ref = tag_ptr(ret_copy, true);
20531         return ret_ref;
20532 }
20533
20534 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
20535         if (!ptr_is_owned(_res)) return;
20536         void* _res_ptr = untag_ptr(_res);
20537         CHECK_ACCESS(_res_ptr);
20538         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
20539         FREE(untag_ptr(_res));
20540         COption_NetworkUpdateZ_free(_res_conv);
20541 }
20542
20543 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
20544         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
20545         *ret_copy = COption_NetworkUpdateZ_clone(arg);
20546         uint64_t ret_ref = tag_ptr(ret_copy, true);
20547         return ret_ref;
20548 }
20549 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
20550         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
20551         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
20552         return ret_conv;
20553 }
20554
20555 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
20556         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
20557         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
20558         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
20559         uint64_t ret_ref = tag_ptr(ret_copy, true);
20560         return ret_ref;
20561 }
20562
20563 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
20564         void* o_ptr = untag_ptr(o);
20565         CHECK_ACCESS(o_ptr);
20566         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
20567         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
20568         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20569         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
20570         return tag_ptr(ret_conv, true);
20571 }
20572
20573 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
20574         void* e_ptr = untag_ptr(e);
20575         CHECK_ACCESS(e_ptr);
20576         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20577         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20578         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20579         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
20580         return tag_ptr(ret_conv, true);
20581 }
20582
20583 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
20584         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
20585         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
20586         return ret_conv;
20587 }
20588
20589 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
20590         if (!ptr_is_owned(_res)) return;
20591         void* _res_ptr = untag_ptr(_res);
20592         CHECK_ACCESS(_res_ptr);
20593         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
20594         FREE(untag_ptr(_res));
20595         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
20596 }
20597
20598 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
20599         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20600         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
20601         return tag_ptr(ret_conv, true);
20602 }
20603 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
20604         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
20605         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
20606         return ret_conv;
20607 }
20608
20609 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
20610         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
20611         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20612         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
20613         return tag_ptr(ret_conv, true);
20614 }
20615
20616 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_some"))) TS_COption_UtxoLookupZ_some(uint64_t o) {
20617         void* o_ptr = untag_ptr(o);
20618         CHECK_ACCESS(o_ptr);
20619         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
20620         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
20621                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20622                 LDKUtxoLookup_JCalls_cloned(&o_conv);
20623         }
20624         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
20625         *ret_copy = COption_UtxoLookupZ_some(o_conv);
20626         uint64_t ret_ref = tag_ptr(ret_copy, true);
20627         return ret_ref;
20628 }
20629
20630 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_none"))) TS_COption_UtxoLookupZ_none() {
20631         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
20632         *ret_copy = COption_UtxoLookupZ_none();
20633         uint64_t ret_ref = tag_ptr(ret_copy, true);
20634         return ret_ref;
20635 }
20636
20637 void  __attribute__((export_name("TS_COption_UtxoLookupZ_free"))) TS_COption_UtxoLookupZ_free(uint64_t _res) {
20638         if (!ptr_is_owned(_res)) return;
20639         void* _res_ptr = untag_ptr(_res);
20640         CHECK_ACCESS(_res_ptr);
20641         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
20642         FREE(untag_ptr(_res));
20643         COption_UtxoLookupZ_free(_res_conv);
20644 }
20645
20646 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
20647         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20648         *ret_conv = CResult_NoneLightningErrorZ_ok();
20649         return tag_ptr(ret_conv, true);
20650 }
20651
20652 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
20653         LDKLightningError e_conv;
20654         e_conv.inner = untag_ptr(e);
20655         e_conv.is_owned = ptr_is_owned(e);
20656         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20657         e_conv = LightningError_clone(&e_conv);
20658         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20659         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
20660         return tag_ptr(ret_conv, true);
20661 }
20662
20663 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
20664         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
20665         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
20666         return ret_conv;
20667 }
20668
20669 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
20670         if (!ptr_is_owned(_res)) return;
20671         void* _res_ptr = untag_ptr(_res);
20672         CHECK_ACCESS(_res_ptr);
20673         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
20674         FREE(untag_ptr(_res));
20675         CResult_NoneLightningErrorZ_free(_res_conv);
20676 }
20677
20678 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
20679         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20680         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
20681         return tag_ptr(ret_conv, true);
20682 }
20683 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
20684         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
20685         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
20686         return ret_conv;
20687 }
20688
20689 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
20690         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
20691         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20692         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
20693         return tag_ptr(ret_conv, true);
20694 }
20695
20696 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
20697         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
20698         *ret_conv = CResult_boolLightningErrorZ_ok(o);
20699         return tag_ptr(ret_conv, true);
20700 }
20701
20702 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
20703         LDKLightningError e_conv;
20704         e_conv.inner = untag_ptr(e);
20705         e_conv.is_owned = ptr_is_owned(e);
20706         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20707         e_conv = LightningError_clone(&e_conv);
20708         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
20709         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
20710         return tag_ptr(ret_conv, true);
20711 }
20712
20713 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
20714         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
20715         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
20716         return ret_conv;
20717 }
20718
20719 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
20720         if (!ptr_is_owned(_res)) return;
20721         void* _res_ptr = untag_ptr(_res);
20722         CHECK_ACCESS(_res_ptr);
20723         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
20724         FREE(untag_ptr(_res));
20725         CResult_boolLightningErrorZ_free(_res_conv);
20726 }
20727
20728 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
20729         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
20730         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
20731         return tag_ptr(ret_conv, true);
20732 }
20733 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
20734         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
20735         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
20736         return ret_conv;
20737 }
20738
20739 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
20740         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
20741         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
20742         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
20743         return tag_ptr(ret_conv, true);
20744 }
20745
20746 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
20747         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
20748         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
20749         return tag_ptr(ret_conv, true);
20750 }
20751 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
20752         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
20753         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
20754         return ret_conv;
20755 }
20756
20757 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
20758         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
20759         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
20760         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
20761         return tag_ptr(ret_conv, true);
20762 }
20763
20764 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
20765         LDKChannelAnnouncement a_conv;
20766         a_conv.inner = untag_ptr(a);
20767         a_conv.is_owned = ptr_is_owned(a);
20768         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20769         a_conv = ChannelAnnouncement_clone(&a_conv);
20770         LDKChannelUpdate b_conv;
20771         b_conv.inner = untag_ptr(b);
20772         b_conv.is_owned = ptr_is_owned(b);
20773         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
20774         b_conv = ChannelUpdate_clone(&b_conv);
20775         LDKChannelUpdate c_conv;
20776         c_conv.inner = untag_ptr(c);
20777         c_conv.is_owned = ptr_is_owned(c);
20778         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
20779         c_conv = ChannelUpdate_clone(&c_conv);
20780         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
20781         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
20782         return tag_ptr(ret_conv, true);
20783 }
20784
20785 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
20786         if (!ptr_is_owned(_res)) return;
20787         void* _res_ptr = untag_ptr(_res);
20788         CHECK_ACCESS(_res_ptr);
20789         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
20790         FREE(untag_ptr(_res));
20791         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
20792 }
20793
20794 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
20795         void* o_ptr = untag_ptr(o);
20796         CHECK_ACCESS(o_ptr);
20797         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
20798         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
20799         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
20800         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
20801         uint64_t ret_ref = tag_ptr(ret_copy, true);
20802         return ret_ref;
20803 }
20804
20805 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
20806         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
20807         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
20808         uint64_t ret_ref = tag_ptr(ret_copy, true);
20809         return ret_ref;
20810 }
20811
20812 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
20813         if (!ptr_is_owned(_res)) return;
20814         void* _res_ptr = untag_ptr(_res);
20815         CHECK_ACCESS(_res_ptr);
20816         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
20817         FREE(untag_ptr(_res));
20818         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
20819 }
20820
20821 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
20822         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
20823         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
20824         uint64_t ret_ref = tag_ptr(ret_copy, true);
20825         return ret_ref;
20826 }
20827 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
20828         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
20829         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
20830         return ret_conv;
20831 }
20832
20833 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
20834         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
20835         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
20836         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
20837         uint64_t ret_ref = tag_ptr(ret_copy, true);
20838         return ret_ref;
20839 }
20840
20841 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
20842         LDKCVec_MessageSendEventZ _res_constr;
20843         _res_constr.datalen = _res->arr_len;
20844         if (_res_constr.datalen > 0)
20845                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
20846         else
20847                 _res_constr.data = NULL;
20848         uint64_t* _res_vals = _res->elems;
20849         for (size_t s = 0; s < _res_constr.datalen; s++) {
20850                 uint64_t _res_conv_18 = _res_vals[s];
20851                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
20852                 CHECK_ACCESS(_res_conv_18_ptr);
20853                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
20854                 FREE(untag_ptr(_res_conv_18));
20855                 _res_constr.data[s] = _res_conv_18_conv;
20856         }
20857         FREE(_res);
20858         CVec_MessageSendEventZ_free(_res_constr);
20859 }
20860
20861 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
20862         LDKChannelUpdateInfo o_conv;
20863         o_conv.inner = untag_ptr(o);
20864         o_conv.is_owned = ptr_is_owned(o);
20865         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20866         o_conv = ChannelUpdateInfo_clone(&o_conv);
20867         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20868         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
20869         return tag_ptr(ret_conv, true);
20870 }
20871
20872 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
20873         void* e_ptr = untag_ptr(e);
20874         CHECK_ACCESS(e_ptr);
20875         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20876         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20877         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20878         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
20879         return tag_ptr(ret_conv, true);
20880 }
20881
20882 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
20883         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
20884         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
20885         return ret_conv;
20886 }
20887
20888 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
20889         if (!ptr_is_owned(_res)) return;
20890         void* _res_ptr = untag_ptr(_res);
20891         CHECK_ACCESS(_res_ptr);
20892         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
20893         FREE(untag_ptr(_res));
20894         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
20895 }
20896
20897 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
20898         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20899         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
20900         return tag_ptr(ret_conv, true);
20901 }
20902 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
20903         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
20904         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
20905         return ret_conv;
20906 }
20907
20908 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
20909         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
20910         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20911         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
20912         return tag_ptr(ret_conv, true);
20913 }
20914
20915 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
20916         LDKChannelInfo o_conv;
20917         o_conv.inner = untag_ptr(o);
20918         o_conv.is_owned = ptr_is_owned(o);
20919         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20920         o_conv = ChannelInfo_clone(&o_conv);
20921         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20922         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
20923         return tag_ptr(ret_conv, true);
20924 }
20925
20926 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
20927         void* e_ptr = untag_ptr(e);
20928         CHECK_ACCESS(e_ptr);
20929         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20930         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20931         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20932         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
20933         return tag_ptr(ret_conv, true);
20934 }
20935
20936 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
20937         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
20938         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
20939         return ret_conv;
20940 }
20941
20942 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
20943         if (!ptr_is_owned(_res)) return;
20944         void* _res_ptr = untag_ptr(_res);
20945         CHECK_ACCESS(_res_ptr);
20946         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
20947         FREE(untag_ptr(_res));
20948         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
20949 }
20950
20951 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
20952         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20953         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
20954         return tag_ptr(ret_conv, true);
20955 }
20956 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
20957         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
20958         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
20959         return ret_conv;
20960 }
20961
20962 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
20963         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
20964         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20965         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
20966         return tag_ptr(ret_conv, true);
20967 }
20968
20969 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
20970         LDKRoutingFees o_conv;
20971         o_conv.inner = untag_ptr(o);
20972         o_conv.is_owned = ptr_is_owned(o);
20973         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20974         o_conv = RoutingFees_clone(&o_conv);
20975         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20976         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
20977         return tag_ptr(ret_conv, true);
20978 }
20979
20980 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
20981         void* e_ptr = untag_ptr(e);
20982         CHECK_ACCESS(e_ptr);
20983         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20984         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20985         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20986         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
20987         return tag_ptr(ret_conv, true);
20988 }
20989
20990 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
20991         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
20992         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
20993         return ret_conv;
20994 }
20995
20996 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
20997         if (!ptr_is_owned(_res)) return;
20998         void* _res_ptr = untag_ptr(_res);
20999         CHECK_ACCESS(_res_ptr);
21000         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
21001         FREE(untag_ptr(_res));
21002         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
21003 }
21004
21005 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
21006         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
21007         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
21008         return tag_ptr(ret_conv, true);
21009 }
21010 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
21011         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
21012         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
21013         return ret_conv;
21014 }
21015
21016 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
21017         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
21018         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
21019         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
21020         return tag_ptr(ret_conv, true);
21021 }
21022
21023 void  __attribute__((export_name("TS_CVec_SocketAddressZ_free"))) TS_CVec_SocketAddressZ_free(uint64_tArray _res) {
21024         LDKCVec_SocketAddressZ _res_constr;
21025         _res_constr.datalen = _res->arr_len;
21026         if (_res_constr.datalen > 0)
21027                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
21028         else
21029                 _res_constr.data = NULL;
21030         uint64_t* _res_vals = _res->elems;
21031         for (size_t p = 0; p < _res_constr.datalen; p++) {
21032                 uint64_t _res_conv_15 = _res_vals[p];
21033                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
21034                 CHECK_ACCESS(_res_conv_15_ptr);
21035                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
21036                 FREE(untag_ptr(_res_conv_15));
21037                 _res_constr.data[p] = _res_conv_15_conv;
21038         }
21039         FREE(_res);
21040         CVec_SocketAddressZ_free(_res_constr);
21041 }
21042
21043 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
21044         LDKNodeAnnouncementInfo o_conv;
21045         o_conv.inner = untag_ptr(o);
21046         o_conv.is_owned = ptr_is_owned(o);
21047         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21048         o_conv = NodeAnnouncementInfo_clone(&o_conv);
21049         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
21050         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
21051         return tag_ptr(ret_conv, true);
21052 }
21053
21054 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
21055         void* e_ptr = untag_ptr(e);
21056         CHECK_ACCESS(e_ptr);
21057         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21058         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21059         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
21060         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
21061         return tag_ptr(ret_conv, true);
21062 }
21063
21064 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
21065         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
21066         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
21067         return ret_conv;
21068 }
21069
21070 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
21071         if (!ptr_is_owned(_res)) return;
21072         void* _res_ptr = untag_ptr(_res);
21073         CHECK_ACCESS(_res_ptr);
21074         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
21075         FREE(untag_ptr(_res));
21076         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
21077 }
21078
21079 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
21080         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
21081         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
21082         return tag_ptr(ret_conv, true);
21083 }
21084 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
21085         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
21086         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
21087         return ret_conv;
21088 }
21089
21090 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
21091         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
21092         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
21093         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
21094         return tag_ptr(ret_conv, true);
21095 }
21096
21097 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
21098         LDKNodeAlias o_conv;
21099         o_conv.inner = untag_ptr(o);
21100         o_conv.is_owned = ptr_is_owned(o);
21101         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21102         o_conv = NodeAlias_clone(&o_conv);
21103         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
21104         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
21105         return tag_ptr(ret_conv, true);
21106 }
21107
21108 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
21109         void* e_ptr = untag_ptr(e);
21110         CHECK_ACCESS(e_ptr);
21111         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21112         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21113         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
21114         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
21115         return tag_ptr(ret_conv, true);
21116 }
21117
21118 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
21119         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
21120         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
21121         return ret_conv;
21122 }
21123
21124 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
21125         if (!ptr_is_owned(_res)) return;
21126         void* _res_ptr = untag_ptr(_res);
21127         CHECK_ACCESS(_res_ptr);
21128         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
21129         FREE(untag_ptr(_res));
21130         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
21131 }
21132
21133 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
21134         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
21135         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
21136         return tag_ptr(ret_conv, true);
21137 }
21138 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
21139         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
21140         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
21141         return ret_conv;
21142 }
21143
21144 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
21145         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
21146         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
21147         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
21148         return tag_ptr(ret_conv, true);
21149 }
21150
21151 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
21152         LDKNodeInfo o_conv;
21153         o_conv.inner = untag_ptr(o);
21154         o_conv.is_owned = ptr_is_owned(o);
21155         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21156         o_conv = NodeInfo_clone(&o_conv);
21157         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
21158         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
21159         return tag_ptr(ret_conv, true);
21160 }
21161
21162 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
21163         void* e_ptr = untag_ptr(e);
21164         CHECK_ACCESS(e_ptr);
21165         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21166         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21167         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
21168         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
21169         return tag_ptr(ret_conv, true);
21170 }
21171
21172 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
21173         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
21174         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
21175         return ret_conv;
21176 }
21177
21178 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
21179         if (!ptr_is_owned(_res)) return;
21180         void* _res_ptr = untag_ptr(_res);
21181         CHECK_ACCESS(_res_ptr);
21182         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
21183         FREE(untag_ptr(_res));
21184         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
21185 }
21186
21187 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
21188         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
21189         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
21190         return tag_ptr(ret_conv, true);
21191 }
21192 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
21193         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
21194         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
21195         return ret_conv;
21196 }
21197
21198 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
21199         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
21200         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
21201         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
21202         return tag_ptr(ret_conv, true);
21203 }
21204
21205 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
21206         LDKNetworkGraph o_conv;
21207         o_conv.inner = untag_ptr(o);
21208         o_conv.is_owned = ptr_is_owned(o);
21209         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21210         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
21211         
21212         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
21213         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
21214         return tag_ptr(ret_conv, true);
21215 }
21216
21217 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
21218         void* e_ptr = untag_ptr(e);
21219         CHECK_ACCESS(e_ptr);
21220         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21221         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21222         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
21223         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
21224         return tag_ptr(ret_conv, true);
21225 }
21226
21227 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
21228         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
21229         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
21230         return ret_conv;
21231 }
21232
21233 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
21234         if (!ptr_is_owned(_res)) return;
21235         void* _res_ptr = untag_ptr(_res);
21236         CHECK_ACCESS(_res_ptr);
21237         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
21238         FREE(untag_ptr(_res));
21239         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
21240 }
21241
21242 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_some"))) TS_COption_CVec_SocketAddressZZ_some(uint64_tArray o) {
21243         LDKCVec_SocketAddressZ o_constr;
21244         o_constr.datalen = o->arr_len;
21245         if (o_constr.datalen > 0)
21246                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
21247         else
21248                 o_constr.data = NULL;
21249         uint64_t* o_vals = o->elems;
21250         for (size_t p = 0; p < o_constr.datalen; p++) {
21251                 uint64_t o_conv_15 = o_vals[p];
21252                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
21253                 CHECK_ACCESS(o_conv_15_ptr);
21254                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
21255                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
21256                 o_constr.data[p] = o_conv_15_conv;
21257         }
21258         FREE(o);
21259         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
21260         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
21261         uint64_t ret_ref = tag_ptr(ret_copy, true);
21262         return ret_ref;
21263 }
21264
21265 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_none"))) TS_COption_CVec_SocketAddressZZ_none() {
21266         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
21267         *ret_copy = COption_CVec_SocketAddressZZ_none();
21268         uint64_t ret_ref = tag_ptr(ret_copy, true);
21269         return ret_ref;
21270 }
21271
21272 void  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_free"))) TS_COption_CVec_SocketAddressZZ_free(uint64_t _res) {
21273         if (!ptr_is_owned(_res)) return;
21274         void* _res_ptr = untag_ptr(_res);
21275         CHECK_ACCESS(_res_ptr);
21276         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
21277         FREE(untag_ptr(_res));
21278         COption_CVec_SocketAddressZZ_free(_res_conv);
21279 }
21280
21281 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
21282         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
21283         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
21284         uint64_t ret_ref = tag_ptr(ret_copy, true);
21285         return ret_ref;
21286 }
21287 int64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_clone_ptr"))) TS_COption_CVec_SocketAddressZZ_clone_ptr(uint64_t arg) {
21288         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
21289         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
21290         return ret_conv;
21291 }
21292
21293 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_clone"))) TS_COption_CVec_SocketAddressZZ_clone(uint64_t orig) {
21294         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
21295         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
21296         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
21297         uint64_t ret_ref = tag_ptr(ret_copy, true);
21298         return ret_ref;
21299 }
21300
21301 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_ok"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_ok(uint64_t o) {
21302         LDKPendingHTLCInfo o_conv;
21303         o_conv.inner = untag_ptr(o);
21304         o_conv.is_owned = ptr_is_owned(o);
21305         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21306         o_conv = PendingHTLCInfo_clone(&o_conv);
21307         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
21308         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o_conv);
21309         return tag_ptr(ret_conv, true);
21310 }
21311
21312 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_err"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_err(uint64_t e) {
21313         LDKInboundHTLCErr e_conv;
21314         e_conv.inner = untag_ptr(e);
21315         e_conv.is_owned = ptr_is_owned(e);
21316         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21317         // WARNING: we need a move here but no clone is available for LDKInboundHTLCErr
21318         
21319         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
21320         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_err(e_conv);
21321         return tag_ptr(ret_conv, true);
21322 }
21323
21324 jboolean  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(uint64_t o) {
21325         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* o_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(o);
21326         jboolean ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o_conv);
21327         return ret_conv;
21328 }
21329
21330 void  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_free"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_free(uint64_t _res) {
21331         if (!ptr_is_owned(_res)) return;
21332         void* _res_ptr = untag_ptr(_res);
21333         CHECK_ACCESS(_res_ptr);
21334         LDKCResult_PendingHTLCInfoInboundHTLCErrZ _res_conv = *(LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)(_res_ptr);
21335         FREE(untag_ptr(_res));
21336         CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res_conv);
21337 }
21338
21339 void  __attribute__((export_name("TS_CVec_HTLCOutputInCommitmentZ_free"))) TS_CVec_HTLCOutputInCommitmentZ_free(uint64_tArray _res) {
21340         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
21341         _res_constr.datalen = _res->arr_len;
21342         if (_res_constr.datalen > 0)
21343                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
21344         else
21345                 _res_constr.data = NULL;
21346         uint64_t* _res_vals = _res->elems;
21347         for (size_t y = 0; y < _res_constr.datalen; y++) {
21348                 uint64_t _res_conv_24 = _res_vals[y];
21349                 LDKHTLCOutputInCommitment _res_conv_24_conv;
21350                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
21351                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
21352                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
21353                 _res_constr.data[y] = _res_conv_24_conv;
21354         }
21355         FREE(_res);
21356         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
21357 }
21358
21359 void  __attribute__((export_name("TS_CVec_HTLCDescriptorZ_free"))) TS_CVec_HTLCDescriptorZ_free(uint64_tArray _res) {
21360         LDKCVec_HTLCDescriptorZ _res_constr;
21361         _res_constr.datalen = _res->arr_len;
21362         if (_res_constr.datalen > 0)
21363                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
21364         else
21365                 _res_constr.data = NULL;
21366         uint64_t* _res_vals = _res->elems;
21367         for (size_t q = 0; q < _res_constr.datalen; q++) {
21368                 uint64_t _res_conv_16 = _res_vals[q];
21369                 LDKHTLCDescriptor _res_conv_16_conv;
21370                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
21371                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
21372                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
21373                 _res_constr.data[q] = _res_conv_16_conv;
21374         }
21375         FREE(_res);
21376         CVec_HTLCDescriptorZ_free(_res_constr);
21377 }
21378
21379 void  __attribute__((export_name("TS_CVec_UtxoZ_free"))) TS_CVec_UtxoZ_free(uint64_tArray _res) {
21380         LDKCVec_UtxoZ _res_constr;
21381         _res_constr.datalen = _res->arr_len;
21382         if (_res_constr.datalen > 0)
21383                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
21384         else
21385                 _res_constr.data = NULL;
21386         uint64_t* _res_vals = _res->elems;
21387         for (size_t g = 0; g < _res_constr.datalen; g++) {
21388                 uint64_t _res_conv_6 = _res_vals[g];
21389                 LDKUtxo _res_conv_6_conv;
21390                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
21391                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
21392                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
21393                 _res_constr.data[g] = _res_conv_6_conv;
21394         }
21395         FREE(_res);
21396         CVec_UtxoZ_free(_res_constr);
21397 }
21398
21399 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_some"))) TS_COption_TxOutZ_some(uint64_t o) {
21400         void* o_ptr = untag_ptr(o);
21401         CHECK_ACCESS(o_ptr);
21402         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
21403         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
21404         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
21405         *ret_copy = COption_TxOutZ_some(o_conv);
21406         uint64_t ret_ref = tag_ptr(ret_copy, true);
21407         return ret_ref;
21408 }
21409
21410 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_none"))) TS_COption_TxOutZ_none() {
21411         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
21412         *ret_copy = COption_TxOutZ_none();
21413         uint64_t ret_ref = tag_ptr(ret_copy, true);
21414         return ret_ref;
21415 }
21416
21417 void  __attribute__((export_name("TS_COption_TxOutZ_free"))) TS_COption_TxOutZ_free(uint64_t _res) {
21418         if (!ptr_is_owned(_res)) return;
21419         void* _res_ptr = untag_ptr(_res);
21420         CHECK_ACCESS(_res_ptr);
21421         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
21422         FREE(untag_ptr(_res));
21423         COption_TxOutZ_free(_res_conv);
21424 }
21425
21426 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
21427         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
21428         *ret_copy = COption_TxOutZ_clone(arg);
21429         uint64_t ret_ref = tag_ptr(ret_copy, true);
21430         return ret_ref;
21431 }
21432 int64_t  __attribute__((export_name("TS_COption_TxOutZ_clone_ptr"))) TS_COption_TxOutZ_clone_ptr(uint64_t arg) {
21433         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
21434         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
21435         return ret_conv;
21436 }
21437
21438 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_clone"))) TS_COption_TxOutZ_clone(uint64_t orig) {
21439         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
21440         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
21441         *ret_copy = COption_TxOutZ_clone(orig_conv);
21442         uint64_t ret_ref = tag_ptr(ret_copy, true);
21443         return ret_ref;
21444 }
21445
21446 void  __attribute__((export_name("TS_CVec_InputZ_free"))) TS_CVec_InputZ_free(uint64_tArray _res) {
21447         LDKCVec_InputZ _res_constr;
21448         _res_constr.datalen = _res->arr_len;
21449         if (_res_constr.datalen > 0)
21450                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
21451         else
21452                 _res_constr.data = NULL;
21453         uint64_t* _res_vals = _res->elems;
21454         for (size_t h = 0; h < _res_constr.datalen; h++) {
21455                 uint64_t _res_conv_7 = _res_vals[h];
21456                 LDKInput _res_conv_7_conv;
21457                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
21458                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
21459                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
21460                 _res_constr.data[h] = _res_conv_7_conv;
21461         }
21462         FREE(_res);
21463         CVec_InputZ_free(_res_constr);
21464 }
21465
21466 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_ok"))) TS_CResult_CoinSelectionNoneZ_ok(uint64_t o) {
21467         LDKCoinSelection o_conv;
21468         o_conv.inner = untag_ptr(o);
21469         o_conv.is_owned = ptr_is_owned(o);
21470         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21471         o_conv = CoinSelection_clone(&o_conv);
21472         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
21473         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
21474         return tag_ptr(ret_conv, true);
21475 }
21476
21477 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_err"))) TS_CResult_CoinSelectionNoneZ_err() {
21478         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
21479         *ret_conv = CResult_CoinSelectionNoneZ_err();
21480         return tag_ptr(ret_conv, true);
21481 }
21482
21483 jboolean  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_is_ok"))) TS_CResult_CoinSelectionNoneZ_is_ok(uint64_t o) {
21484         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
21485         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
21486         return ret_conv;
21487 }
21488
21489 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_free"))) TS_CResult_CoinSelectionNoneZ_free(uint64_t _res) {
21490         if (!ptr_is_owned(_res)) return;
21491         void* _res_ptr = untag_ptr(_res);
21492         CHECK_ACCESS(_res_ptr);
21493         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
21494         FREE(untag_ptr(_res));
21495         CResult_CoinSelectionNoneZ_free(_res_conv);
21496 }
21497
21498 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
21499         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
21500         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
21501         return tag_ptr(ret_conv, true);
21502 }
21503 int64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone_ptr"))) TS_CResult_CoinSelectionNoneZ_clone_ptr(uint64_t arg) {
21504         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
21505         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
21506         return ret_conv;
21507 }
21508
21509 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone"))) TS_CResult_CoinSelectionNoneZ_clone(uint64_t orig) {
21510         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
21511         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
21512         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
21513         return tag_ptr(ret_conv, true);
21514 }
21515
21516 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_ok"))) TS_CResult_CVec_UtxoZNoneZ_ok(uint64_tArray o) {
21517         LDKCVec_UtxoZ o_constr;
21518         o_constr.datalen = o->arr_len;
21519         if (o_constr.datalen > 0)
21520                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
21521         else
21522                 o_constr.data = NULL;
21523         uint64_t* o_vals = o->elems;
21524         for (size_t g = 0; g < o_constr.datalen; g++) {
21525                 uint64_t o_conv_6 = o_vals[g];
21526                 LDKUtxo o_conv_6_conv;
21527                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
21528                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
21529                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
21530                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
21531                 o_constr.data[g] = o_conv_6_conv;
21532         }
21533         FREE(o);
21534         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
21535         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
21536         return tag_ptr(ret_conv, true);
21537 }
21538
21539 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_err"))) TS_CResult_CVec_UtxoZNoneZ_err() {
21540         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
21541         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
21542         return tag_ptr(ret_conv, true);
21543 }
21544
21545 jboolean  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_is_ok"))) TS_CResult_CVec_UtxoZNoneZ_is_ok(uint64_t o) {
21546         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
21547         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
21548         return ret_conv;
21549 }
21550
21551 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_free"))) TS_CResult_CVec_UtxoZNoneZ_free(uint64_t _res) {
21552         if (!ptr_is_owned(_res)) return;
21553         void* _res_ptr = untag_ptr(_res);
21554         CHECK_ACCESS(_res_ptr);
21555         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
21556         FREE(untag_ptr(_res));
21557         CResult_CVec_UtxoZNoneZ_free(_res_conv);
21558 }
21559
21560 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
21561         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
21562         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
21563         return tag_ptr(ret_conv, true);
21564 }
21565 int64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone_ptr"))) TS_CResult_CVec_UtxoZNoneZ_clone_ptr(uint64_t arg) {
21566         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
21567         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
21568         return ret_conv;
21569 }
21570
21571 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone"))) TS_CResult_CVec_UtxoZNoneZ_clone(uint64_t orig) {
21572         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
21573         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
21574         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
21575         return tag_ptr(ret_conv, true);
21576 }
21577
21578 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
21579         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
21580         *ret_conv = C2Tuple_u64u16Z_clone(arg);
21581         return tag_ptr(ret_conv, true);
21582 }
21583 int64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_clone_ptr"))) TS_C2Tuple_u64u16Z_clone_ptr(uint64_t arg) {
21584         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
21585         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
21586         return ret_conv;
21587 }
21588
21589 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_clone"))) TS_C2Tuple_u64u16Z_clone(uint64_t orig) {
21590         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
21591         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
21592         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
21593         return tag_ptr(ret_conv, true);
21594 }
21595
21596 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_new"))) TS_C2Tuple_u64u16Z_new(int64_t a, int16_t b) {
21597         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
21598         *ret_conv = C2Tuple_u64u16Z_new(a, b);
21599         return tag_ptr(ret_conv, true);
21600 }
21601
21602 void  __attribute__((export_name("TS_C2Tuple_u64u16Z_free"))) TS_C2Tuple_u64u16Z_free(uint64_t _res) {
21603         if (!ptr_is_owned(_res)) return;
21604         void* _res_ptr = untag_ptr(_res);
21605         CHECK_ACCESS(_res_ptr);
21606         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
21607         FREE(untag_ptr(_res));
21608         C2Tuple_u64u16Z_free(_res_conv);
21609 }
21610
21611 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_some"))) TS_COption_C2Tuple_u64u16ZZ_some(uint64_t o) {
21612         void* o_ptr = untag_ptr(o);
21613         CHECK_ACCESS(o_ptr);
21614         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
21615         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
21616         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
21617         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
21618         uint64_t ret_ref = tag_ptr(ret_copy, true);
21619         return ret_ref;
21620 }
21621
21622 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_none"))) TS_COption_C2Tuple_u64u16ZZ_none() {
21623         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
21624         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
21625         uint64_t ret_ref = tag_ptr(ret_copy, true);
21626         return ret_ref;
21627 }
21628
21629 void  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_free"))) TS_COption_C2Tuple_u64u16ZZ_free(uint64_t _res) {
21630         if (!ptr_is_owned(_res)) return;
21631         void* _res_ptr = untag_ptr(_res);
21632         CHECK_ACCESS(_res_ptr);
21633         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
21634         FREE(untag_ptr(_res));
21635         COption_C2Tuple_u64u16ZZ_free(_res_conv);
21636 }
21637
21638 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
21639         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
21640         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
21641         uint64_t ret_ref = tag_ptr(ret_copy, true);
21642         return ret_ref;
21643 }
21644 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u16ZZ_clone_ptr(uint64_t arg) {
21645         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
21646         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
21647         return ret_conv;
21648 }
21649
21650 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_clone"))) TS_COption_C2Tuple_u64u16ZZ_clone(uint64_t orig) {
21651         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
21652         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
21653         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
21654         uint64_t ret_ref = tag_ptr(ret_copy, true);
21655         return ret_ref;
21656 }
21657
21658 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_some"))) TS_COption_ChannelShutdownStateZ_some(uint32_t o) {
21659         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
21660         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
21661         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
21662         uint64_t ret_ref = tag_ptr(ret_copy, true);
21663         return ret_ref;
21664 }
21665
21666 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_none"))) TS_COption_ChannelShutdownStateZ_none() {
21667         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
21668         *ret_copy = COption_ChannelShutdownStateZ_none();
21669         uint64_t ret_ref = tag_ptr(ret_copy, true);
21670         return ret_ref;
21671 }
21672
21673 void  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_free"))) TS_COption_ChannelShutdownStateZ_free(uint64_t _res) {
21674         if (!ptr_is_owned(_res)) return;
21675         void* _res_ptr = untag_ptr(_res);
21676         CHECK_ACCESS(_res_ptr);
21677         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
21678         FREE(untag_ptr(_res));
21679         COption_ChannelShutdownStateZ_free(_res_conv);
21680 }
21681
21682 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
21683         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
21684         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
21685         uint64_t ret_ref = tag_ptr(ret_copy, true);
21686         return ret_ref;
21687 }
21688 int64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone_ptr"))) TS_COption_ChannelShutdownStateZ_clone_ptr(uint64_t arg) {
21689         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
21690         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
21691         return ret_conv;
21692 }
21693
21694 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone"))) TS_COption_ChannelShutdownStateZ_clone(uint64_t orig) {
21695         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
21696         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
21697         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
21698         uint64_t ret_ref = tag_ptr(ret_copy, true);
21699         return ret_ref;
21700 }
21701
21702 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_ok(int8_tArray o) {
21703         LDKThirtyTwoBytes o_ref;
21704         CHECK(o->arr_len == 32);
21705         memcpy(o_ref.data, o->elems, 32); FREE(o);
21706         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
21707         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
21708         return tag_ptr(ret_conv, true);
21709 }
21710
21711 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_err"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_err(uint64_t e) {
21712         void* e_ptr = untag_ptr(e);
21713         CHECK_ACCESS(e_ptr);
21714         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
21715         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
21716         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
21717         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
21718         return tag_ptr(ret_conv, true);
21719 }
21720
21721 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_is_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_is_ok(uint64_t o) {
21722         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
21723         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
21724         return ret_conv;
21725 }
21726
21727 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_free"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_free(uint64_t _res) {
21728         if (!ptr_is_owned(_res)) return;
21729         void* _res_ptr = untag_ptr(_res);
21730         CHECK_ACCESS(_res_ptr);
21731         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
21732         FREE(untag_ptr(_res));
21733         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
21734 }
21735
21736 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
21737         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
21738         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
21739         return tag_ptr(ret_conv, true);
21740 }
21741 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(uint64_t arg) {
21742         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
21743         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
21744         return ret_conv;
21745 }
21746
21747 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_clone"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_clone(uint64_t orig) {
21748         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
21749         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
21750         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
21751         return tag_ptr(ret_conv, true);
21752 }
21753
21754 void  __attribute__((export_name("TS_CVec_RecentPaymentDetailsZ_free"))) TS_CVec_RecentPaymentDetailsZ_free(uint64_tArray _res) {
21755         LDKCVec_RecentPaymentDetailsZ _res_constr;
21756         _res_constr.datalen = _res->arr_len;
21757         if (_res_constr.datalen > 0)
21758                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
21759         else
21760                 _res_constr.data = NULL;
21761         uint64_t* _res_vals = _res->elems;
21762         for (size_t w = 0; w < _res_constr.datalen; w++) {
21763                 uint64_t _res_conv_22 = _res_vals[w];
21764                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
21765                 CHECK_ACCESS(_res_conv_22_ptr);
21766                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
21767                 FREE(untag_ptr(_res_conv_22));
21768                 _res_constr.data[w] = _res_conv_22_conv;
21769         }
21770         FREE(_res);
21771         CVec_RecentPaymentDetailsZ_free(_res_constr);
21772 }
21773
21774 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
21775         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
21776         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
21777         return tag_ptr(ret_conv, true);
21778 }
21779
21780 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
21781         void* e_ptr = untag_ptr(e);
21782         CHECK_ACCESS(e_ptr);
21783         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
21784         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
21785         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
21786         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
21787         return tag_ptr(ret_conv, true);
21788 }
21789
21790 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
21791         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
21792         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
21793         return ret_conv;
21794 }
21795
21796 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
21797         if (!ptr_is_owned(_res)) return;
21798         void* _res_ptr = untag_ptr(_res);
21799         CHECK_ACCESS(_res_ptr);
21800         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
21801         FREE(untag_ptr(_res));
21802         CResult_NonePaymentSendFailureZ_free(_res_conv);
21803 }
21804
21805 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
21806         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
21807         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
21808         return tag_ptr(ret_conv, true);
21809 }
21810 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
21811         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
21812         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
21813         return ret_conv;
21814 }
21815
21816 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
21817         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
21818         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
21819         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
21820         return tag_ptr(ret_conv, true);
21821 }
21822
21823 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_ok"))) TS_CResult_NoneRetryableSendFailureZ_ok() {
21824         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
21825         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
21826         return tag_ptr(ret_conv, true);
21827 }
21828
21829 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_err"))) TS_CResult_NoneRetryableSendFailureZ_err(uint32_t e) {
21830         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
21831         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
21832         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
21833         return tag_ptr(ret_conv, true);
21834 }
21835
21836 jboolean  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_is_ok"))) TS_CResult_NoneRetryableSendFailureZ_is_ok(uint64_t o) {
21837         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
21838         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
21839         return ret_conv;
21840 }
21841
21842 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_free"))) TS_CResult_NoneRetryableSendFailureZ_free(uint64_t _res) {
21843         if (!ptr_is_owned(_res)) return;
21844         void* _res_ptr = untag_ptr(_res);
21845         CHECK_ACCESS(_res_ptr);
21846         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
21847         FREE(untag_ptr(_res));
21848         CResult_NoneRetryableSendFailureZ_free(_res_conv);
21849 }
21850
21851 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
21852         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
21853         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
21854         return tag_ptr(ret_conv, true);
21855 }
21856 int64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone_ptr"))) TS_CResult_NoneRetryableSendFailureZ_clone_ptr(uint64_t arg) {
21857         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
21858         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
21859         return ret_conv;
21860 }
21861
21862 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone"))) TS_CResult_NoneRetryableSendFailureZ_clone(uint64_t orig) {
21863         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
21864         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
21865         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
21866         return tag_ptr(ret_conv, true);
21867 }
21868
21869 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(int8_tArray o) {
21870         LDKThirtyTwoBytes o_ref;
21871         CHECK(o->arr_len == 32);
21872         memcpy(o_ref.data, o->elems, 32); FREE(o);
21873         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
21874         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
21875         return tag_ptr(ret_conv, true);
21876 }
21877
21878 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_err"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_err(uint64_t e) {
21879         void* e_ptr = untag_ptr(e);
21880         CHECK_ACCESS(e_ptr);
21881         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
21882         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
21883         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
21884         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
21885         return tag_ptr(ret_conv, true);
21886 }
21887
21888 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(uint64_t o) {
21889         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
21890         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
21891         return ret_conv;
21892 }
21893
21894 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_free"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_free(uint64_t _res) {
21895         if (!ptr_is_owned(_res)) return;
21896         void* _res_ptr = untag_ptr(_res);
21897         CHECK_ACCESS(_res_ptr);
21898         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
21899         FREE(untag_ptr(_res));
21900         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
21901 }
21902
21903 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
21904         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
21905         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
21906         return tag_ptr(ret_conv, true);
21907 }
21908 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(uint64_t arg) {
21909         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
21910         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
21911         return ret_conv;
21912 }
21913
21914 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(uint64_t orig) {
21915         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
21916         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
21917         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
21918         return tag_ptr(ret_conv, true);
21919 }
21920
21921 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(int8_tArray o) {
21922         LDKThirtyTwoBytes o_ref;
21923         CHECK(o->arr_len == 32);
21924         memcpy(o_ref.data, o->elems, 32); FREE(o);
21925         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
21926         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
21927         return tag_ptr(ret_conv, true);
21928 }
21929
21930 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_err"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_err(uint32_t e) {
21931         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
21932         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
21933         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
21934         return tag_ptr(ret_conv, true);
21935 }
21936
21937 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(uint64_t o) {
21938         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
21939         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
21940         return ret_conv;
21941 }
21942
21943 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_free"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_free(uint64_t _res) {
21944         if (!ptr_is_owned(_res)) return;
21945         void* _res_ptr = untag_ptr(_res);
21946         CHECK_ACCESS(_res_ptr);
21947         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
21948         FREE(untag_ptr(_res));
21949         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
21950 }
21951
21952 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
21953         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
21954         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
21955         return tag_ptr(ret_conv, true);
21956 }
21957 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(uint64_t arg) {
21958         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
21959         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
21960         return ret_conv;
21961 }
21962
21963 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(uint64_t orig) {
21964         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
21965         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
21966         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
21967         return tag_ptr(ret_conv, true);
21968 }
21969
21970 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
21971         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
21972         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
21973         return tag_ptr(ret_conv, true);
21974 }
21975 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(uint64_t arg) {
21976         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
21977         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
21978         return ret_conv;
21979 }
21980
21981 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(uint64_t orig) {
21982         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
21983         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
21984         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
21985         return tag_ptr(ret_conv, true);
21986 }
21987
21988 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(int8_tArray a, int8_tArray b) {
21989         LDKThirtyTwoBytes a_ref;
21990         CHECK(a->arr_len == 32);
21991         memcpy(a_ref.data, a->elems, 32); FREE(a);
21992         LDKThirtyTwoBytes b_ref;
21993         CHECK(b->arr_len == 32);
21994         memcpy(b_ref.data, b->elems, 32); FREE(b);
21995         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
21996         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
21997         return tag_ptr(ret_conv, true);
21998 }
21999
22000 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(uint64_t _res) {
22001         if (!ptr_is_owned(_res)) return;
22002         void* _res_ptr = untag_ptr(_res);
22003         CHECK_ACCESS(_res_ptr);
22004         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
22005         FREE(untag_ptr(_res));
22006         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
22007 }
22008
22009 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(uint64_t o) {
22010         void* o_ptr = untag_ptr(o);
22011         CHECK_ACCESS(o_ptr);
22012         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
22013         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
22014         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
22015         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
22016         return tag_ptr(ret_conv, true);
22017 }
22018
22019 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(uint64_t e) {
22020         void* e_ptr = untag_ptr(e);
22021         CHECK_ACCESS(e_ptr);
22022         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
22023         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
22024         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
22025         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
22026         return tag_ptr(ret_conv, true);
22027 }
22028
22029 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(uint64_t o) {
22030         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
22031         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
22032         return ret_conv;
22033 }
22034
22035 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(uint64_t _res) {
22036         if (!ptr_is_owned(_res)) return;
22037         void* _res_ptr = untag_ptr(_res);
22038         CHECK_ACCESS(_res_ptr);
22039         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
22040         FREE(untag_ptr(_res));
22041         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
22042 }
22043
22044 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
22045         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
22046         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
22047         return tag_ptr(ret_conv, true);
22048 }
22049 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
22050         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
22051         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
22052         return ret_conv;
22053 }
22054
22055 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(uint64_t orig) {
22056         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
22057         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
22058         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
22059         return tag_ptr(ret_conv, true);
22060 }
22061
22062 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(uint64_tArray _res) {
22063         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
22064         _res_constr.datalen = _res->arr_len;
22065         if (_res_constr.datalen > 0)
22066                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
22067         else
22068                 _res_constr.data = NULL;
22069         uint64_t* _res_vals = _res->elems;
22070         for (size_t o = 0; o < _res_constr.datalen; o++) {
22071                 uint64_t _res_conv_40 = _res_vals[o];
22072                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
22073                 CHECK_ACCESS(_res_conv_40_ptr);
22074                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
22075                 FREE(untag_ptr(_res_conv_40));
22076                 _res_constr.data[o] = _res_conv_40_conv;
22077         }
22078         FREE(_res);
22079         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
22080 }
22081
22082 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(uint64_tArray o) {
22083         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
22084         o_constr.datalen = o->arr_len;
22085         if (o_constr.datalen > 0)
22086                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
22087         else
22088                 o_constr.data = NULL;
22089         uint64_t* o_vals = o->elems;
22090         for (size_t o = 0; o < o_constr.datalen; o++) {
22091                 uint64_t o_conv_40 = o_vals[o];
22092                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
22093                 CHECK_ACCESS(o_conv_40_ptr);
22094                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
22095                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
22096                 o_constr.data[o] = o_conv_40_conv;
22097         }
22098         FREE(o);
22099         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
22100         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
22101         return tag_ptr(ret_conv, true);
22102 }
22103
22104 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(uint64_t e) {
22105         void* e_ptr = untag_ptr(e);
22106         CHECK_ACCESS(e_ptr);
22107         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
22108         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
22109         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
22110         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
22111         return tag_ptr(ret_conv, true);
22112 }
22113
22114 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(uint64_t o) {
22115         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
22116         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
22117         return ret_conv;
22118 }
22119
22120 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_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_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
22125         FREE(untag_ptr(_res));
22126         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
22127 }
22128
22129 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
22130         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
22131         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
22132         return tag_ptr(ret_conv, true);
22133 }
22134 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(uint64_t arg) {
22135         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
22136         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
22137         return ret_conv;
22138 }
22139
22140 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(uint64_t orig) {
22141         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
22142         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
22143         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
22144         return tag_ptr(ret_conv, true);
22145 }
22146
22147 static inline uint64_t C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR arg) {
22148         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
22149         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(arg);
22150         return tag_ptr(ret_conv, true);
22151 }
22152 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(uint64_t arg) {
22153         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(arg);
22154         int64_t ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(arg_conv);
22155         return ret_conv;
22156 }
22157
22158 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(uint64_t orig) {
22159         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(orig);
22160         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
22161         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(orig_conv);
22162         return tag_ptr(ret_conv, true);
22163 }
22164
22165 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_new"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_new(int8_tArray a, int8_tArray b) {
22166         LDKThirtyTwoBytes a_ref;
22167         CHECK(a->arr_len == 32);
22168         memcpy(a_ref.data, a->elems, 32); FREE(a);
22169         LDKPublicKey b_ref;
22170         CHECK(b->arr_len == 33);
22171         memcpy(b_ref.compressed_form, b->elems, 33); FREE(b);
22172         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
22173         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_new(a_ref, b_ref);
22174         return tag_ptr(ret_conv, true);
22175 }
22176
22177 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_free"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_free(uint64_t _res) {
22178         if (!ptr_is_owned(_res)) return;
22179         void* _res_ptr = untag_ptr(_res);
22180         CHECK_ACCESS(_res_ptr);
22181         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_ptr);
22182         FREE(untag_ptr(_res));
22183         C2Tuple_ThirtyTwoBytesPublicKeyZ_free(_res_conv);
22184 }
22185
22186 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(uint64_tArray _res) {
22187         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ _res_constr;
22188         _res_constr.datalen = _res->arr_len;
22189         if (_res_constr.datalen > 0)
22190                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
22191         else
22192                 _res_constr.data = NULL;
22193         uint64_t* _res_vals = _res->elems;
22194         for (size_t j = 0; j < _res_constr.datalen; j++) {
22195                 uint64_t _res_conv_35 = _res_vals[j];
22196                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
22197                 CHECK_ACCESS(_res_conv_35_ptr);
22198                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_conv_35_ptr);
22199                 FREE(untag_ptr(_res_conv_35));
22200                 _res_constr.data[j] = _res_conv_35_conv;
22201         }
22202         FREE(_res);
22203         CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res_constr);
22204 }
22205
22206 uint64_t  __attribute__((export_name("TS_COption_StrZ_some"))) TS_COption_StrZ_some(jstring o) {
22207         LDKStr o_conv = str_ref_to_owned_c(o);
22208         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
22209         *ret_copy = COption_StrZ_some(o_conv);
22210         uint64_t ret_ref = tag_ptr(ret_copy, true);
22211         return ret_ref;
22212 }
22213
22214 uint64_t  __attribute__((export_name("TS_COption_StrZ_none"))) TS_COption_StrZ_none() {
22215         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
22216         *ret_copy = COption_StrZ_none();
22217         uint64_t ret_ref = tag_ptr(ret_copy, true);
22218         return ret_ref;
22219 }
22220
22221 void  __attribute__((export_name("TS_COption_StrZ_free"))) TS_COption_StrZ_free(uint64_t _res) {
22222         if (!ptr_is_owned(_res)) return;
22223         void* _res_ptr = untag_ptr(_res);
22224         CHECK_ACCESS(_res_ptr);
22225         LDKCOption_StrZ _res_conv = *(LDKCOption_StrZ*)(_res_ptr);
22226         FREE(untag_ptr(_res));
22227         COption_StrZ_free(_res_conv);
22228 }
22229
22230 static inline uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg) {
22231         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
22232         *ret_copy = COption_StrZ_clone(arg);
22233         uint64_t ret_ref = tag_ptr(ret_copy, true);
22234         return ret_ref;
22235 }
22236 int64_t  __attribute__((export_name("TS_COption_StrZ_clone_ptr"))) TS_COption_StrZ_clone_ptr(uint64_t arg) {
22237         LDKCOption_StrZ* arg_conv = (LDKCOption_StrZ*)untag_ptr(arg);
22238         int64_t ret_conv = COption_StrZ_clone_ptr(arg_conv);
22239         return ret_conv;
22240 }
22241
22242 uint64_t  __attribute__((export_name("TS_COption_StrZ_clone"))) TS_COption_StrZ_clone(uint64_t orig) {
22243         LDKCOption_StrZ* orig_conv = (LDKCOption_StrZ*)untag_ptr(orig);
22244         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
22245         *ret_copy = COption_StrZ_clone(orig_conv);
22246         uint64_t ret_ref = tag_ptr(ret_copy, true);
22247         return ret_ref;
22248 }
22249
22250 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_ok() {
22251         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22252         *ret_conv = CResult_NoneBolt12SemanticErrorZ_ok();
22253         return tag_ptr(ret_conv, true);
22254 }
22255
22256 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_err"))) TS_CResult_NoneBolt12SemanticErrorZ_err(uint32_t e) {
22257         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
22258         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22259         *ret_conv = CResult_NoneBolt12SemanticErrorZ_err(e_conv);
22260         return tag_ptr(ret_conv, true);
22261 }
22262
22263 jboolean  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_is_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_is_ok(uint64_t o) {
22264         LDKCResult_NoneBolt12SemanticErrorZ* o_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(o);
22265         jboolean ret_conv = CResult_NoneBolt12SemanticErrorZ_is_ok(o_conv);
22266         return ret_conv;
22267 }
22268
22269 void  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_free"))) TS_CResult_NoneBolt12SemanticErrorZ_free(uint64_t _res) {
22270         if (!ptr_is_owned(_res)) return;
22271         void* _res_ptr = untag_ptr(_res);
22272         CHECK_ACCESS(_res_ptr);
22273         LDKCResult_NoneBolt12SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt12SemanticErrorZ*)(_res_ptr);
22274         FREE(untag_ptr(_res));
22275         CResult_NoneBolt12SemanticErrorZ_free(_res_conv);
22276 }
22277
22278 static inline uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg) {
22279         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22280         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(arg);
22281         return tag_ptr(ret_conv, true);
22282 }
22283 int64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_NoneBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
22284         LDKCResult_NoneBolt12SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(arg);
22285         int64_t ret_conv = CResult_NoneBolt12SemanticErrorZ_clone_ptr(arg_conv);
22286         return ret_conv;
22287 }
22288
22289 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_clone"))) TS_CResult_NoneBolt12SemanticErrorZ_clone(uint64_t orig) {
22290         LDKCResult_NoneBolt12SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(orig);
22291         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22292         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(orig_conv);
22293         return tag_ptr(ret_conv, true);
22294 }
22295
22296 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(uint64_t o) {
22297         void* o_ptr = untag_ptr(o);
22298         CHECK_ACCESS(o_ptr);
22299         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
22300         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
22301         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
22302         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
22303         return tag_ptr(ret_conv, true);
22304 }
22305
22306 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() {
22307         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
22308         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
22309         return tag_ptr(ret_conv, true);
22310 }
22311
22312 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(uint64_t o) {
22313         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
22314         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
22315         return ret_conv;
22316 }
22317
22318 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(uint64_t _res) {
22319         if (!ptr_is_owned(_res)) return;
22320         void* _res_ptr = untag_ptr(_res);
22321         CHECK_ACCESS(_res_ptr);
22322         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
22323         FREE(untag_ptr(_res));
22324         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
22325 }
22326
22327 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
22328         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
22329         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
22330         return tag_ptr(ret_conv, true);
22331 }
22332 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(uint64_t arg) {
22333         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
22334         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
22335         return ret_conv;
22336 }
22337
22338 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(uint64_t orig) {
22339         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
22340         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
22341         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
22342         return tag_ptr(ret_conv, true);
22343 }
22344
22345 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_some"))) TS_COption_OffersMessageZ_some(uint64_t o) {
22346         void* o_ptr = untag_ptr(o);
22347         CHECK_ACCESS(o_ptr);
22348         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
22349         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
22350         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22351         *ret_copy = COption_OffersMessageZ_some(o_conv);
22352         uint64_t ret_ref = tag_ptr(ret_copy, true);
22353         return ret_ref;
22354 }
22355
22356 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_none"))) TS_COption_OffersMessageZ_none() {
22357         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22358         *ret_copy = COption_OffersMessageZ_none();
22359         uint64_t ret_ref = tag_ptr(ret_copy, true);
22360         return ret_ref;
22361 }
22362
22363 void  __attribute__((export_name("TS_COption_OffersMessageZ_free"))) TS_COption_OffersMessageZ_free(uint64_t _res) {
22364         if (!ptr_is_owned(_res)) return;
22365         void* _res_ptr = untag_ptr(_res);
22366         CHECK_ACCESS(_res_ptr);
22367         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
22368         FREE(untag_ptr(_res));
22369         COption_OffersMessageZ_free(_res_conv);
22370 }
22371
22372 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
22373         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22374         *ret_copy = COption_OffersMessageZ_clone(arg);
22375         uint64_t ret_ref = tag_ptr(ret_copy, true);
22376         return ret_ref;
22377 }
22378 int64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone_ptr"))) TS_COption_OffersMessageZ_clone_ptr(uint64_t arg) {
22379         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
22380         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
22381         return ret_conv;
22382 }
22383
22384 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone"))) TS_COption_OffersMessageZ_clone(uint64_t orig) {
22385         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
22386         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22387         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
22388         uint64_t ret_ref = tag_ptr(ret_copy, true);
22389         return ret_ref;
22390 }
22391
22392 static inline uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg) {
22393         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
22394         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(arg);
22395         return tag_ptr(ret_conv, true);
22396 }
22397 int64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(uint64_t arg) {
22398         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(arg);
22399         int64_t ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(arg_conv);
22400         return ret_conv;
22401 }
22402
22403 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone(uint64_t orig) {
22404         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(orig);
22405         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
22406         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig_conv);
22407         return tag_ptr(ret_conv, true);
22408 }
22409
22410 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_new"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_new(uint64_t a, uint64_t b, uint64_t c) {
22411         void* a_ptr = untag_ptr(a);
22412         CHECK_ACCESS(a_ptr);
22413         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
22414         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
22415         void* b_ptr = untag_ptr(b);
22416         CHECK_ACCESS(b_ptr);
22417         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
22418         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
22419         LDKBlindedPath c_conv;
22420         c_conv.inner = untag_ptr(c);
22421         c_conv.is_owned = ptr_is_owned(c);
22422         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
22423         c_conv = BlindedPath_clone(&c_conv);
22424         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
22425         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
22426         return tag_ptr(ret_conv, true);
22427 }
22428
22429 void  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_free"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_free(uint64_t _res) {
22430         if (!ptr_is_owned(_res)) return;
22431         void* _res_ptr = untag_ptr(_res);
22432         CHECK_ACCESS(_res_ptr);
22433         LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_ptr);
22434         FREE(untag_ptr(_res));
22435         C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res_conv);
22436 }
22437
22438 void  __attribute__((export_name("TS_CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free"))) TS_CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(uint64_tArray _res) {
22439         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res_constr;
22440         _res_constr.datalen = _res->arr_len;
22441         if (_res_constr.datalen > 0)
22442                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
22443         else
22444                 _res_constr.data = NULL;
22445         uint64_t* _res_vals = _res->elems;
22446         for (size_t x = 0; x < _res_constr.datalen; x++) {
22447                 uint64_t _res_conv_49 = _res_vals[x];
22448                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
22449                 CHECK_ACCESS(_res_conv_49_ptr);
22450                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_conv_49_ptr);
22451                 FREE(untag_ptr(_res_conv_49));
22452                 _res_constr.data[x] = _res_conv_49_conv;
22453         }
22454         FREE(_res);
22455         CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res_constr);
22456 }
22457
22458 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
22459         LDKCounterpartyForwardingInfo o_conv;
22460         o_conv.inner = untag_ptr(o);
22461         o_conv.is_owned = ptr_is_owned(o);
22462         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22463         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
22464         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
22465         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
22466         return tag_ptr(ret_conv, true);
22467 }
22468
22469 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
22470         void* e_ptr = untag_ptr(e);
22471         CHECK_ACCESS(e_ptr);
22472         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22473         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22474         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
22475         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
22476         return tag_ptr(ret_conv, true);
22477 }
22478
22479 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
22480         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
22481         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
22482         return ret_conv;
22483 }
22484
22485 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
22486         if (!ptr_is_owned(_res)) return;
22487         void* _res_ptr = untag_ptr(_res);
22488         CHECK_ACCESS(_res_ptr);
22489         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
22490         FREE(untag_ptr(_res));
22491         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
22492 }
22493
22494 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
22495         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
22496         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
22497         return tag_ptr(ret_conv, true);
22498 }
22499 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
22500         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
22501         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
22502         return ret_conv;
22503 }
22504
22505 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
22506         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
22507         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
22508         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
22509         return tag_ptr(ret_conv, true);
22510 }
22511
22512 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
22513         LDKChannelCounterparty o_conv;
22514         o_conv.inner = untag_ptr(o);
22515         o_conv.is_owned = ptr_is_owned(o);
22516         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22517         o_conv = ChannelCounterparty_clone(&o_conv);
22518         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
22519         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
22520         return tag_ptr(ret_conv, true);
22521 }
22522
22523 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
22524         void* e_ptr = untag_ptr(e);
22525         CHECK_ACCESS(e_ptr);
22526         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22527         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22528         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
22529         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
22530         return tag_ptr(ret_conv, true);
22531 }
22532
22533 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
22534         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
22535         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
22536         return ret_conv;
22537 }
22538
22539 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
22540         if (!ptr_is_owned(_res)) return;
22541         void* _res_ptr = untag_ptr(_res);
22542         CHECK_ACCESS(_res_ptr);
22543         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
22544         FREE(untag_ptr(_res));
22545         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
22546 }
22547
22548 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
22549         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
22550         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
22551         return tag_ptr(ret_conv, true);
22552 }
22553 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
22554         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
22555         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
22556         return ret_conv;
22557 }
22558
22559 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
22560         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
22561         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
22562         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
22563         return tag_ptr(ret_conv, true);
22564 }
22565
22566 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
22567         LDKChannelDetails o_conv;
22568         o_conv.inner = untag_ptr(o);
22569         o_conv.is_owned = ptr_is_owned(o);
22570         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22571         o_conv = ChannelDetails_clone(&o_conv);
22572         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
22573         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
22574         return tag_ptr(ret_conv, true);
22575 }
22576
22577 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
22578         void* e_ptr = untag_ptr(e);
22579         CHECK_ACCESS(e_ptr);
22580         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22581         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22582         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
22583         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
22584         return tag_ptr(ret_conv, true);
22585 }
22586
22587 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
22588         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
22589         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
22590         return ret_conv;
22591 }
22592
22593 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
22594         if (!ptr_is_owned(_res)) return;
22595         void* _res_ptr = untag_ptr(_res);
22596         CHECK_ACCESS(_res_ptr);
22597         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
22598         FREE(untag_ptr(_res));
22599         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
22600 }
22601
22602 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
22603         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
22604         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
22605         return tag_ptr(ret_conv, true);
22606 }
22607 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
22608         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
22609         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
22610         return ret_conv;
22611 }
22612
22613 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
22614         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
22615         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
22616         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
22617         return tag_ptr(ret_conv, true);
22618 }
22619
22620 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
22621         LDKPhantomRouteHints o_conv;
22622         o_conv.inner = untag_ptr(o);
22623         o_conv.is_owned = ptr_is_owned(o);
22624         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22625         o_conv = PhantomRouteHints_clone(&o_conv);
22626         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
22627         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
22628         return tag_ptr(ret_conv, true);
22629 }
22630
22631 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
22632         void* e_ptr = untag_ptr(e);
22633         CHECK_ACCESS(e_ptr);
22634         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22635         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22636         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
22637         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
22638         return tag_ptr(ret_conv, true);
22639 }
22640
22641 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
22642         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
22643         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
22644         return ret_conv;
22645 }
22646
22647 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
22648         if (!ptr_is_owned(_res)) return;
22649         void* _res_ptr = untag_ptr(_res);
22650         CHECK_ACCESS(_res_ptr);
22651         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
22652         FREE(untag_ptr(_res));
22653         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
22654 }
22655
22656 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
22657         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
22658         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
22659         return tag_ptr(ret_conv, true);
22660 }
22661 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
22662         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
22663         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
22664         return ret_conv;
22665 }
22666
22667 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
22668         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
22669         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
22670         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
22671         return tag_ptr(ret_conv, true);
22672 }
22673
22674 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_ok"))) TS_CResult_BlindedForwardDecodeErrorZ_ok(uint64_t o) {
22675         LDKBlindedForward o_conv;
22676         o_conv.inner = untag_ptr(o);
22677         o_conv.is_owned = ptr_is_owned(o);
22678         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22679         o_conv = BlindedForward_clone(&o_conv);
22680         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
22681         *ret_conv = CResult_BlindedForwardDecodeErrorZ_ok(o_conv);
22682         return tag_ptr(ret_conv, true);
22683 }
22684
22685 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_err"))) TS_CResult_BlindedForwardDecodeErrorZ_err(uint64_t e) {
22686         void* e_ptr = untag_ptr(e);
22687         CHECK_ACCESS(e_ptr);
22688         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22689         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22690         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
22691         *ret_conv = CResult_BlindedForwardDecodeErrorZ_err(e_conv);
22692         return tag_ptr(ret_conv, true);
22693 }
22694
22695 jboolean  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_is_ok"))) TS_CResult_BlindedForwardDecodeErrorZ_is_ok(uint64_t o) {
22696         LDKCResult_BlindedForwardDecodeErrorZ* o_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(o);
22697         jboolean ret_conv = CResult_BlindedForwardDecodeErrorZ_is_ok(o_conv);
22698         return ret_conv;
22699 }
22700
22701 void  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_free"))) TS_CResult_BlindedForwardDecodeErrorZ_free(uint64_t _res) {
22702         if (!ptr_is_owned(_res)) return;
22703         void* _res_ptr = untag_ptr(_res);
22704         CHECK_ACCESS(_res_ptr);
22705         LDKCResult_BlindedForwardDecodeErrorZ _res_conv = *(LDKCResult_BlindedForwardDecodeErrorZ*)(_res_ptr);
22706         FREE(untag_ptr(_res));
22707         CResult_BlindedForwardDecodeErrorZ_free(_res_conv);
22708 }
22709
22710 static inline uint64_t CResult_BlindedForwardDecodeErrorZ_clone_ptr(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR arg) {
22711         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
22712         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(arg);
22713         return tag_ptr(ret_conv, true);
22714 }
22715 int64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedForwardDecodeErrorZ_clone_ptr(uint64_t arg) {
22716         LDKCResult_BlindedForwardDecodeErrorZ* arg_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(arg);
22717         int64_t ret_conv = CResult_BlindedForwardDecodeErrorZ_clone_ptr(arg_conv);
22718         return ret_conv;
22719 }
22720
22721 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_clone"))) TS_CResult_BlindedForwardDecodeErrorZ_clone(uint64_t orig) {
22722         LDKCResult_BlindedForwardDecodeErrorZ* orig_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(orig);
22723         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
22724         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(orig_conv);
22725         return tag_ptr(ret_conv, true);
22726 }
22727
22728 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_ok"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_ok(uint64_t o) {
22729         void* o_ptr = untag_ptr(o);
22730         CHECK_ACCESS(o_ptr);
22731         LDKPendingHTLCRouting o_conv = *(LDKPendingHTLCRouting*)(o_ptr);
22732         o_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(o));
22733         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
22734         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_ok(o_conv);
22735         return tag_ptr(ret_conv, true);
22736 }
22737
22738 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_err"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_err(uint64_t e) {
22739         void* e_ptr = untag_ptr(e);
22740         CHECK_ACCESS(e_ptr);
22741         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22742         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22743         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
22744         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_err(e_conv);
22745         return tag_ptr(ret_conv, true);
22746 }
22747
22748 jboolean  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_is_ok"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(uint64_t o) {
22749         LDKCResult_PendingHTLCRoutingDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(o);
22750         jboolean ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o_conv);
22751         return ret_conv;
22752 }
22753
22754 void  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_free"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_free(uint64_t _res) {
22755         if (!ptr_is_owned(_res)) return;
22756         void* _res_ptr = untag_ptr(_res);
22757         CHECK_ACCESS(_res_ptr);
22758         LDKCResult_PendingHTLCRoutingDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCRoutingDecodeErrorZ*)(_res_ptr);
22759         FREE(untag_ptr(_res));
22760         CResult_PendingHTLCRoutingDecodeErrorZ_free(_res_conv);
22761 }
22762
22763 static inline uint64_t CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR arg) {
22764         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
22765         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(arg);
22766         return tag_ptr(ret_conv, true);
22767 }
22768 int64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(uint64_t arg) {
22769         LDKCResult_PendingHTLCRoutingDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(arg);
22770         int64_t ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(arg_conv);
22771         return ret_conv;
22772 }
22773
22774 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone(uint64_t orig) {
22775         LDKCResult_PendingHTLCRoutingDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(orig);
22776         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
22777         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig_conv);
22778         return tag_ptr(ret_conv, true);
22779 }
22780
22781 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_ok"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_ok(uint64_t o) {
22782         LDKPendingHTLCInfo o_conv;
22783         o_conv.inner = untag_ptr(o);
22784         o_conv.is_owned = ptr_is_owned(o);
22785         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22786         o_conv = PendingHTLCInfo_clone(&o_conv);
22787         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
22788         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_ok(o_conv);
22789         return tag_ptr(ret_conv, true);
22790 }
22791
22792 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_err"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_err(uint64_t e) {
22793         void* e_ptr = untag_ptr(e);
22794         CHECK_ACCESS(e_ptr);
22795         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22796         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22797         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
22798         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_err(e_conv);
22799         return tag_ptr(ret_conv, true);
22800 }
22801
22802 jboolean  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_is_ok"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_is_ok(uint64_t o) {
22803         LDKCResult_PendingHTLCInfoDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(o);
22804         jboolean ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o_conv);
22805         return ret_conv;
22806 }
22807
22808 void  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_free"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_free(uint64_t _res) {
22809         if (!ptr_is_owned(_res)) return;
22810         void* _res_ptr = untag_ptr(_res);
22811         CHECK_ACCESS(_res_ptr);
22812         LDKCResult_PendingHTLCInfoDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCInfoDecodeErrorZ*)(_res_ptr);
22813         FREE(untag_ptr(_res));
22814         CResult_PendingHTLCInfoDecodeErrorZ_free(_res_conv);
22815 }
22816
22817 static inline uint64_t CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR arg) {
22818         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
22819         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(arg);
22820         return tag_ptr(ret_conv, true);
22821 }
22822 int64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
22823         LDKCResult_PendingHTLCInfoDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(arg);
22824         int64_t ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(arg_conv);
22825         return ret_conv;
22826 }
22827
22828 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_clone"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_clone(uint64_t orig) {
22829         LDKCResult_PendingHTLCInfoDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(orig);
22830         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
22831         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(orig_conv);
22832         return tag_ptr(ret_conv, true);
22833 }
22834
22835 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_ok"))) TS_CResult_BlindedFailureDecodeErrorZ_ok(uint32_t o) {
22836         LDKBlindedFailure o_conv = LDKBlindedFailure_from_js(o);
22837         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
22838         *ret_conv = CResult_BlindedFailureDecodeErrorZ_ok(o_conv);
22839         return tag_ptr(ret_conv, true);
22840 }
22841
22842 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_err"))) TS_CResult_BlindedFailureDecodeErrorZ_err(uint64_t e) {
22843         void* e_ptr = untag_ptr(e);
22844         CHECK_ACCESS(e_ptr);
22845         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22846         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22847         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
22848         *ret_conv = CResult_BlindedFailureDecodeErrorZ_err(e_conv);
22849         return tag_ptr(ret_conv, true);
22850 }
22851
22852 jboolean  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_is_ok"))) TS_CResult_BlindedFailureDecodeErrorZ_is_ok(uint64_t o) {
22853         LDKCResult_BlindedFailureDecodeErrorZ* o_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(o);
22854         jboolean ret_conv = CResult_BlindedFailureDecodeErrorZ_is_ok(o_conv);
22855         return ret_conv;
22856 }
22857
22858 void  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_free"))) TS_CResult_BlindedFailureDecodeErrorZ_free(uint64_t _res) {
22859         if (!ptr_is_owned(_res)) return;
22860         void* _res_ptr = untag_ptr(_res);
22861         CHECK_ACCESS(_res_ptr);
22862         LDKCResult_BlindedFailureDecodeErrorZ _res_conv = *(LDKCResult_BlindedFailureDecodeErrorZ*)(_res_ptr);
22863         FREE(untag_ptr(_res));
22864         CResult_BlindedFailureDecodeErrorZ_free(_res_conv);
22865 }
22866
22867 static inline uint64_t CResult_BlindedFailureDecodeErrorZ_clone_ptr(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR arg) {
22868         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
22869         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(arg);
22870         return tag_ptr(ret_conv, true);
22871 }
22872 int64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedFailureDecodeErrorZ_clone_ptr(uint64_t arg) {
22873         LDKCResult_BlindedFailureDecodeErrorZ* arg_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(arg);
22874         int64_t ret_conv = CResult_BlindedFailureDecodeErrorZ_clone_ptr(arg_conv);
22875         return ret_conv;
22876 }
22877
22878 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_clone"))) TS_CResult_BlindedFailureDecodeErrorZ_clone(uint64_t orig) {
22879         LDKCResult_BlindedFailureDecodeErrorZ* orig_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(orig);
22880         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
22881         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(orig_conv);
22882         return tag_ptr(ret_conv, true);
22883 }
22884
22885 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_ok(uint32_t o) {
22886         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
22887         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
22888         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
22889         return tag_ptr(ret_conv, true);
22890 }
22891
22892 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_err(uint64_t e) {
22893         void* e_ptr = untag_ptr(e);
22894         CHECK_ACCESS(e_ptr);
22895         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22896         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22897         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
22898         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
22899         return tag_ptr(ret_conv, true);
22900 }
22901
22902 jboolean  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok(uint64_t o) {
22903         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
22904         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
22905         return ret_conv;
22906 }
22907
22908 void  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_free"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_free(uint64_t _res) {
22909         if (!ptr_is_owned(_res)) return;
22910         void* _res_ptr = untag_ptr(_res);
22911         CHECK_ACCESS(_res_ptr);
22912         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
22913         FREE(untag_ptr(_res));
22914         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
22915 }
22916
22917 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
22918         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
22919         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
22920         return tag_ptr(ret_conv, true);
22921 }
22922 int64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(uint64_t arg) {
22923         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
22924         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
22925         return ret_conv;
22926 }
22927
22928 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone(uint64_t orig) {
22929         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
22930         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
22931         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
22932         return tag_ptr(ret_conv, true);
22933 }
22934
22935 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
22936         LDKCVec_ChannelMonitorZ _res_constr;
22937         _res_constr.datalen = _res->arr_len;
22938         if (_res_constr.datalen > 0)
22939                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
22940         else
22941                 _res_constr.data = NULL;
22942         uint64_t* _res_vals = _res->elems;
22943         for (size_t q = 0; q < _res_constr.datalen; q++) {
22944                 uint64_t _res_conv_16 = _res_vals[q];
22945                 LDKChannelMonitor _res_conv_16_conv;
22946                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
22947                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
22948                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
22949                 _res_constr.data[q] = _res_conv_16_conv;
22950         }
22951         FREE(_res);
22952         CVec_ChannelMonitorZ_free(_res_constr);
22953 }
22954
22955 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_new"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_new(int8_tArray a, uint64_t b) {
22956         LDKThirtyTwoBytes a_ref;
22957         CHECK(a->arr_len == 32);
22958         memcpy(a_ref.data, a->elems, 32); FREE(a);
22959         LDKChannelManager b_conv;
22960         b_conv.inner = untag_ptr(b);
22961         b_conv.is_owned = ptr_is_owned(b);
22962         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22963         // WARNING: we need a move here but no clone is available for LDKChannelManager
22964         
22965         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
22966         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
22967         return tag_ptr(ret_conv, true);
22968 }
22969
22970 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_free"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_free(uint64_t _res) {
22971         if (!ptr_is_owned(_res)) return;
22972         void* _res_ptr = untag_ptr(_res);
22973         CHECK_ACCESS(_res_ptr);
22974         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
22975         FREE(untag_ptr(_res));
22976         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
22977 }
22978
22979 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(uint64_t o) {
22980         void* o_ptr = untag_ptr(o);
22981         CHECK_ACCESS(o_ptr);
22982         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
22983         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
22984         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
22985         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
22986         return tag_ptr(ret_conv, true);
22987 }
22988
22989 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(uint64_t e) {
22990         void* e_ptr = untag_ptr(e);
22991         CHECK_ACCESS(e_ptr);
22992         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22993         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22994         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
22995         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
22996         return tag_ptr(ret_conv, true);
22997 }
22998
22999 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
23000         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
23001         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
23002         return ret_conv;
23003 }
23004
23005 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(uint64_t _res) {
23006         if (!ptr_is_owned(_res)) return;
23007         void* _res_ptr = untag_ptr(_res);
23008         CHECK_ACCESS(_res_ptr);
23009         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
23010         FREE(untag_ptr(_res));
23011         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
23012 }
23013
23014 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok(uint64_t o) {
23015         void* o_ptr = untag_ptr(o);
23016         CHECK_ACCESS(o_ptr);
23017         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
23018         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
23019         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
23020         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
23021         return tag_ptr(ret_conv, true);
23022 }
23023
23024 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err(uint64_t e) {
23025         void* e_ptr = untag_ptr(e);
23026         CHECK_ACCESS(e_ptr);
23027         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23028         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23029         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
23030         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
23031         return tag_ptr(ret_conv, true);
23032 }
23033
23034 jboolean  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(uint64_t o) {
23035         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
23036         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
23037         return ret_conv;
23038 }
23039
23040 void  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free(uint64_t _res) {
23041         if (!ptr_is_owned(_res)) return;
23042         void* _res_ptr = untag_ptr(_res);
23043         CHECK_ACCESS(_res_ptr);
23044         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
23045         FREE(untag_ptr(_res));
23046         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
23047 }
23048
23049 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
23050         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
23051         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
23052         return tag_ptr(ret_conv, true);
23053 }
23054 int64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(uint64_t arg) {
23055         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
23056         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
23057         return ret_conv;
23058 }
23059
23060 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone(uint64_t orig) {
23061         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
23062         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
23063         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
23064         return tag_ptr(ret_conv, true);
23065 }
23066
23067 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
23068         LDKChannelConfig o_conv;
23069         o_conv.inner = untag_ptr(o);
23070         o_conv.is_owned = ptr_is_owned(o);
23071         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23072         o_conv = ChannelConfig_clone(&o_conv);
23073         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
23074         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
23075         return tag_ptr(ret_conv, true);
23076 }
23077
23078 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
23079         void* e_ptr = untag_ptr(e);
23080         CHECK_ACCESS(e_ptr);
23081         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23082         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23083         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
23084         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
23085         return tag_ptr(ret_conv, true);
23086 }
23087
23088 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
23089         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
23090         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
23091         return ret_conv;
23092 }
23093
23094 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
23095         if (!ptr_is_owned(_res)) return;
23096         void* _res_ptr = untag_ptr(_res);
23097         CHECK_ACCESS(_res_ptr);
23098         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
23099         FREE(untag_ptr(_res));
23100         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
23101 }
23102
23103 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
23104         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
23105         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
23106         return tag_ptr(ret_conv, true);
23107 }
23108 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
23109         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
23110         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
23111         return ret_conv;
23112 }
23113
23114 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
23115         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
23116         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
23117         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
23118         return tag_ptr(ret_conv, true);
23119 }
23120
23121 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_some"))) TS_COption_MaxDustHTLCExposureZ_some(uint64_t o) {
23122         void* o_ptr = untag_ptr(o);
23123         CHECK_ACCESS(o_ptr);
23124         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
23125         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
23126         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
23127         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
23128         uint64_t ret_ref = tag_ptr(ret_copy, true);
23129         return ret_ref;
23130 }
23131
23132 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_none"))) TS_COption_MaxDustHTLCExposureZ_none() {
23133         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
23134         *ret_copy = COption_MaxDustHTLCExposureZ_none();
23135         uint64_t ret_ref = tag_ptr(ret_copy, true);
23136         return ret_ref;
23137 }
23138
23139 void  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_free"))) TS_COption_MaxDustHTLCExposureZ_free(uint64_t _res) {
23140         if (!ptr_is_owned(_res)) return;
23141         void* _res_ptr = untag_ptr(_res);
23142         CHECK_ACCESS(_res_ptr);
23143         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
23144         FREE(untag_ptr(_res));
23145         COption_MaxDustHTLCExposureZ_free(_res_conv);
23146 }
23147
23148 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
23149         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
23150         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
23151         uint64_t ret_ref = tag_ptr(ret_copy, true);
23152         return ret_ref;
23153 }
23154 int64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone_ptr"))) TS_COption_MaxDustHTLCExposureZ_clone_ptr(uint64_t arg) {
23155         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
23156         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
23157         return ret_conv;
23158 }
23159
23160 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone"))) TS_COption_MaxDustHTLCExposureZ_clone(uint64_t orig) {
23161         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
23162         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
23163         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
23164         uint64_t ret_ref = tag_ptr(ret_copy, true);
23165         return ret_ref;
23166 }
23167
23168 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_some"))) TS_COption_APIErrorZ_some(uint64_t o) {
23169         void* o_ptr = untag_ptr(o);
23170         CHECK_ACCESS(o_ptr);
23171         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
23172         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
23173         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
23174         *ret_copy = COption_APIErrorZ_some(o_conv);
23175         uint64_t ret_ref = tag_ptr(ret_copy, true);
23176         return ret_ref;
23177 }
23178
23179 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_none"))) TS_COption_APIErrorZ_none() {
23180         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
23181         *ret_copy = COption_APIErrorZ_none();
23182         uint64_t ret_ref = tag_ptr(ret_copy, true);
23183         return ret_ref;
23184 }
23185
23186 void  __attribute__((export_name("TS_COption_APIErrorZ_free"))) TS_COption_APIErrorZ_free(uint64_t _res) {
23187         if (!ptr_is_owned(_res)) return;
23188         void* _res_ptr = untag_ptr(_res);
23189         CHECK_ACCESS(_res_ptr);
23190         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
23191         FREE(untag_ptr(_res));
23192         COption_APIErrorZ_free(_res_conv);
23193 }
23194
23195 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
23196         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
23197         *ret_copy = COption_APIErrorZ_clone(arg);
23198         uint64_t ret_ref = tag_ptr(ret_copy, true);
23199         return ret_ref;
23200 }
23201 int64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone_ptr"))) TS_COption_APIErrorZ_clone_ptr(uint64_t arg) {
23202         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
23203         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
23204         return ret_conv;
23205 }
23206
23207 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone"))) TS_COption_APIErrorZ_clone(uint64_t orig) {
23208         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
23209         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
23210         *ret_copy = COption_APIErrorZ_clone(orig_conv);
23211         uint64_t ret_ref = tag_ptr(ret_copy, true);
23212         return ret_ref;
23213 }
23214
23215 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_ok(uint64_t o) {
23216         void* o_ptr = untag_ptr(o);
23217         CHECK_ACCESS(o_ptr);
23218         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
23219         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
23220         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
23221         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
23222         return tag_ptr(ret_conv, true);
23223 }
23224
23225 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_err(uint64_t e) {
23226         void* e_ptr = untag_ptr(e);
23227         CHECK_ACCESS(e_ptr);
23228         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23229         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23230         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
23231         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
23232         return tag_ptr(ret_conv, true);
23233 }
23234
23235 jboolean  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok(uint64_t o) {
23236         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
23237         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
23238         return ret_conv;
23239 }
23240
23241 void  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_free"))) TS_CResult_COption_APIErrorZDecodeErrorZ_free(uint64_t _res) {
23242         if (!ptr_is_owned(_res)) return;
23243         void* _res_ptr = untag_ptr(_res);
23244         CHECK_ACCESS(_res_ptr);
23245         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
23246         FREE(untag_ptr(_res));
23247         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
23248 }
23249
23250 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
23251         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
23252         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
23253         return tag_ptr(ret_conv, true);
23254 }
23255 int64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(uint64_t arg) {
23256         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
23257         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
23258         return ret_conv;
23259 }
23260
23261 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone(uint64_t orig) {
23262         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
23263         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
23264         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
23265         return tag_ptr(ret_conv, true);
23266 }
23267
23268 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
23269         LDKChannelMonitorUpdate o_conv;
23270         o_conv.inner = untag_ptr(o);
23271         o_conv.is_owned = ptr_is_owned(o);
23272         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23273         o_conv = ChannelMonitorUpdate_clone(&o_conv);
23274         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23275         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
23276         return tag_ptr(ret_conv, true);
23277 }
23278
23279 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
23280         void* e_ptr = untag_ptr(e);
23281         CHECK_ACCESS(e_ptr);
23282         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23283         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23284         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23285         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
23286         return tag_ptr(ret_conv, true);
23287 }
23288
23289 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
23290         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
23291         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
23292         return ret_conv;
23293 }
23294
23295 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
23296         if (!ptr_is_owned(_res)) return;
23297         void* _res_ptr = untag_ptr(_res);
23298         CHECK_ACCESS(_res_ptr);
23299         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
23300         FREE(untag_ptr(_res));
23301         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
23302 }
23303
23304 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
23305         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23306         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
23307         return tag_ptr(ret_conv, true);
23308 }
23309 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
23310         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
23311         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
23312         return ret_conv;
23313 }
23314
23315 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
23316         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
23317         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23318         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
23319         return tag_ptr(ret_conv, true);
23320 }
23321
23322 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
23323         void* o_ptr = untag_ptr(o);
23324         CHECK_ACCESS(o_ptr);
23325         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
23326         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
23327         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
23328         *ret_copy = COption_MonitorEventZ_some(o_conv);
23329         uint64_t ret_ref = tag_ptr(ret_copy, true);
23330         return ret_ref;
23331 }
23332
23333 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
23334         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
23335         *ret_copy = COption_MonitorEventZ_none();
23336         uint64_t ret_ref = tag_ptr(ret_copy, true);
23337         return ret_ref;
23338 }
23339
23340 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
23341         if (!ptr_is_owned(_res)) return;
23342         void* _res_ptr = untag_ptr(_res);
23343         CHECK_ACCESS(_res_ptr);
23344         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
23345         FREE(untag_ptr(_res));
23346         COption_MonitorEventZ_free(_res_conv);
23347 }
23348
23349 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
23350         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
23351         *ret_copy = COption_MonitorEventZ_clone(arg);
23352         uint64_t ret_ref = tag_ptr(ret_copy, true);
23353         return ret_ref;
23354 }
23355 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
23356         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
23357         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
23358         return ret_conv;
23359 }
23360
23361 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
23362         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
23363         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
23364         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
23365         uint64_t ret_ref = tag_ptr(ret_copy, true);
23366         return ret_ref;
23367 }
23368
23369 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
23370         void* o_ptr = untag_ptr(o);
23371         CHECK_ACCESS(o_ptr);
23372         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
23373         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
23374         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
23375         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
23376         return tag_ptr(ret_conv, true);
23377 }
23378
23379 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
23380         void* e_ptr = untag_ptr(e);
23381         CHECK_ACCESS(e_ptr);
23382         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23383         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23384         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
23385         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
23386         return tag_ptr(ret_conv, true);
23387 }
23388
23389 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
23390         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
23391         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
23392         return ret_conv;
23393 }
23394
23395 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
23396         if (!ptr_is_owned(_res)) return;
23397         void* _res_ptr = untag_ptr(_res);
23398         CHECK_ACCESS(_res_ptr);
23399         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
23400         FREE(untag_ptr(_res));
23401         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
23402 }
23403
23404 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
23405         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
23406         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
23407         return tag_ptr(ret_conv, true);
23408 }
23409 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
23410         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
23411         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
23412         return ret_conv;
23413 }
23414
23415 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
23416         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
23417         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
23418         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
23419         return tag_ptr(ret_conv, true);
23420 }
23421
23422 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
23423         LDKHTLCUpdate o_conv;
23424         o_conv.inner = untag_ptr(o);
23425         o_conv.is_owned = ptr_is_owned(o);
23426         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23427         o_conv = HTLCUpdate_clone(&o_conv);
23428         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
23429         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
23430         return tag_ptr(ret_conv, true);
23431 }
23432
23433 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
23434         void* e_ptr = untag_ptr(e);
23435         CHECK_ACCESS(e_ptr);
23436         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23437         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23438         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
23439         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
23440         return tag_ptr(ret_conv, true);
23441 }
23442
23443 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
23444         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
23445         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
23446         return ret_conv;
23447 }
23448
23449 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
23450         if (!ptr_is_owned(_res)) return;
23451         void* _res_ptr = untag_ptr(_res);
23452         CHECK_ACCESS(_res_ptr);
23453         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
23454         FREE(untag_ptr(_res));
23455         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
23456 }
23457
23458 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
23459         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
23460         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
23461         return tag_ptr(ret_conv, true);
23462 }
23463 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
23464         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
23465         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
23466         return ret_conv;
23467 }
23468
23469 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
23470         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
23471         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
23472         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
23473         return tag_ptr(ret_conv, true);
23474 }
23475
23476 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
23477         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
23478         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
23479         return tag_ptr(ret_conv, true);
23480 }
23481 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_u8ZZ_clone_ptr(uint64_t arg) {
23482         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
23483         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
23484         return ret_conv;
23485 }
23486
23487 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_clone"))) TS_C2Tuple_OutPointCVec_u8ZZ_clone(uint64_t orig) {
23488         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
23489         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
23490         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
23491         return tag_ptr(ret_conv, true);
23492 }
23493
23494 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_new"))) TS_C2Tuple_OutPointCVec_u8ZZ_new(uint64_t a, int8_tArray b) {
23495         LDKOutPoint a_conv;
23496         a_conv.inner = untag_ptr(a);
23497         a_conv.is_owned = ptr_is_owned(a);
23498         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23499         a_conv = OutPoint_clone(&a_conv);
23500         LDKCVec_u8Z b_ref;
23501         b_ref.datalen = b->arr_len;
23502         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
23503         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
23504         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
23505         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
23506         return tag_ptr(ret_conv, true);
23507 }
23508
23509 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_free"))) TS_C2Tuple_OutPointCVec_u8ZZ_free(uint64_t _res) {
23510         if (!ptr_is_owned(_res)) return;
23511         void* _res_ptr = untag_ptr(_res);
23512         CHECK_ACCESS(_res_ptr);
23513         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
23514         FREE(untag_ptr(_res));
23515         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
23516 }
23517
23518 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
23519         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
23520         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
23521         return tag_ptr(ret_conv, true);
23522 }
23523 int64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_clone_ptr"))) TS_C2Tuple_u32CVec_u8ZZ_clone_ptr(uint64_t arg) {
23524         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
23525         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
23526         return ret_conv;
23527 }
23528
23529 uint64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_clone"))) TS_C2Tuple_u32CVec_u8ZZ_clone(uint64_t orig) {
23530         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
23531         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
23532         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
23533         return tag_ptr(ret_conv, true);
23534 }
23535
23536 uint64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_new"))) TS_C2Tuple_u32CVec_u8ZZ_new(int32_t a, int8_tArray b) {
23537         LDKCVec_u8Z b_ref;
23538         b_ref.datalen = b->arr_len;
23539         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
23540         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
23541         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
23542         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
23543         return tag_ptr(ret_conv, true);
23544 }
23545
23546 void  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_free"))) TS_C2Tuple_u32CVec_u8ZZ_free(uint64_t _res) {
23547         if (!ptr_is_owned(_res)) return;
23548         void* _res_ptr = untag_ptr(_res);
23549         CHECK_ACCESS(_res_ptr);
23550         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
23551         FREE(untag_ptr(_res));
23552         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
23553 }
23554
23555 void  __attribute__((export_name("TS_CVec_C2Tuple_u32CVec_u8ZZZ_free"))) TS_CVec_C2Tuple_u32CVec_u8ZZZ_free(uint64_tArray _res) {
23556         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
23557         _res_constr.datalen = _res->arr_len;
23558         if (_res_constr.datalen > 0)
23559                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
23560         else
23561                 _res_constr.data = NULL;
23562         uint64_t* _res_vals = _res->elems;
23563         for (size_t x = 0; x < _res_constr.datalen; x++) {
23564                 uint64_t _res_conv_23 = _res_vals[x];
23565                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
23566                 CHECK_ACCESS(_res_conv_23_ptr);
23567                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
23568                 FREE(untag_ptr(_res_conv_23));
23569                 _res_constr.data[x] = _res_conv_23_conv;
23570         }
23571         FREE(_res);
23572         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
23573 }
23574
23575 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
23576         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
23577         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
23578         return tag_ptr(ret_conv, true);
23579 }
23580 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(uint64_t arg) {
23581         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
23582         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
23583         return ret_conv;
23584 }
23585
23586 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(uint64_t orig) {
23587         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
23588         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
23589         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
23590         return tag_ptr(ret_conv, true);
23591 }
23592
23593 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(int8_tArray a, uint64_tArray b) {
23594         LDKThirtyTwoBytes a_ref;
23595         CHECK(a->arr_len == 32);
23596         memcpy(a_ref.data, a->elems, 32); FREE(a);
23597         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
23598         b_constr.datalen = b->arr_len;
23599         if (b_constr.datalen > 0)
23600                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
23601         else
23602                 b_constr.data = NULL;
23603         uint64_t* b_vals = b->elems;
23604         for (size_t x = 0; x < b_constr.datalen; x++) {
23605                 uint64_t b_conv_23 = b_vals[x];
23606                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
23607                 CHECK_ACCESS(b_conv_23_ptr);
23608                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
23609                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
23610                 b_constr.data[x] = b_conv_23_conv;
23611         }
23612         FREE(b);
23613         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
23614         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
23615         return tag_ptr(ret_conv, true);
23616 }
23617
23618 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(uint64_t _res) {
23619         if (!ptr_is_owned(_res)) return;
23620         void* _res_ptr = untag_ptr(_res);
23621         CHECK_ACCESS(_res_ptr);
23622         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
23623         FREE(untag_ptr(_res));
23624         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
23625 }
23626
23627 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(uint64_tArray _res) {
23628         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
23629         _res_constr.datalen = _res->arr_len;
23630         if (_res_constr.datalen > 0)
23631                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
23632         else
23633                 _res_constr.data = NULL;
23634         uint64_t* _res_vals = _res->elems;
23635         for (size_t a = 0; a < _res_constr.datalen; a++) {
23636                 uint64_t _res_conv_52 = _res_vals[a];
23637                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
23638                 CHECK_ACCESS(_res_conv_52_ptr);
23639                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
23640                 FREE(untag_ptr(_res_conv_52));
23641                 _res_constr.data[a] = _res_conv_52_conv;
23642         }
23643         FREE(_res);
23644         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
23645 }
23646
23647 void  __attribute__((export_name("TS_CVec_CommitmentTransactionZ_free"))) TS_CVec_CommitmentTransactionZ_free(uint64_tArray _res) {
23648         LDKCVec_CommitmentTransactionZ _res_constr;
23649         _res_constr.datalen = _res->arr_len;
23650         if (_res_constr.datalen > 0)
23651                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
23652         else
23653                 _res_constr.data = NULL;
23654         uint64_t* _res_vals = _res->elems;
23655         for (size_t x = 0; x < _res_constr.datalen; x++) {
23656                 uint64_t _res_conv_23 = _res_vals[x];
23657                 LDKCommitmentTransaction _res_conv_23_conv;
23658                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
23659                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
23660                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
23661                 _res_constr.data[x] = _res_conv_23_conv;
23662         }
23663         FREE(_res);
23664         CVec_CommitmentTransactionZ_free(_res_constr);
23665 }
23666
23667 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
23668         LDKCVec_TransactionZ _res_constr;
23669         _res_constr.datalen = _res->arr_len;
23670         if (_res_constr.datalen > 0)
23671                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
23672         else
23673                 _res_constr.data = NULL;
23674         int8_tArray* _res_vals = (void*) _res->elems;
23675         for (size_t m = 0; m < _res_constr.datalen; m++) {
23676                 int8_tArray _res_conv_12 = _res_vals[m];
23677                 LDKTransaction _res_conv_12_ref;
23678                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
23679                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
23680                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
23681                 _res_conv_12_ref.data_is_owned = true;
23682                 _res_constr.data[m] = _res_conv_12_ref;
23683         }
23684         FREE(_res);
23685         CVec_TransactionZ_free(_res_constr);
23686 }
23687
23688 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
23689         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
23690         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
23691         return tag_ptr(ret_conv, true);
23692 }
23693 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
23694         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
23695         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
23696         return ret_conv;
23697 }
23698
23699 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
23700         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
23701         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
23702         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
23703         return tag_ptr(ret_conv, true);
23704 }
23705
23706 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
23707         void* b_ptr = untag_ptr(b);
23708         CHECK_ACCESS(b_ptr);
23709         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
23710         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
23711         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
23712         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
23713         return tag_ptr(ret_conv, true);
23714 }
23715
23716 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
23717         if (!ptr_is_owned(_res)) return;
23718         void* _res_ptr = untag_ptr(_res);
23719         CHECK_ACCESS(_res_ptr);
23720         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
23721         FREE(untag_ptr(_res));
23722         C2Tuple_u32TxOutZ_free(_res_conv);
23723 }
23724
23725 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
23726         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
23727         _res_constr.datalen = _res->arr_len;
23728         if (_res_constr.datalen > 0)
23729                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
23730         else
23731                 _res_constr.data = NULL;
23732         uint64_t* _res_vals = _res->elems;
23733         for (size_t u = 0; u < _res_constr.datalen; u++) {
23734                 uint64_t _res_conv_20 = _res_vals[u];
23735                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
23736                 CHECK_ACCESS(_res_conv_20_ptr);
23737                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
23738                 FREE(untag_ptr(_res_conv_20));
23739                 _res_constr.data[u] = _res_conv_20_conv;
23740         }
23741         FREE(_res);
23742         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
23743 }
23744
23745 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
23746         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
23747         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
23748         return tag_ptr(ret_conv, true);
23749 }
23750 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
23751         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
23752         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
23753         return ret_conv;
23754 }
23755
23756 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
23757         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
23758         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
23759         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
23760         return tag_ptr(ret_conv, true);
23761 }
23762
23763 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
23764         LDKThirtyTwoBytes a_ref;
23765         CHECK(a->arr_len == 32);
23766         memcpy(a_ref.data, a->elems, 32); FREE(a);
23767         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
23768         b_constr.datalen = b->arr_len;
23769         if (b_constr.datalen > 0)
23770                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
23771         else
23772                 b_constr.data = NULL;
23773         uint64_t* b_vals = b->elems;
23774         for (size_t u = 0; u < b_constr.datalen; u++) {
23775                 uint64_t b_conv_20 = b_vals[u];
23776                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
23777                 CHECK_ACCESS(b_conv_20_ptr);
23778                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
23779                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
23780                 b_constr.data[u] = b_conv_20_conv;
23781         }
23782         FREE(b);
23783         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
23784         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
23785         return tag_ptr(ret_conv, true);
23786 }
23787
23788 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
23789         if (!ptr_is_owned(_res)) return;
23790         void* _res_ptr = untag_ptr(_res);
23791         CHECK_ACCESS(_res_ptr);
23792         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
23793         FREE(untag_ptr(_res));
23794         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
23795 }
23796
23797 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
23798         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
23799         _res_constr.datalen = _res->arr_len;
23800         if (_res_constr.datalen > 0)
23801                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
23802         else
23803                 _res_constr.data = NULL;
23804         uint64_t* _res_vals = _res->elems;
23805         for (size_t x = 0; x < _res_constr.datalen; x++) {
23806                 uint64_t _res_conv_49 = _res_vals[x];
23807                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
23808                 CHECK_ACCESS(_res_conv_49_ptr);
23809                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
23810                 FREE(untag_ptr(_res_conv_49));
23811                 _res_constr.data[x] = _res_conv_49_conv;
23812         }
23813         FREE(_res);
23814         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
23815 }
23816
23817 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
23818         LDKCVec_BalanceZ _res_constr;
23819         _res_constr.datalen = _res->arr_len;
23820         if (_res_constr.datalen > 0)
23821                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
23822         else
23823                 _res_constr.data = NULL;
23824         uint64_t* _res_vals = _res->elems;
23825         for (size_t j = 0; j < _res_constr.datalen; j++) {
23826                 uint64_t _res_conv_9 = _res_vals[j];
23827                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
23828                 CHECK_ACCESS(_res_conv_9_ptr);
23829                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
23830                 FREE(untag_ptr(_res_conv_9));
23831                 _res_constr.data[j] = _res_conv_9_conv;
23832         }
23833         FREE(_res);
23834         CVec_BalanceZ_free(_res_constr);
23835 }
23836
23837 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
23838         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
23839         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
23840         return tag_ptr(ret_conv, true);
23841 }
23842 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(uint64_t arg) {
23843         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
23844         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
23845         return ret_conv;
23846 }
23847
23848 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(uint64_t orig) {
23849         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
23850         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
23851         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
23852         return tag_ptr(ret_conv, true);
23853 }
23854
23855 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(int8_tArray a, uint64_t b) {
23856         LDKThirtyTwoBytes a_ref;
23857         CHECK(a->arr_len == 32);
23858         memcpy(a_ref.data, a->elems, 32); FREE(a);
23859         LDKChannelMonitor b_conv;
23860         b_conv.inner = untag_ptr(b);
23861         b_conv.is_owned = ptr_is_owned(b);
23862         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23863         b_conv = ChannelMonitor_clone(&b_conv);
23864         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
23865         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
23866         return tag_ptr(ret_conv, true);
23867 }
23868
23869 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(uint64_t _res) {
23870         if (!ptr_is_owned(_res)) return;
23871         void* _res_ptr = untag_ptr(_res);
23872         CHECK_ACCESS(_res_ptr);
23873         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
23874         FREE(untag_ptr(_res));
23875         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
23876 }
23877
23878 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
23879         void* o_ptr = untag_ptr(o);
23880         CHECK_ACCESS(o_ptr);
23881         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
23882         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
23883         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
23884         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
23885         return tag_ptr(ret_conv, true);
23886 }
23887
23888 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(uint64_t e) {
23889         void* e_ptr = untag_ptr(e);
23890         CHECK_ACCESS(e_ptr);
23891         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23892         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23893         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
23894         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
23895         return tag_ptr(ret_conv, true);
23896 }
23897
23898 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
23899         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
23900         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
23901         return ret_conv;
23902 }
23903
23904 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
23905         if (!ptr_is_owned(_res)) return;
23906         void* _res_ptr = untag_ptr(_res);
23907         CHECK_ACCESS(_res_ptr);
23908         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
23909         FREE(untag_ptr(_res));
23910         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
23911 }
23912
23913 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
23914         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
23915         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
23916         return tag_ptr(ret_conv, true);
23917 }
23918 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
23919         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
23920         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
23921         return ret_conv;
23922 }
23923
23924 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
23925         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
23926         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
23927         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
23928         return tag_ptr(ret_conv, true);
23929 }
23930
23931 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
23932         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
23933         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
23934         return tag_ptr(ret_conv, true);
23935 }
23936 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
23937         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
23938         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
23939         return ret_conv;
23940 }
23941
23942 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
23943         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
23944         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
23945         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
23946         return tag_ptr(ret_conv, true);
23947 }
23948
23949 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
23950         LDKPublicKey a_ref;
23951         CHECK(a->arr_len == 33);
23952         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
23953         void* b_ptr = untag_ptr(b);
23954         CHECK_ACCESS(b_ptr);
23955         LDKType b_conv = *(LDKType*)(b_ptr);
23956         if (b_conv.free == LDKType_JCalls_free) {
23957                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23958                 LDKType_JCalls_cloned(&b_conv);
23959         }
23960         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
23961         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
23962         return tag_ptr(ret_conv, true);
23963 }
23964
23965 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
23966         if (!ptr_is_owned(_res)) return;
23967         void* _res_ptr = untag_ptr(_res);
23968         CHECK_ACCESS(_res_ptr);
23969         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
23970         FREE(untag_ptr(_res));
23971         C2Tuple_PublicKeyTypeZ_free(_res_conv);
23972 }
23973
23974 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
23975         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
23976         _res_constr.datalen = _res->arr_len;
23977         if (_res_constr.datalen > 0)
23978                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
23979         else
23980                 _res_constr.data = NULL;
23981         uint64_t* _res_vals = _res->elems;
23982         for (size_t z = 0; z < _res_constr.datalen; z++) {
23983                 uint64_t _res_conv_25 = _res_vals[z];
23984                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
23985                 CHECK_ACCESS(_res_conv_25_ptr);
23986                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
23987                 FREE(untag_ptr(_res_conv_25));
23988                 _res_constr.data[z] = _res_conv_25_conv;
23989         }
23990         FREE(_res);
23991         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
23992 }
23993
23994 static inline uint64_t C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR arg) {
23995         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
23996         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(arg);
23997         return tag_ptr(ret_conv, true);
23998 }
23999 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(uint64_t arg) {
24000         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(arg);
24001         int64_t ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(arg_conv);
24002         return ret_conv;
24003 }
24004
24005 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(uint64_t orig) {
24006         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(orig);
24007         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
24008         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig_conv);
24009         return tag_ptr(ret_conv, true);
24010 }
24011
24012 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_new"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_new(int8_tArray a, uint64_tArray b) {
24013         LDKPublicKey a_ref;
24014         CHECK(a->arr_len == 33);
24015         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
24016         LDKCVec_SocketAddressZ b_constr;
24017         b_constr.datalen = b->arr_len;
24018         if (b_constr.datalen > 0)
24019                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
24020         else
24021                 b_constr.data = NULL;
24022         uint64_t* b_vals = b->elems;
24023         for (size_t p = 0; p < b_constr.datalen; p++) {
24024                 uint64_t b_conv_15 = b_vals[p];
24025                 void* b_conv_15_ptr = untag_ptr(b_conv_15);
24026                 CHECK_ACCESS(b_conv_15_ptr);
24027                 LDKSocketAddress b_conv_15_conv = *(LDKSocketAddress*)(b_conv_15_ptr);
24028                 b_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(b_conv_15));
24029                 b_constr.data[p] = b_conv_15_conv;
24030         }
24031         FREE(b);
24032         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
24033         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a_ref, b_constr);
24034         return tag_ptr(ret_conv, true);
24035 }
24036
24037 void  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_free"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_free(uint64_t _res) {
24038         if (!ptr_is_owned(_res)) return;
24039         void* _res_ptr = untag_ptr(_res);
24040         CHECK_ACCESS(_res_ptr);
24041         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_ptr);
24042         FREE(untag_ptr(_res));
24043         C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res_conv);
24044 }
24045
24046 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(uint64_tArray _res) {
24047         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ _res_constr;
24048         _res_constr.datalen = _res->arr_len;
24049         if (_res_constr.datalen > 0)
24050                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
24051         else
24052                 _res_constr.data = NULL;
24053         uint64_t* _res_vals = _res->elems;
24054         for (size_t o = 0; o < _res_constr.datalen; o++) {
24055                 uint64_t _res_conv_40 = _res_vals[o];
24056                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
24057                 CHECK_ACCESS(_res_conv_40_ptr);
24058                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_conv_40_ptr);
24059                 FREE(untag_ptr(_res_conv_40));
24060                 _res_constr.data[o] = _res_conv_40_conv;
24061         }
24062         FREE(_res);
24063         CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res_constr);
24064 }
24065
24066 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_some"))) TS_COption_OnionMessageContentsZ_some(uint64_t o) {
24067         void* o_ptr = untag_ptr(o);
24068         CHECK_ACCESS(o_ptr);
24069         LDKOnionMessageContents o_conv = *(LDKOnionMessageContents*)(o_ptr);
24070         if (o_conv.free == LDKOnionMessageContents_JCalls_free) {
24071                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24072                 LDKOnionMessageContents_JCalls_cloned(&o_conv);
24073         }
24074         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
24075         *ret_copy = COption_OnionMessageContentsZ_some(o_conv);
24076         uint64_t ret_ref = tag_ptr(ret_copy, true);
24077         return ret_ref;
24078 }
24079
24080 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_none"))) TS_COption_OnionMessageContentsZ_none() {
24081         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
24082         *ret_copy = COption_OnionMessageContentsZ_none();
24083         uint64_t ret_ref = tag_ptr(ret_copy, true);
24084         return ret_ref;
24085 }
24086
24087 void  __attribute__((export_name("TS_COption_OnionMessageContentsZ_free"))) TS_COption_OnionMessageContentsZ_free(uint64_t _res) {
24088         if (!ptr_is_owned(_res)) return;
24089         void* _res_ptr = untag_ptr(_res);
24090         CHECK_ACCESS(_res_ptr);
24091         LDKCOption_OnionMessageContentsZ _res_conv = *(LDKCOption_OnionMessageContentsZ*)(_res_ptr);
24092         FREE(untag_ptr(_res));
24093         COption_OnionMessageContentsZ_free(_res_conv);
24094 }
24095
24096 static inline uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg) {
24097         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
24098         *ret_copy = COption_OnionMessageContentsZ_clone(arg);
24099         uint64_t ret_ref = tag_ptr(ret_copy, true);
24100         return ret_ref;
24101 }
24102 int64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_clone_ptr"))) TS_COption_OnionMessageContentsZ_clone_ptr(uint64_t arg) {
24103         LDKCOption_OnionMessageContentsZ* arg_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(arg);
24104         int64_t ret_conv = COption_OnionMessageContentsZ_clone_ptr(arg_conv);
24105         return ret_conv;
24106 }
24107
24108 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_clone"))) TS_COption_OnionMessageContentsZ_clone(uint64_t orig) {
24109         LDKCOption_OnionMessageContentsZ* orig_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(orig);
24110         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
24111         *ret_copy = COption_OnionMessageContentsZ_clone(orig_conv);
24112         uint64_t ret_ref = tag_ptr(ret_copy, true);
24113         return ret_ref;
24114 }
24115
24116 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
24117         void* o_ptr = untag_ptr(o);
24118         CHECK_ACCESS(o_ptr);
24119         LDKCOption_OnionMessageContentsZ o_conv = *(LDKCOption_OnionMessageContentsZ*)(o_ptr);
24120         o_conv = COption_OnionMessageContentsZ_clone((LDKCOption_OnionMessageContentsZ*)untag_ptr(o));
24121         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
24122         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o_conv);
24123         return tag_ptr(ret_conv, true);
24124 }
24125
24126 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
24127         void* e_ptr = untag_ptr(e);
24128         CHECK_ACCESS(e_ptr);
24129         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24130         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24131         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
24132         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e_conv);
24133         return tag_ptr(ret_conv, true);
24134 }
24135
24136 jboolean  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
24137         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
24138         jboolean ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
24139         return ret_conv;
24140 }
24141
24142 void  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
24143         if (!ptr_is_owned(_res)) return;
24144         void* _res_ptr = untag_ptr(_res);
24145         CHECK_ACCESS(_res_ptr);
24146         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(_res_ptr);
24147         FREE(untag_ptr(_res));
24148         CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res_conv);
24149 }
24150
24151 static inline uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
24152         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
24153         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(arg);
24154         return tag_ptr(ret_conv, true);
24155 }
24156 int64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
24157         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
24158         int64_t ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
24159         return ret_conv;
24160 }
24161
24162 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
24163         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
24164         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
24165         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig_conv);
24166         return tag_ptr(ret_conv, true);
24167 }
24168
24169 static inline uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg) {
24170         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
24171         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(arg);
24172         return tag_ptr(ret_conv, true);
24173 }
24174 int64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(uint64_t arg) {
24175         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(arg);
24176         int64_t ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(arg_conv);
24177         return ret_conv;
24178 }
24179
24180 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(uint64_t orig) {
24181         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(orig);
24182         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
24183         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig_conv);
24184         return tag_ptr(ret_conv, true);
24185 }
24186
24187 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(uint64_t a, uint64_t b, uint64_t c) {
24188         void* a_ptr = untag_ptr(a);
24189         CHECK_ACCESS(a_ptr);
24190         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
24191         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
24192                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24193                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
24194         }
24195         void* b_ptr = untag_ptr(b);
24196         CHECK_ACCESS(b_ptr);
24197         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
24198         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
24199         LDKBlindedPath c_conv;
24200         c_conv.inner = untag_ptr(c);
24201         c_conv.is_owned = ptr_is_owned(c);
24202         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
24203         c_conv = BlindedPath_clone(&c_conv);
24204         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
24205         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
24206         return tag_ptr(ret_conv, true);
24207 }
24208
24209 void  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(uint64_t _res) {
24210         if (!ptr_is_owned(_res)) return;
24211         void* _res_ptr = untag_ptr(_res);
24212         CHECK_ACCESS(_res_ptr);
24213         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_ptr);
24214         FREE(untag_ptr(_res));
24215         C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res_conv);
24216 }
24217
24218 void  __attribute__((export_name("TS_CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free"))) TS_CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(uint64_tArray _res) {
24219         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res_constr;
24220         _res_constr.datalen = _res->arr_len;
24221         if (_res_constr.datalen > 0)
24222                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
24223         else
24224                 _res_constr.data = NULL;
24225         uint64_t* _res_vals = _res->elems;
24226         for (size_t e = 0; e < _res_constr.datalen; e++) {
24227                 uint64_t _res_conv_56 = _res_vals[e];
24228                 void* _res_conv_56_ptr = untag_ptr(_res_conv_56);
24229                 CHECK_ACCESS(_res_conv_56_ptr);
24230                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_conv_56_ptr);
24231                 FREE(untag_ptr(_res_conv_56));
24232                 _res_constr.data[e] = _res_conv_56_conv;
24233         }
24234         FREE(_res);
24235         CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res_constr);
24236 }
24237
24238 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
24239         void* o_ptr = untag_ptr(o);
24240         CHECK_ACCESS(o_ptr);
24241         LDKType o_conv = *(LDKType*)(o_ptr);
24242         if (o_conv.free == LDKType_JCalls_free) {
24243                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24244                 LDKType_JCalls_cloned(&o_conv);
24245         }
24246         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
24247         *ret_copy = COption_TypeZ_some(o_conv);
24248         uint64_t ret_ref = tag_ptr(ret_copy, true);
24249         return ret_ref;
24250 }
24251
24252 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
24253         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
24254         *ret_copy = COption_TypeZ_none();
24255         uint64_t ret_ref = tag_ptr(ret_copy, true);
24256         return ret_ref;
24257 }
24258
24259 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
24260         if (!ptr_is_owned(_res)) return;
24261         void* _res_ptr = untag_ptr(_res);
24262         CHECK_ACCESS(_res_ptr);
24263         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
24264         FREE(untag_ptr(_res));
24265         COption_TypeZ_free(_res_conv);
24266 }
24267
24268 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
24269         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
24270         *ret_copy = COption_TypeZ_clone(arg);
24271         uint64_t ret_ref = tag_ptr(ret_copy, true);
24272         return ret_ref;
24273 }
24274 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
24275         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
24276         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
24277         return ret_conv;
24278 }
24279
24280 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
24281         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
24282         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
24283         *ret_copy = COption_TypeZ_clone(orig_conv);
24284         uint64_t ret_ref = tag_ptr(ret_copy, true);
24285         return ret_ref;
24286 }
24287
24288 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
24289         void* o_ptr = untag_ptr(o);
24290         CHECK_ACCESS(o_ptr);
24291         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
24292         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
24293         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
24294         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
24295         return tag_ptr(ret_conv, true);
24296 }
24297
24298 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
24299         void* e_ptr = untag_ptr(e);
24300         CHECK_ACCESS(e_ptr);
24301         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24302         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24303         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
24304         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
24305         return tag_ptr(ret_conv, true);
24306 }
24307
24308 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
24309         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
24310         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
24311         return ret_conv;
24312 }
24313
24314 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
24315         if (!ptr_is_owned(_res)) return;
24316         void* _res_ptr = untag_ptr(_res);
24317         CHECK_ACCESS(_res_ptr);
24318         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
24319         FREE(untag_ptr(_res));
24320         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
24321 }
24322
24323 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
24324         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
24325         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
24326         return tag_ptr(ret_conv, true);
24327 }
24328 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
24329         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
24330         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
24331         return ret_conv;
24332 }
24333
24334 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
24335         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
24336         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
24337         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
24338         return tag_ptr(ret_conv, true);
24339 }
24340
24341 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_some"))) TS_COption_SocketAddressZ_some(uint64_t o) {
24342         void* o_ptr = untag_ptr(o);
24343         CHECK_ACCESS(o_ptr);
24344         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
24345         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
24346         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
24347         *ret_copy = COption_SocketAddressZ_some(o_conv);
24348         uint64_t ret_ref = tag_ptr(ret_copy, true);
24349         return ret_ref;
24350 }
24351
24352 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_none"))) TS_COption_SocketAddressZ_none() {
24353         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
24354         *ret_copy = COption_SocketAddressZ_none();
24355         uint64_t ret_ref = tag_ptr(ret_copy, true);
24356         return ret_ref;
24357 }
24358
24359 void  __attribute__((export_name("TS_COption_SocketAddressZ_free"))) TS_COption_SocketAddressZ_free(uint64_t _res) {
24360         if (!ptr_is_owned(_res)) return;
24361         void* _res_ptr = untag_ptr(_res);
24362         CHECK_ACCESS(_res_ptr);
24363         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
24364         FREE(untag_ptr(_res));
24365         COption_SocketAddressZ_free(_res_conv);
24366 }
24367
24368 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
24369         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
24370         *ret_copy = COption_SocketAddressZ_clone(arg);
24371         uint64_t ret_ref = tag_ptr(ret_copy, true);
24372         return ret_ref;
24373 }
24374 int64_t  __attribute__((export_name("TS_COption_SocketAddressZ_clone_ptr"))) TS_COption_SocketAddressZ_clone_ptr(uint64_t arg) {
24375         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
24376         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
24377         return ret_conv;
24378 }
24379
24380 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_clone"))) TS_COption_SocketAddressZ_clone(uint64_t orig) {
24381         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
24382         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
24383         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
24384         uint64_t ret_ref = tag_ptr(ret_copy, true);
24385         return ret_ref;
24386 }
24387
24388 static inline uint64_t C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR arg) {
24389         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
24390         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(arg);
24391         return tag_ptr(ret_conv, true);
24392 }
24393 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(uint64_t arg) {
24394         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(arg);
24395         int64_t ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(arg_conv);
24396         return ret_conv;
24397 }
24398
24399 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(uint64_t orig) {
24400         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(orig);
24401         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
24402         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig_conv);
24403         return tag_ptr(ret_conv, true);
24404 }
24405
24406 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_new"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_new(int8_tArray a, uint64_t b) {
24407         LDKPublicKey a_ref;
24408         CHECK(a->arr_len == 33);
24409         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
24410         void* b_ptr = untag_ptr(b);
24411         CHECK_ACCESS(b_ptr);
24412         LDKCOption_SocketAddressZ b_conv = *(LDKCOption_SocketAddressZ*)(b_ptr);
24413         b_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(b));
24414         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
24415         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a_ref, b_conv);
24416         return tag_ptr(ret_conv, true);
24417 }
24418
24419 void  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_free"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_free(uint64_t _res) {
24420         if (!ptr_is_owned(_res)) return;
24421         void* _res_ptr = untag_ptr(_res);
24422         CHECK_ACCESS(_res_ptr);
24423         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_ptr);
24424         FREE(untag_ptr(_res));
24425         C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res_conv);
24426 }
24427
24428 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(uint64_tArray _res) {
24429         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ _res_constr;
24430         _res_constr.datalen = _res->arr_len;
24431         if (_res_constr.datalen > 0)
24432                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ Elements");
24433         else
24434                 _res_constr.data = NULL;
24435         uint64_t* _res_vals = _res->elems;
24436         for (size_t r = 0; r < _res_constr.datalen; r++) {
24437                 uint64_t _res_conv_43 = _res_vals[r];
24438                 void* _res_conv_43_ptr = untag_ptr(_res_conv_43);
24439                 CHECK_ACCESS(_res_conv_43_ptr);
24440                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv_43_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_conv_43_ptr);
24441                 FREE(untag_ptr(_res_conv_43));
24442                 _res_constr.data[r] = _res_conv_43_conv;
24443         }
24444         FREE(_res);
24445         CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res_constr);
24446 }
24447
24448 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
24449         LDKCVec_u8Z o_ref;
24450         o_ref.datalen = o->arr_len;
24451         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
24452         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
24453         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24454         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
24455         return tag_ptr(ret_conv, true);
24456 }
24457
24458 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
24459         LDKPeerHandleError e_conv;
24460         e_conv.inner = untag_ptr(e);
24461         e_conv.is_owned = ptr_is_owned(e);
24462         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24463         e_conv = PeerHandleError_clone(&e_conv);
24464         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24465         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
24466         return tag_ptr(ret_conv, true);
24467 }
24468
24469 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
24470         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
24471         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
24472         return ret_conv;
24473 }
24474
24475 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
24476         if (!ptr_is_owned(_res)) return;
24477         void* _res_ptr = untag_ptr(_res);
24478         CHECK_ACCESS(_res_ptr);
24479         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
24480         FREE(untag_ptr(_res));
24481         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
24482 }
24483
24484 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
24485         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24486         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
24487         return tag_ptr(ret_conv, true);
24488 }
24489 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
24490         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
24491         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
24492         return ret_conv;
24493 }
24494
24495 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
24496         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
24497         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24498         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
24499         return tag_ptr(ret_conv, true);
24500 }
24501
24502 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
24503         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24504         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
24505         return tag_ptr(ret_conv, true);
24506 }
24507
24508 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
24509         LDKPeerHandleError e_conv;
24510         e_conv.inner = untag_ptr(e);
24511         e_conv.is_owned = ptr_is_owned(e);
24512         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24513         e_conv = PeerHandleError_clone(&e_conv);
24514         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24515         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
24516         return tag_ptr(ret_conv, true);
24517 }
24518
24519 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
24520         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
24521         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
24522         return ret_conv;
24523 }
24524
24525 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
24526         if (!ptr_is_owned(_res)) return;
24527         void* _res_ptr = untag_ptr(_res);
24528         CHECK_ACCESS(_res_ptr);
24529         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
24530         FREE(untag_ptr(_res));
24531         CResult_NonePeerHandleErrorZ_free(_res_conv);
24532 }
24533
24534 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
24535         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24536         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
24537         return tag_ptr(ret_conv, true);
24538 }
24539 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
24540         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
24541         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
24542         return ret_conv;
24543 }
24544
24545 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
24546         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
24547         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24548         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
24549         return tag_ptr(ret_conv, true);
24550 }
24551
24552 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
24553         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
24554         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
24555         return tag_ptr(ret_conv, true);
24556 }
24557
24558 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
24559         LDKPeerHandleError e_conv;
24560         e_conv.inner = untag_ptr(e);
24561         e_conv.is_owned = ptr_is_owned(e);
24562         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24563         e_conv = PeerHandleError_clone(&e_conv);
24564         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
24565         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
24566         return tag_ptr(ret_conv, true);
24567 }
24568
24569 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
24570         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
24571         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
24572         return ret_conv;
24573 }
24574
24575 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
24576         if (!ptr_is_owned(_res)) return;
24577         void* _res_ptr = untag_ptr(_res);
24578         CHECK_ACCESS(_res_ptr);
24579         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
24580         FREE(untag_ptr(_res));
24581         CResult_boolPeerHandleErrorZ_free(_res_conv);
24582 }
24583
24584 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
24585         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
24586         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
24587         return tag_ptr(ret_conv, true);
24588 }
24589 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
24590         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
24591         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
24592         return ret_conv;
24593 }
24594
24595 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
24596         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
24597         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
24598         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
24599         return tag_ptr(ret_conv, true);
24600 }
24601
24602 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
24603         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
24604         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
24605         return tag_ptr(ret_conv, true);
24606 }
24607
24608 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
24609         void* e_ptr = untag_ptr(e);
24610         CHECK_ACCESS(e_ptr);
24611         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
24612         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
24613         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
24614         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
24615         return tag_ptr(ret_conv, true);
24616 }
24617
24618 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
24619         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
24620         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
24621         return ret_conv;
24622 }
24623
24624 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
24625         if (!ptr_is_owned(_res)) return;
24626         void* _res_ptr = untag_ptr(_res);
24627         CHECK_ACCESS(_res_ptr);
24628         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
24629         FREE(untag_ptr(_res));
24630         CResult_u32GraphSyncErrorZ_free(_res_conv);
24631 }
24632
24633 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_ok"))) TS_CResult_CVec_u8ZIOErrorZ_ok(int8_tArray o) {
24634         LDKCVec_u8Z o_ref;
24635         o_ref.datalen = o->arr_len;
24636         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
24637         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
24638         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
24639         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
24640         return tag_ptr(ret_conv, true);
24641 }
24642
24643 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_err"))) TS_CResult_CVec_u8ZIOErrorZ_err(uint32_t e) {
24644         LDKIOError e_conv = LDKIOError_from_js(e);
24645         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
24646         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
24647         return tag_ptr(ret_conv, true);
24648 }
24649
24650 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_is_ok"))) TS_CResult_CVec_u8ZIOErrorZ_is_ok(uint64_t o) {
24651         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
24652         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
24653         return ret_conv;
24654 }
24655
24656 void  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_free"))) TS_CResult_CVec_u8ZIOErrorZ_free(uint64_t _res) {
24657         if (!ptr_is_owned(_res)) return;
24658         void* _res_ptr = untag_ptr(_res);
24659         CHECK_ACCESS(_res_ptr);
24660         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
24661         FREE(untag_ptr(_res));
24662         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
24663 }
24664
24665 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
24666         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
24667         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
24668         return tag_ptr(ret_conv, true);
24669 }
24670 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZIOErrorZ_clone_ptr(uint64_t arg) {
24671         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
24672         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
24673         return ret_conv;
24674 }
24675
24676 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_clone"))) TS_CResult_CVec_u8ZIOErrorZ_clone(uint64_t orig) {
24677         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
24678         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
24679         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
24680         return tag_ptr(ret_conv, true);
24681 }
24682
24683 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_ok"))) TS_CResult_NoneIOErrorZ_ok() {
24684         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
24685         *ret_conv = CResult_NoneIOErrorZ_ok();
24686         return tag_ptr(ret_conv, true);
24687 }
24688
24689 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_err"))) TS_CResult_NoneIOErrorZ_err(uint32_t e) {
24690         LDKIOError e_conv = LDKIOError_from_js(e);
24691         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
24692         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
24693         return tag_ptr(ret_conv, true);
24694 }
24695
24696 jboolean  __attribute__((export_name("TS_CResult_NoneIOErrorZ_is_ok"))) TS_CResult_NoneIOErrorZ_is_ok(uint64_t o) {
24697         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
24698         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
24699         return ret_conv;
24700 }
24701
24702 void  __attribute__((export_name("TS_CResult_NoneIOErrorZ_free"))) TS_CResult_NoneIOErrorZ_free(uint64_t _res) {
24703         if (!ptr_is_owned(_res)) return;
24704         void* _res_ptr = untag_ptr(_res);
24705         CHECK_ACCESS(_res_ptr);
24706         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
24707         FREE(untag_ptr(_res));
24708         CResult_NoneIOErrorZ_free(_res_conv);
24709 }
24710
24711 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
24712         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
24713         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
24714         return tag_ptr(ret_conv, true);
24715 }
24716 int64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_clone_ptr"))) TS_CResult_NoneIOErrorZ_clone_ptr(uint64_t arg) {
24717         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
24718         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
24719         return ret_conv;
24720 }
24721
24722 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_clone"))) TS_CResult_NoneIOErrorZ_clone(uint64_t orig) {
24723         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
24724         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
24725         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
24726         return tag_ptr(ret_conv, true);
24727 }
24728
24729 void  __attribute__((export_name("TS_CVec_StrZ_free"))) TS_CVec_StrZ_free(ptrArray _res) {
24730         LDKCVec_StrZ _res_constr;
24731         _res_constr.datalen = _res->arr_len;
24732         if (_res_constr.datalen > 0)
24733                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
24734         else
24735                 _res_constr.data = NULL;
24736         jstring* _res_vals = (void*) _res->elems;
24737         for (size_t i = 0; i < _res_constr.datalen; i++) {
24738                 jstring _res_conv_8 = _res_vals[i];
24739                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
24740                 _res_constr.data[i] = dummy;
24741         }
24742         FREE(_res);
24743         CVec_StrZ_free(_res_constr);
24744 }
24745
24746 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_ok"))) TS_CResult_CVec_StrZIOErrorZ_ok(ptrArray o) {
24747         LDKCVec_StrZ o_constr;
24748         o_constr.datalen = o->arr_len;
24749         if (o_constr.datalen > 0)
24750                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
24751         else
24752                 o_constr.data = NULL;
24753         jstring* o_vals = (void*) o->elems;
24754         for (size_t i = 0; i < o_constr.datalen; i++) {
24755                 jstring o_conv_8 = o_vals[i];
24756                 LDKStr o_conv_8_conv = str_ref_to_owned_c(o_conv_8);
24757                 o_constr.data[i] = o_conv_8_conv;
24758         }
24759         FREE(o);
24760         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
24761         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
24762         return tag_ptr(ret_conv, true);
24763 }
24764
24765 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_err"))) TS_CResult_CVec_StrZIOErrorZ_err(uint32_t e) {
24766         LDKIOError e_conv = LDKIOError_from_js(e);
24767         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
24768         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
24769         return tag_ptr(ret_conv, true);
24770 }
24771
24772 jboolean  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_is_ok"))) TS_CResult_CVec_StrZIOErrorZ_is_ok(uint64_t o) {
24773         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
24774         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
24775         return ret_conv;
24776 }
24777
24778 void  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_free"))) TS_CResult_CVec_StrZIOErrorZ_free(uint64_t _res) {
24779         if (!ptr_is_owned(_res)) return;
24780         void* _res_ptr = untag_ptr(_res);
24781         CHECK_ACCESS(_res_ptr);
24782         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
24783         FREE(untag_ptr(_res));
24784         CResult_CVec_StrZIOErrorZ_free(_res_conv);
24785 }
24786
24787 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
24788         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
24789         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
24790         return tag_ptr(ret_conv, true);
24791 }
24792 int64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_clone_ptr"))) TS_CResult_CVec_StrZIOErrorZ_clone_ptr(uint64_t arg) {
24793         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
24794         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
24795         return ret_conv;
24796 }
24797
24798 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_clone"))) TS_CResult_CVec_StrZIOErrorZ_clone(uint64_t orig) {
24799         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
24800         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
24801         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
24802         return tag_ptr(ret_conv, true);
24803 }
24804
24805 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(uint64_tArray _res) {
24806         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
24807         _res_constr.datalen = _res->arr_len;
24808         if (_res_constr.datalen > 0)
24809                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
24810         else
24811                 _res_constr.data = NULL;
24812         uint64_t* _res_vals = _res->elems;
24813         for (size_t o = 0; o < _res_constr.datalen; o++) {
24814                 uint64_t _res_conv_40 = _res_vals[o];
24815                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
24816                 CHECK_ACCESS(_res_conv_40_ptr);
24817                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
24818                 FREE(untag_ptr(_res_conv_40));
24819                 _res_constr.data[o] = _res_conv_40_conv;
24820         }
24821         FREE(_res);
24822         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
24823 }
24824
24825 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(uint64_tArray o) {
24826         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
24827         o_constr.datalen = o->arr_len;
24828         if (o_constr.datalen > 0)
24829                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
24830         else
24831                 o_constr.data = NULL;
24832         uint64_t* o_vals = o->elems;
24833         for (size_t o = 0; o < o_constr.datalen; o++) {
24834                 uint64_t o_conv_40 = o_vals[o];
24835                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
24836                 CHECK_ACCESS(o_conv_40_ptr);
24837                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
24838                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
24839                 o_constr.data[o] = o_conv_40_conv;
24840         }
24841         FREE(o);
24842         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
24843         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
24844         return tag_ptr(ret_conv, true);
24845 }
24846
24847 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(uint32_t e) {
24848         LDKIOError e_conv = LDKIOError_from_js(e);
24849         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
24850         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
24851         return tag_ptr(ret_conv, true);
24852 }
24853
24854 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(uint64_t o) {
24855         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
24856         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
24857         return ret_conv;
24858 }
24859
24860 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(uint64_t _res) {
24861         if (!ptr_is_owned(_res)) return;
24862         void* _res_ptr = untag_ptr(_res);
24863         CHECK_ACCESS(_res_ptr);
24864         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
24865         FREE(untag_ptr(_res));
24866         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
24867 }
24868
24869 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
24870         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
24871         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
24872         return tag_ptr(ret_conv, true);
24873 }
24874 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(uint64_t arg) {
24875         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
24876         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
24877         return ret_conv;
24878 }
24879
24880 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(uint64_t orig) {
24881         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
24882         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
24883         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
24884         return tag_ptr(ret_conv, true);
24885 }
24886
24887 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(uint64_t o) {
24888         void* o_ptr = untag_ptr(o);
24889         CHECK_ACCESS(o_ptr);
24890         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
24891         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
24892         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
24893         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
24894         return tag_ptr(ret_conv, true);
24895 }
24896
24897 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(uint32_t e) {
24898         LDKIOError e_conv = LDKIOError_from_js(e);
24899         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
24900         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
24901         return tag_ptr(ret_conv, true);
24902 }
24903
24904 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(uint64_t o) {
24905         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
24906         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
24907         return ret_conv;
24908 }
24909
24910 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(uint64_t _res) {
24911         if (!ptr_is_owned(_res)) return;
24912         void* _res_ptr = untag_ptr(_res);
24913         CHECK_ACCESS(_res_ptr);
24914         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
24915         FREE(untag_ptr(_res));
24916         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
24917 }
24918
24919 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
24920         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
24921         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
24922         return tag_ptr(ret_conv, true);
24923 }
24924 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(uint64_t arg) {
24925         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
24926         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
24927         return ret_conv;
24928 }
24929
24930 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(uint64_t orig) {
24931         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
24932         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
24933         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
24934         return tag_ptr(ret_conv, true);
24935 }
24936
24937 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_some"))) TS_COption_SecretKeyZ_some(int8_tArray o) {
24938         LDKSecretKey o_ref;
24939         CHECK(o->arr_len == 32);
24940         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
24941         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
24942         *ret_copy = COption_SecretKeyZ_some(o_ref);
24943         uint64_t ret_ref = tag_ptr(ret_copy, true);
24944         return ret_ref;
24945 }
24946
24947 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_none"))) TS_COption_SecretKeyZ_none() {
24948         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
24949         *ret_copy = COption_SecretKeyZ_none();
24950         uint64_t ret_ref = tag_ptr(ret_copy, true);
24951         return ret_ref;
24952 }
24953
24954 void  __attribute__((export_name("TS_COption_SecretKeyZ_free"))) TS_COption_SecretKeyZ_free(uint64_t _res) {
24955         if (!ptr_is_owned(_res)) return;
24956         void* _res_ptr = untag_ptr(_res);
24957         CHECK_ACCESS(_res_ptr);
24958         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
24959         FREE(untag_ptr(_res));
24960         COption_SecretKeyZ_free(_res_conv);
24961 }
24962
24963 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
24964         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
24965         *ret_copy = COption_SecretKeyZ_clone(arg);
24966         uint64_t ret_ref = tag_ptr(ret_copy, true);
24967         return ret_ref;
24968 }
24969 int64_t  __attribute__((export_name("TS_COption_SecretKeyZ_clone_ptr"))) TS_COption_SecretKeyZ_clone_ptr(uint64_t arg) {
24970         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
24971         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
24972         return ret_conv;
24973 }
24974
24975 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_clone"))) TS_COption_SecretKeyZ_clone(uint64_t orig) {
24976         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
24977         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
24978         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
24979         uint64_t ret_ref = tag_ptr(ret_copy, true);
24980         return ret_ref;
24981 }
24982
24983 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_ok(uint64_t o) {
24984         LDKVerifiedInvoiceRequest o_conv;
24985         o_conv.inner = untag_ptr(o);
24986         o_conv.is_owned = ptr_is_owned(o);
24987         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24988         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
24989         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
24990         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
24991         return tag_ptr(ret_conv, true);
24992 }
24993
24994 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_err"))) TS_CResult_VerifiedInvoiceRequestNoneZ_err() {
24995         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
24996         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
24997         return tag_ptr(ret_conv, true);
24998 }
24999
25000 jboolean  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_is_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_is_ok(uint64_t o) {
25001         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
25002         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
25003         return ret_conv;
25004 }
25005
25006 void  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_free"))) TS_CResult_VerifiedInvoiceRequestNoneZ_free(uint64_t _res) {
25007         if (!ptr_is_owned(_res)) return;
25008         void* _res_ptr = untag_ptr(_res);
25009         CHECK_ACCESS(_res_ptr);
25010         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
25011         FREE(untag_ptr(_res));
25012         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
25013 }
25014
25015 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
25016         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
25017         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
25018         return tag_ptr(ret_conv, true);
25019 }
25020 int64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr"))) TS_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(uint64_t arg) {
25021         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
25022         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
25023         return ret_conv;
25024 }
25025
25026 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_clone"))) TS_CResult_VerifiedInvoiceRequestNoneZ_clone(uint64_t orig) {
25027         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
25028         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
25029         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
25030         return tag_ptr(ret_conv, true);
25031 }
25032
25033 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
25034         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
25035         return ret_conv;
25036 }
25037
25038 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
25039         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
25040         return ret_conv;
25041 }
25042
25043 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
25044         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
25045         COption_NoneZ_free(_res_conv);
25046 }
25047
25048 void  __attribute__((export_name("TS_CVec_WitnessZ_free"))) TS_CVec_WitnessZ_free(ptrArray _res) {
25049         LDKCVec_WitnessZ _res_constr;
25050         _res_constr.datalen = _res->arr_len;
25051         if (_res_constr.datalen > 0)
25052                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
25053         else
25054                 _res_constr.data = NULL;
25055         int8_tArray* _res_vals = (void*) _res->elems;
25056         for (size_t m = 0; m < _res_constr.datalen; m++) {
25057                 int8_tArray _res_conv_12 = _res_vals[m];
25058                 LDKWitness _res_conv_12_ref;
25059                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
25060                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKWitness Bytes");
25061                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
25062                 _res_conv_12_ref.data_is_owned = true;
25063                 _res_constr.data[m] = _res_conv_12_ref;
25064         }
25065         FREE(_res);
25066         CVec_WitnessZ_free(_res_constr);
25067 }
25068
25069 uint64_t  __attribute__((export_name("TS_COption_i64Z_some"))) TS_COption_i64Z_some(int64_t o) {
25070         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
25071         *ret_copy = COption_i64Z_some(o);
25072         uint64_t ret_ref = tag_ptr(ret_copy, true);
25073         return ret_ref;
25074 }
25075
25076 uint64_t  __attribute__((export_name("TS_COption_i64Z_none"))) TS_COption_i64Z_none() {
25077         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
25078         *ret_copy = COption_i64Z_none();
25079         uint64_t ret_ref = tag_ptr(ret_copy, true);
25080         return ret_ref;
25081 }
25082
25083 void  __attribute__((export_name("TS_COption_i64Z_free"))) TS_COption_i64Z_free(uint64_t _res) {
25084         if (!ptr_is_owned(_res)) return;
25085         void* _res_ptr = untag_ptr(_res);
25086         CHECK_ACCESS(_res_ptr);
25087         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
25088         FREE(untag_ptr(_res));
25089         COption_i64Z_free(_res_conv);
25090 }
25091
25092 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
25093         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
25094         *ret_copy = COption_i64Z_clone(arg);
25095         uint64_t ret_ref = tag_ptr(ret_copy, true);
25096         return ret_ref;
25097 }
25098 int64_t  __attribute__((export_name("TS_COption_i64Z_clone_ptr"))) TS_COption_i64Z_clone_ptr(uint64_t arg) {
25099         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
25100         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
25101         return ret_conv;
25102 }
25103
25104 uint64_t  __attribute__((export_name("TS_COption_i64Z_clone"))) TS_COption_i64Z_clone(uint64_t orig) {
25105         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
25106         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
25107         *ret_copy = COption_i64Z_clone(orig_conv);
25108         uint64_t ret_ref = tag_ptr(ret_copy, true);
25109         return ret_ref;
25110 }
25111
25112 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_ok"))) TS_CResult_SocketAddressDecodeErrorZ_ok(uint64_t o) {
25113         void* o_ptr = untag_ptr(o);
25114         CHECK_ACCESS(o_ptr);
25115         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
25116         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
25117         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
25118         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
25119         return tag_ptr(ret_conv, true);
25120 }
25121
25122 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_err"))) TS_CResult_SocketAddressDecodeErrorZ_err(uint64_t e) {
25123         void* e_ptr = untag_ptr(e);
25124         CHECK_ACCESS(e_ptr);
25125         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25126         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25127         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
25128         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
25129         return tag_ptr(ret_conv, true);
25130 }
25131
25132 jboolean  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_is_ok"))) TS_CResult_SocketAddressDecodeErrorZ_is_ok(uint64_t o) {
25133         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
25134         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
25135         return ret_conv;
25136 }
25137
25138 void  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_free"))) TS_CResult_SocketAddressDecodeErrorZ_free(uint64_t _res) {
25139         if (!ptr_is_owned(_res)) return;
25140         void* _res_ptr = untag_ptr(_res);
25141         CHECK_ACCESS(_res_ptr);
25142         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
25143         FREE(untag_ptr(_res));
25144         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
25145 }
25146
25147 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
25148         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
25149         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
25150         return tag_ptr(ret_conv, true);
25151 }
25152 int64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_clone_ptr"))) TS_CResult_SocketAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
25153         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
25154         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
25155         return ret_conv;
25156 }
25157
25158 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_clone"))) TS_CResult_SocketAddressDecodeErrorZ_clone(uint64_t orig) {
25159         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
25160         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
25161         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
25162         return tag_ptr(ret_conv, true);
25163 }
25164
25165 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_ok(uint64_t o) {
25166         void* o_ptr = untag_ptr(o);
25167         CHECK_ACCESS(o_ptr);
25168         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
25169         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
25170         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
25171         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
25172         return tag_ptr(ret_conv, true);
25173 }
25174
25175 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_err"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_err(uint32_t e) {
25176         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_js(e);
25177         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
25178         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
25179         return tag_ptr(ret_conv, true);
25180 }
25181
25182 jboolean  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_is_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_is_ok(uint64_t o) {
25183         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
25184         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
25185         return ret_conv;
25186 }
25187
25188 void  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_free"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_free(uint64_t _res) {
25189         if (!ptr_is_owned(_res)) return;
25190         void* _res_ptr = untag_ptr(_res);
25191         CHECK_ACCESS(_res_ptr);
25192         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
25193         FREE(untag_ptr(_res));
25194         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
25195 }
25196
25197 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
25198         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
25199         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
25200         return tag_ptr(ret_conv, true);
25201 }
25202 int64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(uint64_t arg) {
25203         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
25204         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
25205         return ret_conv;
25206 }
25207
25208 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_clone"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_clone(uint64_t orig) {
25209         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
25210         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
25211         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
25212         return tag_ptr(ret_conv, true);
25213 }
25214
25215 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
25216         LDKCVec_UpdateAddHTLCZ _res_constr;
25217         _res_constr.datalen = _res->arr_len;
25218         if (_res_constr.datalen > 0)
25219                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
25220         else
25221                 _res_constr.data = NULL;
25222         uint64_t* _res_vals = _res->elems;
25223         for (size_t p = 0; p < _res_constr.datalen; p++) {
25224                 uint64_t _res_conv_15 = _res_vals[p];
25225                 LDKUpdateAddHTLC _res_conv_15_conv;
25226                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
25227                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
25228                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
25229                 _res_constr.data[p] = _res_conv_15_conv;
25230         }
25231         FREE(_res);
25232         CVec_UpdateAddHTLCZ_free(_res_constr);
25233 }
25234
25235 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
25236         LDKCVec_UpdateFulfillHTLCZ _res_constr;
25237         _res_constr.datalen = _res->arr_len;
25238         if (_res_constr.datalen > 0)
25239                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
25240         else
25241                 _res_constr.data = NULL;
25242         uint64_t* _res_vals = _res->elems;
25243         for (size_t t = 0; t < _res_constr.datalen; t++) {
25244                 uint64_t _res_conv_19 = _res_vals[t];
25245                 LDKUpdateFulfillHTLC _res_conv_19_conv;
25246                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
25247                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
25248                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
25249                 _res_constr.data[t] = _res_conv_19_conv;
25250         }
25251         FREE(_res);
25252         CVec_UpdateFulfillHTLCZ_free(_res_constr);
25253 }
25254
25255 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
25256         LDKCVec_UpdateFailHTLCZ _res_constr;
25257         _res_constr.datalen = _res->arr_len;
25258         if (_res_constr.datalen > 0)
25259                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
25260         else
25261                 _res_constr.data = NULL;
25262         uint64_t* _res_vals = _res->elems;
25263         for (size_t q = 0; q < _res_constr.datalen; q++) {
25264                 uint64_t _res_conv_16 = _res_vals[q];
25265                 LDKUpdateFailHTLC _res_conv_16_conv;
25266                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
25267                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
25268                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
25269                 _res_constr.data[q] = _res_conv_16_conv;
25270         }
25271         FREE(_res);
25272         CVec_UpdateFailHTLCZ_free(_res_constr);
25273 }
25274
25275 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
25276         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
25277         _res_constr.datalen = _res->arr_len;
25278         if (_res_constr.datalen > 0)
25279                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
25280         else
25281                 _res_constr.data = NULL;
25282         uint64_t* _res_vals = _res->elems;
25283         for (size_t z = 0; z < _res_constr.datalen; z++) {
25284                 uint64_t _res_conv_25 = _res_vals[z];
25285                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
25286                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
25287                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
25288                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
25289                 _res_constr.data[z] = _res_conv_25_conv;
25290         }
25291         FREE(_res);
25292         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
25293 }
25294
25295 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
25296         LDKAcceptChannel o_conv;
25297         o_conv.inner = untag_ptr(o);
25298         o_conv.is_owned = ptr_is_owned(o);
25299         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25300         o_conv = AcceptChannel_clone(&o_conv);
25301         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
25302         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
25303         return tag_ptr(ret_conv, true);
25304 }
25305
25306 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
25307         void* e_ptr = untag_ptr(e);
25308         CHECK_ACCESS(e_ptr);
25309         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25310         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25311         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
25312         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
25313         return tag_ptr(ret_conv, true);
25314 }
25315
25316 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
25317         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
25318         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
25319         return ret_conv;
25320 }
25321
25322 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
25323         if (!ptr_is_owned(_res)) return;
25324         void* _res_ptr = untag_ptr(_res);
25325         CHECK_ACCESS(_res_ptr);
25326         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
25327         FREE(untag_ptr(_res));
25328         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
25329 }
25330
25331 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
25332         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
25333         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
25334         return tag_ptr(ret_conv, true);
25335 }
25336 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
25337         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
25338         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
25339         return ret_conv;
25340 }
25341
25342 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
25343         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
25344         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
25345         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
25346         return tag_ptr(ret_conv, true);
25347 }
25348
25349 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_ok(uint64_t o) {
25350         LDKAcceptChannelV2 o_conv;
25351         o_conv.inner = untag_ptr(o);
25352         o_conv.is_owned = ptr_is_owned(o);
25353         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25354         o_conv = AcceptChannelV2_clone(&o_conv);
25355         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
25356         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
25357         return tag_ptr(ret_conv, true);
25358 }
25359
25360 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_err(uint64_t e) {
25361         void* e_ptr = untag_ptr(e);
25362         CHECK_ACCESS(e_ptr);
25363         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25364         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25365         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
25366         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
25367         return tag_ptr(ret_conv, true);
25368 }
25369
25370 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok(uint64_t o) {
25371         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
25372         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
25373         return ret_conv;
25374 }
25375
25376 void  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_free"))) TS_CResult_AcceptChannelV2DecodeErrorZ_free(uint64_t _res) {
25377         if (!ptr_is_owned(_res)) return;
25378         void* _res_ptr = untag_ptr(_res);
25379         CHECK_ACCESS(_res_ptr);
25380         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
25381         FREE(untag_ptr(_res));
25382         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
25383 }
25384
25385 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
25386         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
25387         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
25388         return tag_ptr(ret_conv, true);
25389 }
25390 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
25391         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
25392         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
25393         return ret_conv;
25394 }
25395
25396 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone(uint64_t orig) {
25397         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
25398         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
25399         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
25400         return tag_ptr(ret_conv, true);
25401 }
25402
25403 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_ok"))) TS_CResult_StfuDecodeErrorZ_ok(uint64_t o) {
25404         LDKStfu o_conv;
25405         o_conv.inner = untag_ptr(o);
25406         o_conv.is_owned = ptr_is_owned(o);
25407         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25408         o_conv = Stfu_clone(&o_conv);
25409         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
25410         *ret_conv = CResult_StfuDecodeErrorZ_ok(o_conv);
25411         return tag_ptr(ret_conv, true);
25412 }
25413
25414 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_err"))) TS_CResult_StfuDecodeErrorZ_err(uint64_t e) {
25415         void* e_ptr = untag_ptr(e);
25416         CHECK_ACCESS(e_ptr);
25417         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25418         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25419         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
25420         *ret_conv = CResult_StfuDecodeErrorZ_err(e_conv);
25421         return tag_ptr(ret_conv, true);
25422 }
25423
25424 jboolean  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_is_ok"))) TS_CResult_StfuDecodeErrorZ_is_ok(uint64_t o) {
25425         LDKCResult_StfuDecodeErrorZ* o_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(o);
25426         jboolean ret_conv = CResult_StfuDecodeErrorZ_is_ok(o_conv);
25427         return ret_conv;
25428 }
25429
25430 void  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_free"))) TS_CResult_StfuDecodeErrorZ_free(uint64_t _res) {
25431         if (!ptr_is_owned(_res)) return;
25432         void* _res_ptr = untag_ptr(_res);
25433         CHECK_ACCESS(_res_ptr);
25434         LDKCResult_StfuDecodeErrorZ _res_conv = *(LDKCResult_StfuDecodeErrorZ*)(_res_ptr);
25435         FREE(untag_ptr(_res));
25436         CResult_StfuDecodeErrorZ_free(_res_conv);
25437 }
25438
25439 static inline uint64_t CResult_StfuDecodeErrorZ_clone_ptr(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR arg) {
25440         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
25441         *ret_conv = CResult_StfuDecodeErrorZ_clone(arg);
25442         return tag_ptr(ret_conv, true);
25443 }
25444 int64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_clone_ptr"))) TS_CResult_StfuDecodeErrorZ_clone_ptr(uint64_t arg) {
25445         LDKCResult_StfuDecodeErrorZ* arg_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(arg);
25446         int64_t ret_conv = CResult_StfuDecodeErrorZ_clone_ptr(arg_conv);
25447         return ret_conv;
25448 }
25449
25450 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_clone"))) TS_CResult_StfuDecodeErrorZ_clone(uint64_t orig) {
25451         LDKCResult_StfuDecodeErrorZ* orig_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(orig);
25452         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
25453         *ret_conv = CResult_StfuDecodeErrorZ_clone(orig_conv);
25454         return tag_ptr(ret_conv, true);
25455 }
25456
25457 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_ok"))) TS_CResult_SpliceDecodeErrorZ_ok(uint64_t o) {
25458         LDKSplice o_conv;
25459         o_conv.inner = untag_ptr(o);
25460         o_conv.is_owned = ptr_is_owned(o);
25461         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25462         o_conv = Splice_clone(&o_conv);
25463         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
25464         *ret_conv = CResult_SpliceDecodeErrorZ_ok(o_conv);
25465         return tag_ptr(ret_conv, true);
25466 }
25467
25468 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_err"))) TS_CResult_SpliceDecodeErrorZ_err(uint64_t e) {
25469         void* e_ptr = untag_ptr(e);
25470         CHECK_ACCESS(e_ptr);
25471         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25472         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25473         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
25474         *ret_conv = CResult_SpliceDecodeErrorZ_err(e_conv);
25475         return tag_ptr(ret_conv, true);
25476 }
25477
25478 jboolean  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_is_ok"))) TS_CResult_SpliceDecodeErrorZ_is_ok(uint64_t o) {
25479         LDKCResult_SpliceDecodeErrorZ* o_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(o);
25480         jboolean ret_conv = CResult_SpliceDecodeErrorZ_is_ok(o_conv);
25481         return ret_conv;
25482 }
25483
25484 void  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_free"))) TS_CResult_SpliceDecodeErrorZ_free(uint64_t _res) {
25485         if (!ptr_is_owned(_res)) return;
25486         void* _res_ptr = untag_ptr(_res);
25487         CHECK_ACCESS(_res_ptr);
25488         LDKCResult_SpliceDecodeErrorZ _res_conv = *(LDKCResult_SpliceDecodeErrorZ*)(_res_ptr);
25489         FREE(untag_ptr(_res));
25490         CResult_SpliceDecodeErrorZ_free(_res_conv);
25491 }
25492
25493 static inline uint64_t CResult_SpliceDecodeErrorZ_clone_ptr(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR arg) {
25494         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
25495         *ret_conv = CResult_SpliceDecodeErrorZ_clone(arg);
25496         return tag_ptr(ret_conv, true);
25497 }
25498 int64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_clone_ptr"))) TS_CResult_SpliceDecodeErrorZ_clone_ptr(uint64_t arg) {
25499         LDKCResult_SpliceDecodeErrorZ* arg_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(arg);
25500         int64_t ret_conv = CResult_SpliceDecodeErrorZ_clone_ptr(arg_conv);
25501         return ret_conv;
25502 }
25503
25504 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_clone"))) TS_CResult_SpliceDecodeErrorZ_clone(uint64_t orig) {
25505         LDKCResult_SpliceDecodeErrorZ* orig_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(orig);
25506         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
25507         *ret_conv = CResult_SpliceDecodeErrorZ_clone(orig_conv);
25508         return tag_ptr(ret_conv, true);
25509 }
25510
25511 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_ok"))) TS_CResult_SpliceAckDecodeErrorZ_ok(uint64_t o) {
25512         LDKSpliceAck o_conv;
25513         o_conv.inner = untag_ptr(o);
25514         o_conv.is_owned = ptr_is_owned(o);
25515         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25516         o_conv = SpliceAck_clone(&o_conv);
25517         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
25518         *ret_conv = CResult_SpliceAckDecodeErrorZ_ok(o_conv);
25519         return tag_ptr(ret_conv, true);
25520 }
25521
25522 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_err"))) TS_CResult_SpliceAckDecodeErrorZ_err(uint64_t e) {
25523         void* e_ptr = untag_ptr(e);
25524         CHECK_ACCESS(e_ptr);
25525         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25526         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25527         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
25528         *ret_conv = CResult_SpliceAckDecodeErrorZ_err(e_conv);
25529         return tag_ptr(ret_conv, true);
25530 }
25531
25532 jboolean  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_is_ok"))) TS_CResult_SpliceAckDecodeErrorZ_is_ok(uint64_t o) {
25533         LDKCResult_SpliceAckDecodeErrorZ* o_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(o);
25534         jboolean ret_conv = CResult_SpliceAckDecodeErrorZ_is_ok(o_conv);
25535         return ret_conv;
25536 }
25537
25538 void  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_free"))) TS_CResult_SpliceAckDecodeErrorZ_free(uint64_t _res) {
25539         if (!ptr_is_owned(_res)) return;
25540         void* _res_ptr = untag_ptr(_res);
25541         CHECK_ACCESS(_res_ptr);
25542         LDKCResult_SpliceAckDecodeErrorZ _res_conv = *(LDKCResult_SpliceAckDecodeErrorZ*)(_res_ptr);
25543         FREE(untag_ptr(_res));
25544         CResult_SpliceAckDecodeErrorZ_free(_res_conv);
25545 }
25546
25547 static inline uint64_t CResult_SpliceAckDecodeErrorZ_clone_ptr(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR arg) {
25548         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
25549         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(arg);
25550         return tag_ptr(ret_conv, true);
25551 }
25552 int64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_clone_ptr"))) TS_CResult_SpliceAckDecodeErrorZ_clone_ptr(uint64_t arg) {
25553         LDKCResult_SpliceAckDecodeErrorZ* arg_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(arg);
25554         int64_t ret_conv = CResult_SpliceAckDecodeErrorZ_clone_ptr(arg_conv);
25555         return ret_conv;
25556 }
25557
25558 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_clone"))) TS_CResult_SpliceAckDecodeErrorZ_clone(uint64_t orig) {
25559         LDKCResult_SpliceAckDecodeErrorZ* orig_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(orig);
25560         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
25561         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(orig_conv);
25562         return tag_ptr(ret_conv, true);
25563 }
25564
25565 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_ok"))) TS_CResult_SpliceLockedDecodeErrorZ_ok(uint64_t o) {
25566         LDKSpliceLocked o_conv;
25567         o_conv.inner = untag_ptr(o);
25568         o_conv.is_owned = ptr_is_owned(o);
25569         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25570         o_conv = SpliceLocked_clone(&o_conv);
25571         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
25572         *ret_conv = CResult_SpliceLockedDecodeErrorZ_ok(o_conv);
25573         return tag_ptr(ret_conv, true);
25574 }
25575
25576 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_err"))) TS_CResult_SpliceLockedDecodeErrorZ_err(uint64_t e) {
25577         void* e_ptr = untag_ptr(e);
25578         CHECK_ACCESS(e_ptr);
25579         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25580         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25581         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
25582         *ret_conv = CResult_SpliceLockedDecodeErrorZ_err(e_conv);
25583         return tag_ptr(ret_conv, true);
25584 }
25585
25586 jboolean  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_is_ok"))) TS_CResult_SpliceLockedDecodeErrorZ_is_ok(uint64_t o) {
25587         LDKCResult_SpliceLockedDecodeErrorZ* o_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(o);
25588         jboolean ret_conv = CResult_SpliceLockedDecodeErrorZ_is_ok(o_conv);
25589         return ret_conv;
25590 }
25591
25592 void  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_free"))) TS_CResult_SpliceLockedDecodeErrorZ_free(uint64_t _res) {
25593         if (!ptr_is_owned(_res)) return;
25594         void* _res_ptr = untag_ptr(_res);
25595         CHECK_ACCESS(_res_ptr);
25596         LDKCResult_SpliceLockedDecodeErrorZ _res_conv = *(LDKCResult_SpliceLockedDecodeErrorZ*)(_res_ptr);
25597         FREE(untag_ptr(_res));
25598         CResult_SpliceLockedDecodeErrorZ_free(_res_conv);
25599 }
25600
25601 static inline uint64_t CResult_SpliceLockedDecodeErrorZ_clone_ptr(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR arg) {
25602         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
25603         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(arg);
25604         return tag_ptr(ret_conv, true);
25605 }
25606 int64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_clone_ptr"))) TS_CResult_SpliceLockedDecodeErrorZ_clone_ptr(uint64_t arg) {
25607         LDKCResult_SpliceLockedDecodeErrorZ* arg_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(arg);
25608         int64_t ret_conv = CResult_SpliceLockedDecodeErrorZ_clone_ptr(arg_conv);
25609         return ret_conv;
25610 }
25611
25612 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_clone"))) TS_CResult_SpliceLockedDecodeErrorZ_clone(uint64_t orig) {
25613         LDKCResult_SpliceLockedDecodeErrorZ* orig_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(orig);
25614         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
25615         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(orig_conv);
25616         return tag_ptr(ret_conv, true);
25617 }
25618
25619 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_ok"))) TS_CResult_TxAddInputDecodeErrorZ_ok(uint64_t o) {
25620         LDKTxAddInput o_conv;
25621         o_conv.inner = untag_ptr(o);
25622         o_conv.is_owned = ptr_is_owned(o);
25623         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25624         o_conv = TxAddInput_clone(&o_conv);
25625         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
25626         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
25627         return tag_ptr(ret_conv, true);
25628 }
25629
25630 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_err"))) TS_CResult_TxAddInputDecodeErrorZ_err(uint64_t e) {
25631         void* e_ptr = untag_ptr(e);
25632         CHECK_ACCESS(e_ptr);
25633         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25634         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25635         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
25636         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
25637         return tag_ptr(ret_conv, true);
25638 }
25639
25640 jboolean  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_is_ok"))) TS_CResult_TxAddInputDecodeErrorZ_is_ok(uint64_t o) {
25641         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
25642         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
25643         return ret_conv;
25644 }
25645
25646 void  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_free"))) TS_CResult_TxAddInputDecodeErrorZ_free(uint64_t _res) {
25647         if (!ptr_is_owned(_res)) return;
25648         void* _res_ptr = untag_ptr(_res);
25649         CHECK_ACCESS(_res_ptr);
25650         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
25651         FREE(untag_ptr(_res));
25652         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
25653 }
25654
25655 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
25656         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
25657         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
25658         return tag_ptr(ret_conv, true);
25659 }
25660 int64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddInputDecodeErrorZ_clone_ptr(uint64_t arg) {
25661         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
25662         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
25663         return ret_conv;
25664 }
25665
25666 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone"))) TS_CResult_TxAddInputDecodeErrorZ_clone(uint64_t orig) {
25667         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
25668         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
25669         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
25670         return tag_ptr(ret_conv, true);
25671 }
25672
25673 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_ok(uint64_t o) {
25674         LDKTxAddOutput o_conv;
25675         o_conv.inner = untag_ptr(o);
25676         o_conv.is_owned = ptr_is_owned(o);
25677         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25678         o_conv = TxAddOutput_clone(&o_conv);
25679         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
25680         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
25681         return tag_ptr(ret_conv, true);
25682 }
25683
25684 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_err"))) TS_CResult_TxAddOutputDecodeErrorZ_err(uint64_t e) {
25685         void* e_ptr = untag_ptr(e);
25686         CHECK_ACCESS(e_ptr);
25687         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25688         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25689         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
25690         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
25691         return tag_ptr(ret_conv, true);
25692 }
25693
25694 jboolean  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_is_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_is_ok(uint64_t o) {
25695         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
25696         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
25697         return ret_conv;
25698 }
25699
25700 void  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_free"))) TS_CResult_TxAddOutputDecodeErrorZ_free(uint64_t _res) {
25701         if (!ptr_is_owned(_res)) return;
25702         void* _res_ptr = untag_ptr(_res);
25703         CHECK_ACCESS(_res_ptr);
25704         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
25705         FREE(untag_ptr(_res));
25706         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
25707 }
25708
25709 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
25710         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
25711         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
25712         return tag_ptr(ret_conv, true);
25713 }
25714 int64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
25715         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
25716         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
25717         return ret_conv;
25718 }
25719
25720 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone"))) TS_CResult_TxAddOutputDecodeErrorZ_clone(uint64_t orig) {
25721         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
25722         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
25723         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
25724         return tag_ptr(ret_conv, true);
25725 }
25726
25727 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_ok(uint64_t o) {
25728         LDKTxRemoveInput o_conv;
25729         o_conv.inner = untag_ptr(o);
25730         o_conv.is_owned = ptr_is_owned(o);
25731         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25732         o_conv = TxRemoveInput_clone(&o_conv);
25733         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
25734         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
25735         return tag_ptr(ret_conv, true);
25736 }
25737
25738 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_err(uint64_t e) {
25739         void* e_ptr = untag_ptr(e);
25740         CHECK_ACCESS(e_ptr);
25741         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25742         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25743         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
25744         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
25745         return tag_ptr(ret_conv, true);
25746 }
25747
25748 jboolean  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_is_ok(uint64_t o) {
25749         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
25750         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
25751         return ret_conv;
25752 }
25753
25754 void  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_free"))) TS_CResult_TxRemoveInputDecodeErrorZ_free(uint64_t _res) {
25755         if (!ptr_is_owned(_res)) return;
25756         void* _res_ptr = untag_ptr(_res);
25757         CHECK_ACCESS(_res_ptr);
25758         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
25759         FREE(untag_ptr(_res));
25760         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
25761 }
25762
25763 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
25764         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
25765         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
25766         return tag_ptr(ret_conv, true);
25767 }
25768 int64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr(uint64_t arg) {
25769         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
25770         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
25771         return ret_conv;
25772 }
25773
25774 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone(uint64_t orig) {
25775         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
25776         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
25777         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
25778         return tag_ptr(ret_conv, true);
25779 }
25780
25781 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_ok(uint64_t o) {
25782         LDKTxRemoveOutput o_conv;
25783         o_conv.inner = untag_ptr(o);
25784         o_conv.is_owned = ptr_is_owned(o);
25785         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25786         o_conv = TxRemoveOutput_clone(&o_conv);
25787         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
25788         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
25789         return tag_ptr(ret_conv, true);
25790 }
25791
25792 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_err(uint64_t e) {
25793         void* e_ptr = untag_ptr(e);
25794         CHECK_ACCESS(e_ptr);
25795         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25796         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25797         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
25798         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
25799         return tag_ptr(ret_conv, true);
25800 }
25801
25802 jboolean  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok(uint64_t o) {
25803         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
25804         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
25805         return ret_conv;
25806 }
25807
25808 void  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_free"))) TS_CResult_TxRemoveOutputDecodeErrorZ_free(uint64_t _res) {
25809         if (!ptr_is_owned(_res)) return;
25810         void* _res_ptr = untag_ptr(_res);
25811         CHECK_ACCESS(_res_ptr);
25812         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
25813         FREE(untag_ptr(_res));
25814         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
25815 }
25816
25817 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
25818         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
25819         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
25820         return tag_ptr(ret_conv, true);
25821 }
25822 int64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
25823         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
25824         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
25825         return ret_conv;
25826 }
25827
25828 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone(uint64_t orig) {
25829         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
25830         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
25831         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
25832         return tag_ptr(ret_conv, true);
25833 }
25834
25835 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_ok"))) TS_CResult_TxCompleteDecodeErrorZ_ok(uint64_t o) {
25836         LDKTxComplete o_conv;
25837         o_conv.inner = untag_ptr(o);
25838         o_conv.is_owned = ptr_is_owned(o);
25839         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25840         o_conv = TxComplete_clone(&o_conv);
25841         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
25842         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
25843         return tag_ptr(ret_conv, true);
25844 }
25845
25846 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_err"))) TS_CResult_TxCompleteDecodeErrorZ_err(uint64_t e) {
25847         void* e_ptr = untag_ptr(e);
25848         CHECK_ACCESS(e_ptr);
25849         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25850         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25851         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
25852         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
25853         return tag_ptr(ret_conv, true);
25854 }
25855
25856 jboolean  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_is_ok"))) TS_CResult_TxCompleteDecodeErrorZ_is_ok(uint64_t o) {
25857         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
25858         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
25859         return ret_conv;
25860 }
25861
25862 void  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_free"))) TS_CResult_TxCompleteDecodeErrorZ_free(uint64_t _res) {
25863         if (!ptr_is_owned(_res)) return;
25864         void* _res_ptr = untag_ptr(_res);
25865         CHECK_ACCESS(_res_ptr);
25866         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
25867         FREE(untag_ptr(_res));
25868         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
25869 }
25870
25871 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
25872         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
25873         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
25874         return tag_ptr(ret_conv, true);
25875 }
25876 int64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone_ptr"))) TS_CResult_TxCompleteDecodeErrorZ_clone_ptr(uint64_t arg) {
25877         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
25878         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
25879         return ret_conv;
25880 }
25881
25882 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone"))) TS_CResult_TxCompleteDecodeErrorZ_clone(uint64_t orig) {
25883         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
25884         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
25885         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
25886         return tag_ptr(ret_conv, true);
25887 }
25888
25889 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_ok(uint64_t o) {
25890         LDKTxSignatures o_conv;
25891         o_conv.inner = untag_ptr(o);
25892         o_conv.is_owned = ptr_is_owned(o);
25893         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25894         o_conv = TxSignatures_clone(&o_conv);
25895         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
25896         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
25897         return tag_ptr(ret_conv, true);
25898 }
25899
25900 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_err"))) TS_CResult_TxSignaturesDecodeErrorZ_err(uint64_t e) {
25901         void* e_ptr = untag_ptr(e);
25902         CHECK_ACCESS(e_ptr);
25903         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25904         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25905         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
25906         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
25907         return tag_ptr(ret_conv, true);
25908 }
25909
25910 jboolean  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_is_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_is_ok(uint64_t o) {
25911         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
25912         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
25913         return ret_conv;
25914 }
25915
25916 void  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_free"))) TS_CResult_TxSignaturesDecodeErrorZ_free(uint64_t _res) {
25917         if (!ptr_is_owned(_res)) return;
25918         void* _res_ptr = untag_ptr(_res);
25919         CHECK_ACCESS(_res_ptr);
25920         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
25921         FREE(untag_ptr(_res));
25922         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
25923 }
25924
25925 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
25926         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
25927         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
25928         return tag_ptr(ret_conv, true);
25929 }
25930 int64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
25931         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
25932         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
25933         return ret_conv;
25934 }
25935
25936 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone"))) TS_CResult_TxSignaturesDecodeErrorZ_clone(uint64_t orig) {
25937         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
25938         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
25939         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
25940         return tag_ptr(ret_conv, true);
25941 }
25942
25943 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_ok(uint64_t o) {
25944         LDKTxInitRbf o_conv;
25945         o_conv.inner = untag_ptr(o);
25946         o_conv.is_owned = ptr_is_owned(o);
25947         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25948         o_conv = TxInitRbf_clone(&o_conv);
25949         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
25950         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
25951         return tag_ptr(ret_conv, true);
25952 }
25953
25954 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_err"))) TS_CResult_TxInitRbfDecodeErrorZ_err(uint64_t e) {
25955         void* e_ptr = untag_ptr(e);
25956         CHECK_ACCESS(e_ptr);
25957         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25958         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25959         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
25960         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
25961         return tag_ptr(ret_conv, true);
25962 }
25963
25964 jboolean  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_is_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_is_ok(uint64_t o) {
25965         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
25966         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
25967         return ret_conv;
25968 }
25969
25970 void  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_free"))) TS_CResult_TxInitRbfDecodeErrorZ_free(uint64_t _res) {
25971         if (!ptr_is_owned(_res)) return;
25972         void* _res_ptr = untag_ptr(_res);
25973         CHECK_ACCESS(_res_ptr);
25974         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
25975         FREE(untag_ptr(_res));
25976         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
25977 }
25978
25979 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
25980         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
25981         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
25982         return tag_ptr(ret_conv, true);
25983 }
25984 int64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
25985         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
25986         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
25987         return ret_conv;
25988 }
25989
25990 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone"))) TS_CResult_TxInitRbfDecodeErrorZ_clone(uint64_t orig) {
25991         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
25992         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
25993         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
25994         return tag_ptr(ret_conv, true);
25995 }
25996
25997 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_ok(uint64_t o) {
25998         LDKTxAckRbf o_conv;
25999         o_conv.inner = untag_ptr(o);
26000         o_conv.is_owned = ptr_is_owned(o);
26001         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26002         o_conv = TxAckRbf_clone(&o_conv);
26003         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
26004         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
26005         return tag_ptr(ret_conv, true);
26006 }
26007
26008 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_err"))) TS_CResult_TxAckRbfDecodeErrorZ_err(uint64_t e) {
26009         void* e_ptr = untag_ptr(e);
26010         CHECK_ACCESS(e_ptr);
26011         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26012         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26013         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
26014         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
26015         return tag_ptr(ret_conv, true);
26016 }
26017
26018 jboolean  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_is_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_is_ok(uint64_t o) {
26019         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
26020         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
26021         return ret_conv;
26022 }
26023
26024 void  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_free"))) TS_CResult_TxAckRbfDecodeErrorZ_free(uint64_t _res) {
26025         if (!ptr_is_owned(_res)) return;
26026         void* _res_ptr = untag_ptr(_res);
26027         CHECK_ACCESS(_res_ptr);
26028         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
26029         FREE(untag_ptr(_res));
26030         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
26031 }
26032
26033 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
26034         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
26035         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
26036         return tag_ptr(ret_conv, true);
26037 }
26038 int64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
26039         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
26040         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
26041         return ret_conv;
26042 }
26043
26044 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone"))) TS_CResult_TxAckRbfDecodeErrorZ_clone(uint64_t orig) {
26045         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
26046         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
26047         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
26048         return tag_ptr(ret_conv, true);
26049 }
26050
26051 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_ok"))) TS_CResult_TxAbortDecodeErrorZ_ok(uint64_t o) {
26052         LDKTxAbort o_conv;
26053         o_conv.inner = untag_ptr(o);
26054         o_conv.is_owned = ptr_is_owned(o);
26055         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26056         o_conv = TxAbort_clone(&o_conv);
26057         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
26058         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
26059         return tag_ptr(ret_conv, true);
26060 }
26061
26062 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_err"))) TS_CResult_TxAbortDecodeErrorZ_err(uint64_t e) {
26063         void* e_ptr = untag_ptr(e);
26064         CHECK_ACCESS(e_ptr);
26065         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26066         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26067         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
26068         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
26069         return tag_ptr(ret_conv, true);
26070 }
26071
26072 jboolean  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_is_ok"))) TS_CResult_TxAbortDecodeErrorZ_is_ok(uint64_t o) {
26073         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
26074         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
26075         return ret_conv;
26076 }
26077
26078 void  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_free"))) TS_CResult_TxAbortDecodeErrorZ_free(uint64_t _res) {
26079         if (!ptr_is_owned(_res)) return;
26080         void* _res_ptr = untag_ptr(_res);
26081         CHECK_ACCESS(_res_ptr);
26082         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
26083         FREE(untag_ptr(_res));
26084         CResult_TxAbortDecodeErrorZ_free(_res_conv);
26085 }
26086
26087 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
26088         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
26089         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
26090         return tag_ptr(ret_conv, true);
26091 }
26092 int64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone_ptr"))) TS_CResult_TxAbortDecodeErrorZ_clone_ptr(uint64_t arg) {
26093         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
26094         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
26095         return ret_conv;
26096 }
26097
26098 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone"))) TS_CResult_TxAbortDecodeErrorZ_clone(uint64_t orig) {
26099         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
26100         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
26101         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
26102         return tag_ptr(ret_conv, true);
26103 }
26104
26105 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
26106         LDKAnnouncementSignatures o_conv;
26107         o_conv.inner = untag_ptr(o);
26108         o_conv.is_owned = ptr_is_owned(o);
26109         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26110         o_conv = AnnouncementSignatures_clone(&o_conv);
26111         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
26112         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
26113         return tag_ptr(ret_conv, true);
26114 }
26115
26116 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
26117         void* e_ptr = untag_ptr(e);
26118         CHECK_ACCESS(e_ptr);
26119         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26120         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26121         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
26122         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
26123         return tag_ptr(ret_conv, true);
26124 }
26125
26126 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
26127         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
26128         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
26129         return ret_conv;
26130 }
26131
26132 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
26133         if (!ptr_is_owned(_res)) return;
26134         void* _res_ptr = untag_ptr(_res);
26135         CHECK_ACCESS(_res_ptr);
26136         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
26137         FREE(untag_ptr(_res));
26138         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
26139 }
26140
26141 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
26142         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
26143         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
26144         return tag_ptr(ret_conv, true);
26145 }
26146 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
26147         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
26148         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
26149         return ret_conv;
26150 }
26151
26152 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
26153         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
26154         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
26155         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
26156         return tag_ptr(ret_conv, true);
26157 }
26158
26159 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
26160         LDKChannelReestablish o_conv;
26161         o_conv.inner = untag_ptr(o);
26162         o_conv.is_owned = ptr_is_owned(o);
26163         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26164         o_conv = ChannelReestablish_clone(&o_conv);
26165         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
26166         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
26167         return tag_ptr(ret_conv, true);
26168 }
26169
26170 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
26171         void* e_ptr = untag_ptr(e);
26172         CHECK_ACCESS(e_ptr);
26173         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26174         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26175         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
26176         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
26177         return tag_ptr(ret_conv, true);
26178 }
26179
26180 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
26181         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
26182         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
26183         return ret_conv;
26184 }
26185
26186 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
26187         if (!ptr_is_owned(_res)) return;
26188         void* _res_ptr = untag_ptr(_res);
26189         CHECK_ACCESS(_res_ptr);
26190         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
26191         FREE(untag_ptr(_res));
26192         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
26193 }
26194
26195 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
26196         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
26197         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
26198         return tag_ptr(ret_conv, true);
26199 }
26200 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
26201         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
26202         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
26203         return ret_conv;
26204 }
26205
26206 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
26207         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
26208         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
26209         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
26210         return tag_ptr(ret_conv, true);
26211 }
26212
26213 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
26214         LDKClosingSigned o_conv;
26215         o_conv.inner = untag_ptr(o);
26216         o_conv.is_owned = ptr_is_owned(o);
26217         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26218         o_conv = ClosingSigned_clone(&o_conv);
26219         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
26220         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
26221         return tag_ptr(ret_conv, true);
26222 }
26223
26224 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
26225         void* e_ptr = untag_ptr(e);
26226         CHECK_ACCESS(e_ptr);
26227         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26228         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26229         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
26230         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
26231         return tag_ptr(ret_conv, true);
26232 }
26233
26234 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
26235         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
26236         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
26237         return ret_conv;
26238 }
26239
26240 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
26241         if (!ptr_is_owned(_res)) return;
26242         void* _res_ptr = untag_ptr(_res);
26243         CHECK_ACCESS(_res_ptr);
26244         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
26245         FREE(untag_ptr(_res));
26246         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
26247 }
26248
26249 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
26250         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
26251         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
26252         return tag_ptr(ret_conv, true);
26253 }
26254 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
26255         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
26256         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
26257         return ret_conv;
26258 }
26259
26260 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
26261         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
26262         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
26263         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
26264         return tag_ptr(ret_conv, true);
26265 }
26266
26267 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
26268         LDKClosingSignedFeeRange o_conv;
26269         o_conv.inner = untag_ptr(o);
26270         o_conv.is_owned = ptr_is_owned(o);
26271         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26272         o_conv = ClosingSignedFeeRange_clone(&o_conv);
26273         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
26274         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
26275         return tag_ptr(ret_conv, true);
26276 }
26277
26278 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
26279         void* e_ptr = untag_ptr(e);
26280         CHECK_ACCESS(e_ptr);
26281         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26282         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26283         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
26284         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
26285         return tag_ptr(ret_conv, true);
26286 }
26287
26288 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
26289         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
26290         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
26291         return ret_conv;
26292 }
26293
26294 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
26295         if (!ptr_is_owned(_res)) return;
26296         void* _res_ptr = untag_ptr(_res);
26297         CHECK_ACCESS(_res_ptr);
26298         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
26299         FREE(untag_ptr(_res));
26300         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
26301 }
26302
26303 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
26304         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
26305         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
26306         return tag_ptr(ret_conv, true);
26307 }
26308 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
26309         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
26310         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
26311         return ret_conv;
26312 }
26313
26314 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
26315         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
26316         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
26317         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
26318         return tag_ptr(ret_conv, true);
26319 }
26320
26321 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
26322         LDKCommitmentSigned o_conv;
26323         o_conv.inner = untag_ptr(o);
26324         o_conv.is_owned = ptr_is_owned(o);
26325         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26326         o_conv = CommitmentSigned_clone(&o_conv);
26327         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
26328         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
26329         return tag_ptr(ret_conv, true);
26330 }
26331
26332 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
26333         void* e_ptr = untag_ptr(e);
26334         CHECK_ACCESS(e_ptr);
26335         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26336         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26337         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
26338         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
26339         return tag_ptr(ret_conv, true);
26340 }
26341
26342 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
26343         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
26344         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
26345         return ret_conv;
26346 }
26347
26348 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
26349         if (!ptr_is_owned(_res)) return;
26350         void* _res_ptr = untag_ptr(_res);
26351         CHECK_ACCESS(_res_ptr);
26352         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
26353         FREE(untag_ptr(_res));
26354         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
26355 }
26356
26357 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
26358         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
26359         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
26360         return tag_ptr(ret_conv, true);
26361 }
26362 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
26363         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
26364         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
26365         return ret_conv;
26366 }
26367
26368 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
26369         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
26370         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
26371         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
26372         return tag_ptr(ret_conv, true);
26373 }
26374
26375 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
26376         LDKFundingCreated o_conv;
26377         o_conv.inner = untag_ptr(o);
26378         o_conv.is_owned = ptr_is_owned(o);
26379         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26380         o_conv = FundingCreated_clone(&o_conv);
26381         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
26382         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
26383         return tag_ptr(ret_conv, true);
26384 }
26385
26386 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
26387         void* e_ptr = untag_ptr(e);
26388         CHECK_ACCESS(e_ptr);
26389         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26390         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26391         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
26392         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
26393         return tag_ptr(ret_conv, true);
26394 }
26395
26396 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
26397         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
26398         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
26399         return ret_conv;
26400 }
26401
26402 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
26403         if (!ptr_is_owned(_res)) return;
26404         void* _res_ptr = untag_ptr(_res);
26405         CHECK_ACCESS(_res_ptr);
26406         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
26407         FREE(untag_ptr(_res));
26408         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
26409 }
26410
26411 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
26412         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
26413         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
26414         return tag_ptr(ret_conv, true);
26415 }
26416 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
26417         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
26418         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
26419         return ret_conv;
26420 }
26421
26422 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
26423         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
26424         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
26425         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
26426         return tag_ptr(ret_conv, true);
26427 }
26428
26429 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
26430         LDKFundingSigned o_conv;
26431         o_conv.inner = untag_ptr(o);
26432         o_conv.is_owned = ptr_is_owned(o);
26433         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26434         o_conv = FundingSigned_clone(&o_conv);
26435         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
26436         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
26437         return tag_ptr(ret_conv, true);
26438 }
26439
26440 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
26441         void* e_ptr = untag_ptr(e);
26442         CHECK_ACCESS(e_ptr);
26443         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26444         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26445         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
26446         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
26447         return tag_ptr(ret_conv, true);
26448 }
26449
26450 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
26451         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
26452         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
26453         return ret_conv;
26454 }
26455
26456 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
26457         if (!ptr_is_owned(_res)) return;
26458         void* _res_ptr = untag_ptr(_res);
26459         CHECK_ACCESS(_res_ptr);
26460         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
26461         FREE(untag_ptr(_res));
26462         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
26463 }
26464
26465 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
26466         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
26467         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
26468         return tag_ptr(ret_conv, true);
26469 }
26470 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
26471         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
26472         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
26473         return ret_conv;
26474 }
26475
26476 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
26477         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
26478         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
26479         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
26480         return tag_ptr(ret_conv, true);
26481 }
26482
26483 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
26484         LDKChannelReady o_conv;
26485         o_conv.inner = untag_ptr(o);
26486         o_conv.is_owned = ptr_is_owned(o);
26487         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26488         o_conv = ChannelReady_clone(&o_conv);
26489         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
26490         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
26491         return tag_ptr(ret_conv, true);
26492 }
26493
26494 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
26495         void* e_ptr = untag_ptr(e);
26496         CHECK_ACCESS(e_ptr);
26497         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26498         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26499         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
26500         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
26501         return tag_ptr(ret_conv, true);
26502 }
26503
26504 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
26505         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
26506         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
26507         return ret_conv;
26508 }
26509
26510 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
26511         if (!ptr_is_owned(_res)) return;
26512         void* _res_ptr = untag_ptr(_res);
26513         CHECK_ACCESS(_res_ptr);
26514         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
26515         FREE(untag_ptr(_res));
26516         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
26517 }
26518
26519 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
26520         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
26521         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
26522         return tag_ptr(ret_conv, true);
26523 }
26524 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
26525         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
26526         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
26527         return ret_conv;
26528 }
26529
26530 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
26531         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
26532         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
26533         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
26534         return tag_ptr(ret_conv, true);
26535 }
26536
26537 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
26538         LDKInit o_conv;
26539         o_conv.inner = untag_ptr(o);
26540         o_conv.is_owned = ptr_is_owned(o);
26541         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26542         o_conv = Init_clone(&o_conv);
26543         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
26544         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
26545         return tag_ptr(ret_conv, true);
26546 }
26547
26548 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
26549         void* e_ptr = untag_ptr(e);
26550         CHECK_ACCESS(e_ptr);
26551         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26552         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26553         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
26554         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
26555         return tag_ptr(ret_conv, true);
26556 }
26557
26558 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
26559         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
26560         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
26561         return ret_conv;
26562 }
26563
26564 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
26565         if (!ptr_is_owned(_res)) return;
26566         void* _res_ptr = untag_ptr(_res);
26567         CHECK_ACCESS(_res_ptr);
26568         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
26569         FREE(untag_ptr(_res));
26570         CResult_InitDecodeErrorZ_free(_res_conv);
26571 }
26572
26573 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
26574         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
26575         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
26576         return tag_ptr(ret_conv, true);
26577 }
26578 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
26579         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
26580         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
26581         return ret_conv;
26582 }
26583
26584 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
26585         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
26586         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
26587         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
26588         return tag_ptr(ret_conv, true);
26589 }
26590
26591 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
26592         LDKOpenChannel o_conv;
26593         o_conv.inner = untag_ptr(o);
26594         o_conv.is_owned = ptr_is_owned(o);
26595         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26596         o_conv = OpenChannel_clone(&o_conv);
26597         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
26598         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
26599         return tag_ptr(ret_conv, true);
26600 }
26601
26602 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
26603         void* e_ptr = untag_ptr(e);
26604         CHECK_ACCESS(e_ptr);
26605         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26606         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26607         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
26608         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
26609         return tag_ptr(ret_conv, true);
26610 }
26611
26612 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
26613         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
26614         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
26615         return ret_conv;
26616 }
26617
26618 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
26619         if (!ptr_is_owned(_res)) return;
26620         void* _res_ptr = untag_ptr(_res);
26621         CHECK_ACCESS(_res_ptr);
26622         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
26623         FREE(untag_ptr(_res));
26624         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
26625 }
26626
26627 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
26628         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
26629         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
26630         return tag_ptr(ret_conv, true);
26631 }
26632 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
26633         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
26634         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
26635         return ret_conv;
26636 }
26637
26638 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
26639         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
26640         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
26641         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
26642         return tag_ptr(ret_conv, true);
26643 }
26644
26645 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_ok(uint64_t o) {
26646         LDKOpenChannelV2 o_conv;
26647         o_conv.inner = untag_ptr(o);
26648         o_conv.is_owned = ptr_is_owned(o);
26649         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26650         o_conv = OpenChannelV2_clone(&o_conv);
26651         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
26652         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
26653         return tag_ptr(ret_conv, true);
26654 }
26655
26656 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_err(uint64_t e) {
26657         void* e_ptr = untag_ptr(e);
26658         CHECK_ACCESS(e_ptr);
26659         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26660         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26661         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
26662         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
26663         return tag_ptr(ret_conv, true);
26664 }
26665
26666 jboolean  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_is_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_is_ok(uint64_t o) {
26667         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
26668         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
26669         return ret_conv;
26670 }
26671
26672 void  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_free"))) TS_CResult_OpenChannelV2DecodeErrorZ_free(uint64_t _res) {
26673         if (!ptr_is_owned(_res)) return;
26674         void* _res_ptr = untag_ptr(_res);
26675         CHECK_ACCESS(_res_ptr);
26676         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
26677         FREE(untag_ptr(_res));
26678         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
26679 }
26680
26681 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
26682         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
26683         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
26684         return tag_ptr(ret_conv, true);
26685 }
26686 int64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
26687         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
26688         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
26689         return ret_conv;
26690 }
26691
26692 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone(uint64_t orig) {
26693         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
26694         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
26695         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
26696         return tag_ptr(ret_conv, true);
26697 }
26698
26699 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
26700         LDKRevokeAndACK o_conv;
26701         o_conv.inner = untag_ptr(o);
26702         o_conv.is_owned = ptr_is_owned(o);
26703         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26704         o_conv = RevokeAndACK_clone(&o_conv);
26705         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
26706         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
26707         return tag_ptr(ret_conv, true);
26708 }
26709
26710 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
26711         void* e_ptr = untag_ptr(e);
26712         CHECK_ACCESS(e_ptr);
26713         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26714         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26715         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
26716         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
26717         return tag_ptr(ret_conv, true);
26718 }
26719
26720 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
26721         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
26722         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
26723         return ret_conv;
26724 }
26725
26726 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
26727         if (!ptr_is_owned(_res)) return;
26728         void* _res_ptr = untag_ptr(_res);
26729         CHECK_ACCESS(_res_ptr);
26730         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
26731         FREE(untag_ptr(_res));
26732         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
26733 }
26734
26735 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
26736         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
26737         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
26738         return tag_ptr(ret_conv, true);
26739 }
26740 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
26741         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
26742         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
26743         return ret_conv;
26744 }
26745
26746 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
26747         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
26748         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
26749         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
26750         return tag_ptr(ret_conv, true);
26751 }
26752
26753 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
26754         LDKShutdown o_conv;
26755         o_conv.inner = untag_ptr(o);
26756         o_conv.is_owned = ptr_is_owned(o);
26757         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26758         o_conv = Shutdown_clone(&o_conv);
26759         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
26760         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
26761         return tag_ptr(ret_conv, true);
26762 }
26763
26764 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
26765         void* e_ptr = untag_ptr(e);
26766         CHECK_ACCESS(e_ptr);
26767         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26768         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26769         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
26770         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
26771         return tag_ptr(ret_conv, true);
26772 }
26773
26774 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
26775         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
26776         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
26777         return ret_conv;
26778 }
26779
26780 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
26781         if (!ptr_is_owned(_res)) return;
26782         void* _res_ptr = untag_ptr(_res);
26783         CHECK_ACCESS(_res_ptr);
26784         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
26785         FREE(untag_ptr(_res));
26786         CResult_ShutdownDecodeErrorZ_free(_res_conv);
26787 }
26788
26789 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
26790         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
26791         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
26792         return tag_ptr(ret_conv, true);
26793 }
26794 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
26795         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
26796         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
26797         return ret_conv;
26798 }
26799
26800 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
26801         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
26802         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
26803         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
26804         return tag_ptr(ret_conv, true);
26805 }
26806
26807 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
26808         LDKUpdateFailHTLC o_conv;
26809         o_conv.inner = untag_ptr(o);
26810         o_conv.is_owned = ptr_is_owned(o);
26811         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26812         o_conv = UpdateFailHTLC_clone(&o_conv);
26813         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
26814         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
26815         return tag_ptr(ret_conv, true);
26816 }
26817
26818 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
26819         void* e_ptr = untag_ptr(e);
26820         CHECK_ACCESS(e_ptr);
26821         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26822         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26823         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
26824         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
26825         return tag_ptr(ret_conv, true);
26826 }
26827
26828 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
26829         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
26830         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
26831         return ret_conv;
26832 }
26833
26834 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
26835         if (!ptr_is_owned(_res)) return;
26836         void* _res_ptr = untag_ptr(_res);
26837         CHECK_ACCESS(_res_ptr);
26838         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
26839         FREE(untag_ptr(_res));
26840         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
26841 }
26842
26843 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
26844         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
26845         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
26846         return tag_ptr(ret_conv, true);
26847 }
26848 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
26849         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
26850         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
26851         return ret_conv;
26852 }
26853
26854 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
26855         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
26856         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
26857         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
26858         return tag_ptr(ret_conv, true);
26859 }
26860
26861 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
26862         LDKUpdateFailMalformedHTLC o_conv;
26863         o_conv.inner = untag_ptr(o);
26864         o_conv.is_owned = ptr_is_owned(o);
26865         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26866         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
26867         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
26868         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
26869         return tag_ptr(ret_conv, true);
26870 }
26871
26872 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
26873         void* e_ptr = untag_ptr(e);
26874         CHECK_ACCESS(e_ptr);
26875         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26876         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26877         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
26878         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
26879         return tag_ptr(ret_conv, true);
26880 }
26881
26882 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
26883         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
26884         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
26885         return ret_conv;
26886 }
26887
26888 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
26889         if (!ptr_is_owned(_res)) return;
26890         void* _res_ptr = untag_ptr(_res);
26891         CHECK_ACCESS(_res_ptr);
26892         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
26893         FREE(untag_ptr(_res));
26894         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
26895 }
26896
26897 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
26898         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
26899         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
26900         return tag_ptr(ret_conv, true);
26901 }
26902 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
26903         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
26904         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
26905         return ret_conv;
26906 }
26907
26908 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
26909         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
26910         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
26911         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
26912         return tag_ptr(ret_conv, true);
26913 }
26914
26915 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
26916         LDKUpdateFee o_conv;
26917         o_conv.inner = untag_ptr(o);
26918         o_conv.is_owned = ptr_is_owned(o);
26919         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26920         o_conv = UpdateFee_clone(&o_conv);
26921         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
26922         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
26923         return tag_ptr(ret_conv, true);
26924 }
26925
26926 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
26927         void* e_ptr = untag_ptr(e);
26928         CHECK_ACCESS(e_ptr);
26929         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26930         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26931         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
26932         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
26933         return tag_ptr(ret_conv, true);
26934 }
26935
26936 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
26937         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
26938         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
26939         return ret_conv;
26940 }
26941
26942 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
26943         if (!ptr_is_owned(_res)) return;
26944         void* _res_ptr = untag_ptr(_res);
26945         CHECK_ACCESS(_res_ptr);
26946         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
26947         FREE(untag_ptr(_res));
26948         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
26949 }
26950
26951 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
26952         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
26953         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
26954         return tag_ptr(ret_conv, true);
26955 }
26956 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
26957         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
26958         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
26959         return ret_conv;
26960 }
26961
26962 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
26963         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
26964         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
26965         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
26966         return tag_ptr(ret_conv, true);
26967 }
26968
26969 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
26970         LDKUpdateFulfillHTLC o_conv;
26971         o_conv.inner = untag_ptr(o);
26972         o_conv.is_owned = ptr_is_owned(o);
26973         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26974         o_conv = UpdateFulfillHTLC_clone(&o_conv);
26975         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
26976         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
26977         return tag_ptr(ret_conv, true);
26978 }
26979
26980 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
26981         void* e_ptr = untag_ptr(e);
26982         CHECK_ACCESS(e_ptr);
26983         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26984         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26985         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
26986         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
26987         return tag_ptr(ret_conv, true);
26988 }
26989
26990 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
26991         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
26992         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
26993         return ret_conv;
26994 }
26995
26996 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
26997         if (!ptr_is_owned(_res)) return;
26998         void* _res_ptr = untag_ptr(_res);
26999         CHECK_ACCESS(_res_ptr);
27000         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
27001         FREE(untag_ptr(_res));
27002         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
27003 }
27004
27005 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
27006         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
27007         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
27008         return tag_ptr(ret_conv, true);
27009 }
27010 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
27011         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
27012         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
27013         return ret_conv;
27014 }
27015
27016 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
27017         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
27018         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
27019         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
27020         return tag_ptr(ret_conv, true);
27021 }
27022
27023 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_ok"))) TS_CResult_OnionPacketDecodeErrorZ_ok(uint64_t o) {
27024         LDKOnionPacket o_conv;
27025         o_conv.inner = untag_ptr(o);
27026         o_conv.is_owned = ptr_is_owned(o);
27027         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27028         o_conv = OnionPacket_clone(&o_conv);
27029         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
27030         *ret_conv = CResult_OnionPacketDecodeErrorZ_ok(o_conv);
27031         return tag_ptr(ret_conv, true);
27032 }
27033
27034 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_err"))) TS_CResult_OnionPacketDecodeErrorZ_err(uint64_t e) {
27035         void* e_ptr = untag_ptr(e);
27036         CHECK_ACCESS(e_ptr);
27037         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27038         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27039         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
27040         *ret_conv = CResult_OnionPacketDecodeErrorZ_err(e_conv);
27041         return tag_ptr(ret_conv, true);
27042 }
27043
27044 jboolean  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_is_ok"))) TS_CResult_OnionPacketDecodeErrorZ_is_ok(uint64_t o) {
27045         LDKCResult_OnionPacketDecodeErrorZ* o_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(o);
27046         jboolean ret_conv = CResult_OnionPacketDecodeErrorZ_is_ok(o_conv);
27047         return ret_conv;
27048 }
27049
27050 void  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_free"))) TS_CResult_OnionPacketDecodeErrorZ_free(uint64_t _res) {
27051         if (!ptr_is_owned(_res)) return;
27052         void* _res_ptr = untag_ptr(_res);
27053         CHECK_ACCESS(_res_ptr);
27054         LDKCResult_OnionPacketDecodeErrorZ _res_conv = *(LDKCResult_OnionPacketDecodeErrorZ*)(_res_ptr);
27055         FREE(untag_ptr(_res));
27056         CResult_OnionPacketDecodeErrorZ_free(_res_conv);
27057 }
27058
27059 static inline uint64_t CResult_OnionPacketDecodeErrorZ_clone_ptr(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR arg) {
27060         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
27061         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(arg);
27062         return tag_ptr(ret_conv, true);
27063 }
27064 int64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_clone_ptr"))) TS_CResult_OnionPacketDecodeErrorZ_clone_ptr(uint64_t arg) {
27065         LDKCResult_OnionPacketDecodeErrorZ* arg_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(arg);
27066         int64_t ret_conv = CResult_OnionPacketDecodeErrorZ_clone_ptr(arg_conv);
27067         return ret_conv;
27068 }
27069
27070 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_clone"))) TS_CResult_OnionPacketDecodeErrorZ_clone(uint64_t orig) {
27071         LDKCResult_OnionPacketDecodeErrorZ* orig_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(orig);
27072         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
27073         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(orig_conv);
27074         return tag_ptr(ret_conv, true);
27075 }
27076
27077 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
27078         LDKUpdateAddHTLC o_conv;
27079         o_conv.inner = untag_ptr(o);
27080         o_conv.is_owned = ptr_is_owned(o);
27081         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27082         o_conv = UpdateAddHTLC_clone(&o_conv);
27083         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27084         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
27085         return tag_ptr(ret_conv, true);
27086 }
27087
27088 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
27089         void* e_ptr = untag_ptr(e);
27090         CHECK_ACCESS(e_ptr);
27091         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27092         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27093         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27094         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
27095         return tag_ptr(ret_conv, true);
27096 }
27097
27098 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
27099         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
27100         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
27101         return ret_conv;
27102 }
27103
27104 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
27105         if (!ptr_is_owned(_res)) return;
27106         void* _res_ptr = untag_ptr(_res);
27107         CHECK_ACCESS(_res_ptr);
27108         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
27109         FREE(untag_ptr(_res));
27110         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
27111 }
27112
27113 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
27114         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27115         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
27116         return tag_ptr(ret_conv, true);
27117 }
27118 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
27119         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
27120         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
27121         return ret_conv;
27122 }
27123
27124 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
27125         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
27126         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27127         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
27128         return tag_ptr(ret_conv, true);
27129 }
27130
27131 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
27132         LDKOnionMessage o_conv;
27133         o_conv.inner = untag_ptr(o);
27134         o_conv.is_owned = ptr_is_owned(o);
27135         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27136         o_conv = OnionMessage_clone(&o_conv);
27137         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
27138         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
27139         return tag_ptr(ret_conv, true);
27140 }
27141
27142 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
27143         void* e_ptr = untag_ptr(e);
27144         CHECK_ACCESS(e_ptr);
27145         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27146         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27147         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
27148         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
27149         return tag_ptr(ret_conv, true);
27150 }
27151
27152 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
27153         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
27154         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
27155         return ret_conv;
27156 }
27157
27158 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
27159         if (!ptr_is_owned(_res)) return;
27160         void* _res_ptr = untag_ptr(_res);
27161         CHECK_ACCESS(_res_ptr);
27162         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
27163         FREE(untag_ptr(_res));
27164         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
27165 }
27166
27167 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
27168         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
27169         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
27170         return tag_ptr(ret_conv, true);
27171 }
27172 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
27173         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
27174         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
27175         return ret_conv;
27176 }
27177
27178 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
27179         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
27180         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
27181         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
27182         return tag_ptr(ret_conv, true);
27183 }
27184
27185 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_ok"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_ok(uint64_t o) {
27186         LDKFinalOnionHopData o_conv;
27187         o_conv.inner = untag_ptr(o);
27188         o_conv.is_owned = ptr_is_owned(o);
27189         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27190         o_conv = FinalOnionHopData_clone(&o_conv);
27191         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
27192         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_ok(o_conv);
27193         return tag_ptr(ret_conv, true);
27194 }
27195
27196 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_err"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_err(uint64_t e) {
27197         void* e_ptr = untag_ptr(e);
27198         CHECK_ACCESS(e_ptr);
27199         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27200         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27201         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
27202         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_err(e_conv);
27203         return tag_ptr(ret_conv, true);
27204 }
27205
27206 jboolean  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_is_ok"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_is_ok(uint64_t o) {
27207         LDKCResult_FinalOnionHopDataDecodeErrorZ* o_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(o);
27208         jboolean ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o_conv);
27209         return ret_conv;
27210 }
27211
27212 void  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_free"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_free(uint64_t _res) {
27213         if (!ptr_is_owned(_res)) return;
27214         void* _res_ptr = untag_ptr(_res);
27215         CHECK_ACCESS(_res_ptr);
27216         LDKCResult_FinalOnionHopDataDecodeErrorZ _res_conv = *(LDKCResult_FinalOnionHopDataDecodeErrorZ*)(_res_ptr);
27217         FREE(untag_ptr(_res));
27218         CResult_FinalOnionHopDataDecodeErrorZ_free(_res_conv);
27219 }
27220
27221 static inline uint64_t CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR arg) {
27222         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
27223         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(arg);
27224         return tag_ptr(ret_conv, true);
27225 }
27226 int64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(uint64_t arg) {
27227         LDKCResult_FinalOnionHopDataDecodeErrorZ* arg_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(arg);
27228         int64_t ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(arg_conv);
27229         return ret_conv;
27230 }
27231
27232 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_clone"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_clone(uint64_t orig) {
27233         LDKCResult_FinalOnionHopDataDecodeErrorZ* orig_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(orig);
27234         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
27235         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(orig_conv);
27236         return tag_ptr(ret_conv, true);
27237 }
27238
27239 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
27240         LDKPing o_conv;
27241         o_conv.inner = untag_ptr(o);
27242         o_conv.is_owned = ptr_is_owned(o);
27243         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27244         o_conv = Ping_clone(&o_conv);
27245         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27246         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
27247         return tag_ptr(ret_conv, true);
27248 }
27249
27250 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
27251         void* e_ptr = untag_ptr(e);
27252         CHECK_ACCESS(e_ptr);
27253         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27254         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27255         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27256         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
27257         return tag_ptr(ret_conv, true);
27258 }
27259
27260 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
27261         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
27262         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
27263         return ret_conv;
27264 }
27265
27266 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
27267         if (!ptr_is_owned(_res)) return;
27268         void* _res_ptr = untag_ptr(_res);
27269         CHECK_ACCESS(_res_ptr);
27270         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
27271         FREE(untag_ptr(_res));
27272         CResult_PingDecodeErrorZ_free(_res_conv);
27273 }
27274
27275 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
27276         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27277         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
27278         return tag_ptr(ret_conv, true);
27279 }
27280 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
27281         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
27282         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
27283         return ret_conv;
27284 }
27285
27286 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
27287         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
27288         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27289         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
27290         return tag_ptr(ret_conv, true);
27291 }
27292
27293 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
27294         LDKPong o_conv;
27295         o_conv.inner = untag_ptr(o);
27296         o_conv.is_owned = ptr_is_owned(o);
27297         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27298         o_conv = Pong_clone(&o_conv);
27299         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27300         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
27301         return tag_ptr(ret_conv, true);
27302 }
27303
27304 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
27305         void* e_ptr = untag_ptr(e);
27306         CHECK_ACCESS(e_ptr);
27307         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27308         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27309         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27310         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
27311         return tag_ptr(ret_conv, true);
27312 }
27313
27314 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
27315         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
27316         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
27317         return ret_conv;
27318 }
27319
27320 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
27321         if (!ptr_is_owned(_res)) return;
27322         void* _res_ptr = untag_ptr(_res);
27323         CHECK_ACCESS(_res_ptr);
27324         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
27325         FREE(untag_ptr(_res));
27326         CResult_PongDecodeErrorZ_free(_res_conv);
27327 }
27328
27329 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
27330         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27331         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
27332         return tag_ptr(ret_conv, true);
27333 }
27334 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
27335         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
27336         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
27337         return ret_conv;
27338 }
27339
27340 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
27341         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
27342         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27343         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
27344         return tag_ptr(ret_conv, true);
27345 }
27346
27347 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
27348         LDKUnsignedChannelAnnouncement o_conv;
27349         o_conv.inner = untag_ptr(o);
27350         o_conv.is_owned = ptr_is_owned(o);
27351         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27352         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
27353         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27354         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
27355         return tag_ptr(ret_conv, true);
27356 }
27357
27358 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
27359         void* e_ptr = untag_ptr(e);
27360         CHECK_ACCESS(e_ptr);
27361         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27362         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27363         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27364         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
27365         return tag_ptr(ret_conv, true);
27366 }
27367
27368 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
27369         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
27370         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
27371         return ret_conv;
27372 }
27373
27374 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
27375         if (!ptr_is_owned(_res)) return;
27376         void* _res_ptr = untag_ptr(_res);
27377         CHECK_ACCESS(_res_ptr);
27378         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
27379         FREE(untag_ptr(_res));
27380         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
27381 }
27382
27383 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
27384         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27385         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
27386         return tag_ptr(ret_conv, true);
27387 }
27388 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
27389         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
27390         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
27391         return ret_conv;
27392 }
27393
27394 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
27395         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
27396         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27397         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
27398         return tag_ptr(ret_conv, true);
27399 }
27400
27401 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
27402         LDKChannelAnnouncement o_conv;
27403         o_conv.inner = untag_ptr(o);
27404         o_conv.is_owned = ptr_is_owned(o);
27405         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27406         o_conv = ChannelAnnouncement_clone(&o_conv);
27407         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27408         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
27409         return tag_ptr(ret_conv, true);
27410 }
27411
27412 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
27413         void* e_ptr = untag_ptr(e);
27414         CHECK_ACCESS(e_ptr);
27415         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27416         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27417         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27418         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
27419         return tag_ptr(ret_conv, true);
27420 }
27421
27422 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
27423         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
27424         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
27425         return ret_conv;
27426 }
27427
27428 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
27429         if (!ptr_is_owned(_res)) return;
27430         void* _res_ptr = untag_ptr(_res);
27431         CHECK_ACCESS(_res_ptr);
27432         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
27433         FREE(untag_ptr(_res));
27434         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
27435 }
27436
27437 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
27438         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27439         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
27440         return tag_ptr(ret_conv, true);
27441 }
27442 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
27443         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
27444         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
27445         return ret_conv;
27446 }
27447
27448 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
27449         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
27450         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27451         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
27452         return tag_ptr(ret_conv, true);
27453 }
27454
27455 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
27456         LDKUnsignedChannelUpdate o_conv;
27457         o_conv.inner = untag_ptr(o);
27458         o_conv.is_owned = ptr_is_owned(o);
27459         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27460         o_conv = UnsignedChannelUpdate_clone(&o_conv);
27461         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27462         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
27463         return tag_ptr(ret_conv, true);
27464 }
27465
27466 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
27467         void* e_ptr = untag_ptr(e);
27468         CHECK_ACCESS(e_ptr);
27469         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27470         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27471         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27472         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
27473         return tag_ptr(ret_conv, true);
27474 }
27475
27476 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
27477         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
27478         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
27479         return ret_conv;
27480 }
27481
27482 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
27483         if (!ptr_is_owned(_res)) return;
27484         void* _res_ptr = untag_ptr(_res);
27485         CHECK_ACCESS(_res_ptr);
27486         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
27487         FREE(untag_ptr(_res));
27488         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
27489 }
27490
27491 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
27492         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27493         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
27494         return tag_ptr(ret_conv, true);
27495 }
27496 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
27497         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
27498         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
27499         return ret_conv;
27500 }
27501
27502 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
27503         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
27504         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27505         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
27506         return tag_ptr(ret_conv, true);
27507 }
27508
27509 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
27510         LDKChannelUpdate o_conv;
27511         o_conv.inner = untag_ptr(o);
27512         o_conv.is_owned = ptr_is_owned(o);
27513         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27514         o_conv = ChannelUpdate_clone(&o_conv);
27515         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27516         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
27517         return tag_ptr(ret_conv, true);
27518 }
27519
27520 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
27521         void* e_ptr = untag_ptr(e);
27522         CHECK_ACCESS(e_ptr);
27523         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27524         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27525         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27526         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
27527         return tag_ptr(ret_conv, true);
27528 }
27529
27530 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
27531         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
27532         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
27533         return ret_conv;
27534 }
27535
27536 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
27537         if (!ptr_is_owned(_res)) return;
27538         void* _res_ptr = untag_ptr(_res);
27539         CHECK_ACCESS(_res_ptr);
27540         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
27541         FREE(untag_ptr(_res));
27542         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
27543 }
27544
27545 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
27546         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27547         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
27548         return tag_ptr(ret_conv, true);
27549 }
27550 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
27551         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
27552         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
27553         return ret_conv;
27554 }
27555
27556 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
27557         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
27558         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27559         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
27560         return tag_ptr(ret_conv, true);
27561 }
27562
27563 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
27564         LDKErrorMessage o_conv;
27565         o_conv.inner = untag_ptr(o);
27566         o_conv.is_owned = ptr_is_owned(o);
27567         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27568         o_conv = ErrorMessage_clone(&o_conv);
27569         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27570         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
27571         return tag_ptr(ret_conv, true);
27572 }
27573
27574 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
27575         void* e_ptr = untag_ptr(e);
27576         CHECK_ACCESS(e_ptr);
27577         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27578         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27579         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27580         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
27581         return tag_ptr(ret_conv, true);
27582 }
27583
27584 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
27585         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
27586         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
27587         return ret_conv;
27588 }
27589
27590 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
27591         if (!ptr_is_owned(_res)) return;
27592         void* _res_ptr = untag_ptr(_res);
27593         CHECK_ACCESS(_res_ptr);
27594         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
27595         FREE(untag_ptr(_res));
27596         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
27597 }
27598
27599 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
27600         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27601         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
27602         return tag_ptr(ret_conv, true);
27603 }
27604 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
27605         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
27606         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
27607         return ret_conv;
27608 }
27609
27610 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
27611         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
27612         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27613         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
27614         return tag_ptr(ret_conv, true);
27615 }
27616
27617 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
27618         LDKWarningMessage o_conv;
27619         o_conv.inner = untag_ptr(o);
27620         o_conv.is_owned = ptr_is_owned(o);
27621         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27622         o_conv = WarningMessage_clone(&o_conv);
27623         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
27624         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
27625         return tag_ptr(ret_conv, true);
27626 }
27627
27628 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
27629         void* e_ptr = untag_ptr(e);
27630         CHECK_ACCESS(e_ptr);
27631         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27632         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27633         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
27634         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
27635         return tag_ptr(ret_conv, true);
27636 }
27637
27638 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
27639         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
27640         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
27641         return ret_conv;
27642 }
27643
27644 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
27645         if (!ptr_is_owned(_res)) return;
27646         void* _res_ptr = untag_ptr(_res);
27647         CHECK_ACCESS(_res_ptr);
27648         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
27649         FREE(untag_ptr(_res));
27650         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
27651 }
27652
27653 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
27654         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
27655         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
27656         return tag_ptr(ret_conv, true);
27657 }
27658 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
27659         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
27660         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
27661         return ret_conv;
27662 }
27663
27664 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
27665         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
27666         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
27667         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
27668         return tag_ptr(ret_conv, true);
27669 }
27670
27671 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
27672         LDKUnsignedNodeAnnouncement o_conv;
27673         o_conv.inner = untag_ptr(o);
27674         o_conv.is_owned = ptr_is_owned(o);
27675         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27676         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
27677         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27678         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
27679         return tag_ptr(ret_conv, true);
27680 }
27681
27682 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
27683         void* e_ptr = untag_ptr(e);
27684         CHECK_ACCESS(e_ptr);
27685         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27686         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27687         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27688         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
27689         return tag_ptr(ret_conv, true);
27690 }
27691
27692 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
27693         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
27694         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
27695         return ret_conv;
27696 }
27697
27698 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
27699         if (!ptr_is_owned(_res)) return;
27700         void* _res_ptr = untag_ptr(_res);
27701         CHECK_ACCESS(_res_ptr);
27702         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
27703         FREE(untag_ptr(_res));
27704         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
27705 }
27706
27707 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
27708         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27709         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
27710         return tag_ptr(ret_conv, true);
27711 }
27712 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
27713         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
27714         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
27715         return ret_conv;
27716 }
27717
27718 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
27719         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
27720         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27721         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
27722         return tag_ptr(ret_conv, true);
27723 }
27724
27725 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
27726         LDKNodeAnnouncement o_conv;
27727         o_conv.inner = untag_ptr(o);
27728         o_conv.is_owned = ptr_is_owned(o);
27729         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27730         o_conv = NodeAnnouncement_clone(&o_conv);
27731         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
27732         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
27733         return tag_ptr(ret_conv, true);
27734 }
27735
27736 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
27737         void* e_ptr = untag_ptr(e);
27738         CHECK_ACCESS(e_ptr);
27739         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27740         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27741         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
27742         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
27743         return tag_ptr(ret_conv, true);
27744 }
27745
27746 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
27747         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
27748         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
27749         return ret_conv;
27750 }
27751
27752 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
27753         if (!ptr_is_owned(_res)) return;
27754         void* _res_ptr = untag_ptr(_res);
27755         CHECK_ACCESS(_res_ptr);
27756         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
27757         FREE(untag_ptr(_res));
27758         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
27759 }
27760
27761 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
27762         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
27763         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
27764         return tag_ptr(ret_conv, true);
27765 }
27766 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
27767         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
27768         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
27769         return ret_conv;
27770 }
27771
27772 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
27773         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
27774         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
27775         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
27776         return tag_ptr(ret_conv, true);
27777 }
27778
27779 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
27780         LDKQueryShortChannelIds o_conv;
27781         o_conv.inner = untag_ptr(o);
27782         o_conv.is_owned = ptr_is_owned(o);
27783         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27784         o_conv = QueryShortChannelIds_clone(&o_conv);
27785         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
27786         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
27787         return tag_ptr(ret_conv, true);
27788 }
27789
27790 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
27791         void* e_ptr = untag_ptr(e);
27792         CHECK_ACCESS(e_ptr);
27793         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27794         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27795         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
27796         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
27797         return tag_ptr(ret_conv, true);
27798 }
27799
27800 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
27801         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
27802         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
27803         return ret_conv;
27804 }
27805
27806 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
27807         if (!ptr_is_owned(_res)) return;
27808         void* _res_ptr = untag_ptr(_res);
27809         CHECK_ACCESS(_res_ptr);
27810         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
27811         FREE(untag_ptr(_res));
27812         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
27813 }
27814
27815 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
27816         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
27817         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
27818         return tag_ptr(ret_conv, true);
27819 }
27820 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
27821         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
27822         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
27823         return ret_conv;
27824 }
27825
27826 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
27827         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
27828         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
27829         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
27830         return tag_ptr(ret_conv, true);
27831 }
27832
27833 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
27834         LDKReplyShortChannelIdsEnd o_conv;
27835         o_conv.inner = untag_ptr(o);
27836         o_conv.is_owned = ptr_is_owned(o);
27837         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27838         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
27839         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
27840         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
27841         return tag_ptr(ret_conv, true);
27842 }
27843
27844 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
27845         void* e_ptr = untag_ptr(e);
27846         CHECK_ACCESS(e_ptr);
27847         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27848         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27849         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
27850         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
27851         return tag_ptr(ret_conv, true);
27852 }
27853
27854 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
27855         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
27856         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
27857         return ret_conv;
27858 }
27859
27860 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
27861         if (!ptr_is_owned(_res)) return;
27862         void* _res_ptr = untag_ptr(_res);
27863         CHECK_ACCESS(_res_ptr);
27864         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
27865         FREE(untag_ptr(_res));
27866         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
27867 }
27868
27869 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
27870         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
27871         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
27872         return tag_ptr(ret_conv, true);
27873 }
27874 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
27875         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
27876         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
27877         return ret_conv;
27878 }
27879
27880 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
27881         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
27882         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
27883         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
27884         return tag_ptr(ret_conv, true);
27885 }
27886
27887 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
27888         LDKQueryChannelRange o_conv;
27889         o_conv.inner = untag_ptr(o);
27890         o_conv.is_owned = ptr_is_owned(o);
27891         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27892         o_conv = QueryChannelRange_clone(&o_conv);
27893         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
27894         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
27895         return tag_ptr(ret_conv, true);
27896 }
27897
27898 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
27899         void* e_ptr = untag_ptr(e);
27900         CHECK_ACCESS(e_ptr);
27901         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27902         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27903         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
27904         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
27905         return tag_ptr(ret_conv, true);
27906 }
27907
27908 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
27909         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
27910         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
27911         return ret_conv;
27912 }
27913
27914 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
27915         if (!ptr_is_owned(_res)) return;
27916         void* _res_ptr = untag_ptr(_res);
27917         CHECK_ACCESS(_res_ptr);
27918         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
27919         FREE(untag_ptr(_res));
27920         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
27921 }
27922
27923 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
27924         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
27925         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
27926         return tag_ptr(ret_conv, true);
27927 }
27928 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
27929         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
27930         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
27931         return ret_conv;
27932 }
27933
27934 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
27935         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
27936         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
27937         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
27938         return tag_ptr(ret_conv, true);
27939 }
27940
27941 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
27942         LDKReplyChannelRange o_conv;
27943         o_conv.inner = untag_ptr(o);
27944         o_conv.is_owned = ptr_is_owned(o);
27945         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27946         o_conv = ReplyChannelRange_clone(&o_conv);
27947         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
27948         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
27949         return tag_ptr(ret_conv, true);
27950 }
27951
27952 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
27953         void* e_ptr = untag_ptr(e);
27954         CHECK_ACCESS(e_ptr);
27955         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27956         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27957         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
27958         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
27959         return tag_ptr(ret_conv, true);
27960 }
27961
27962 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
27963         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
27964         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
27965         return ret_conv;
27966 }
27967
27968 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
27969         if (!ptr_is_owned(_res)) return;
27970         void* _res_ptr = untag_ptr(_res);
27971         CHECK_ACCESS(_res_ptr);
27972         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
27973         FREE(untag_ptr(_res));
27974         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
27975 }
27976
27977 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
27978         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
27979         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
27980         return tag_ptr(ret_conv, true);
27981 }
27982 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
27983         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
27984         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
27985         return ret_conv;
27986 }
27987
27988 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
27989         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
27990         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
27991         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
27992         return tag_ptr(ret_conv, true);
27993 }
27994
27995 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
27996         LDKGossipTimestampFilter o_conv;
27997         o_conv.inner = untag_ptr(o);
27998         o_conv.is_owned = ptr_is_owned(o);
27999         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28000         o_conv = GossipTimestampFilter_clone(&o_conv);
28001         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28002         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
28003         return tag_ptr(ret_conv, true);
28004 }
28005
28006 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
28007         void* e_ptr = untag_ptr(e);
28008         CHECK_ACCESS(e_ptr);
28009         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28010         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28011         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28012         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
28013         return tag_ptr(ret_conv, true);
28014 }
28015
28016 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
28017         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
28018         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
28019         return ret_conv;
28020 }
28021
28022 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
28023         if (!ptr_is_owned(_res)) return;
28024         void* _res_ptr = untag_ptr(_res);
28025         CHECK_ACCESS(_res_ptr);
28026         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
28027         FREE(untag_ptr(_res));
28028         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
28029 }
28030
28031 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
28032         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28033         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
28034         return tag_ptr(ret_conv, true);
28035 }
28036 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
28037         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
28038         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
28039         return ret_conv;
28040 }
28041
28042 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
28043         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
28044         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28045         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
28046         return tag_ptr(ret_conv, true);
28047 }
28048
28049 void  __attribute__((export_name("TS_CVec_PhantomRouteHintsZ_free"))) TS_CVec_PhantomRouteHintsZ_free(uint64_tArray _res) {
28050         LDKCVec_PhantomRouteHintsZ _res_constr;
28051         _res_constr.datalen = _res->arr_len;
28052         if (_res_constr.datalen > 0)
28053                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
28054         else
28055                 _res_constr.data = NULL;
28056         uint64_t* _res_vals = _res->elems;
28057         for (size_t t = 0; t < _res_constr.datalen; t++) {
28058                 uint64_t _res_conv_19 = _res_vals[t];
28059                 LDKPhantomRouteHints _res_conv_19_conv;
28060                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
28061                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
28062                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
28063                 _res_constr.data[t] = _res_conv_19_conv;
28064         }
28065         FREE(_res);
28066         CVec_PhantomRouteHintsZ_free(_res_constr);
28067 }
28068
28069 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
28070         LDKBolt11Invoice o_conv;
28071         o_conv.inner = untag_ptr(o);
28072         o_conv.is_owned = ptr_is_owned(o);
28073         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28074         o_conv = Bolt11Invoice_clone(&o_conv);
28075         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
28076         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
28077         return tag_ptr(ret_conv, true);
28078 }
28079
28080 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err(uint64_t e) {
28081         void* e_ptr = untag_ptr(e);
28082         CHECK_ACCESS(e_ptr);
28083         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
28084         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
28085         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
28086         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
28087         return tag_ptr(ret_conv, true);
28088 }
28089
28090 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
28091         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
28092         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
28093         return ret_conv;
28094 }
28095
28096 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
28097         if (!ptr_is_owned(_res)) return;
28098         void* _res_ptr = untag_ptr(_res);
28099         CHECK_ACCESS(_res_ptr);
28100         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
28101         FREE(untag_ptr(_res));
28102         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
28103 }
28104
28105 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
28106         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
28107         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
28108         return tag_ptr(ret_conv, true);
28109 }
28110 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
28111         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
28112         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
28113         return ret_conv;
28114 }
28115
28116 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
28117         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
28118         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
28119         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
28120         return tag_ptr(ret_conv, true);
28121 }
28122
28123 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_ok"))) TS_CResult_OffersMessageDecodeErrorZ_ok(uint64_t o) {
28124         void* o_ptr = untag_ptr(o);
28125         CHECK_ACCESS(o_ptr);
28126         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
28127         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
28128         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
28129         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
28130         return tag_ptr(ret_conv, true);
28131 }
28132
28133 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_err"))) TS_CResult_OffersMessageDecodeErrorZ_err(uint64_t e) {
28134         void* e_ptr = untag_ptr(e);
28135         CHECK_ACCESS(e_ptr);
28136         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28137         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28138         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
28139         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
28140         return tag_ptr(ret_conv, true);
28141 }
28142
28143 jboolean  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_is_ok"))) TS_CResult_OffersMessageDecodeErrorZ_is_ok(uint64_t o) {
28144         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
28145         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
28146         return ret_conv;
28147 }
28148
28149 void  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_free"))) TS_CResult_OffersMessageDecodeErrorZ_free(uint64_t _res) {
28150         if (!ptr_is_owned(_res)) return;
28151         void* _res_ptr = untag_ptr(_res);
28152         CHECK_ACCESS(_res_ptr);
28153         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
28154         FREE(untag_ptr(_res));
28155         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
28156 }
28157
28158 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
28159         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
28160         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
28161         return tag_ptr(ret_conv, true);
28162 }
28163 int64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OffersMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
28164         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
28165         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
28166         return ret_conv;
28167 }
28168
28169 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone"))) TS_CResult_OffersMessageDecodeErrorZ_clone(uint64_t orig) {
28170         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
28171         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
28172         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
28173         return tag_ptr(ret_conv, true);
28174 }
28175
28176 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_some"))) TS_COption_HTLCClaimZ_some(uint32_t o) {
28177         LDKHTLCClaim o_conv = LDKHTLCClaim_from_js(o);
28178         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
28179         *ret_copy = COption_HTLCClaimZ_some(o_conv);
28180         uint64_t ret_ref = tag_ptr(ret_copy, true);
28181         return ret_ref;
28182 }
28183
28184 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_none"))) TS_COption_HTLCClaimZ_none() {
28185         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
28186         *ret_copy = COption_HTLCClaimZ_none();
28187         uint64_t ret_ref = tag_ptr(ret_copy, true);
28188         return ret_ref;
28189 }
28190
28191 void  __attribute__((export_name("TS_COption_HTLCClaimZ_free"))) TS_COption_HTLCClaimZ_free(uint64_t _res) {
28192         if (!ptr_is_owned(_res)) return;
28193         void* _res_ptr = untag_ptr(_res);
28194         CHECK_ACCESS(_res_ptr);
28195         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
28196         FREE(untag_ptr(_res));
28197         COption_HTLCClaimZ_free(_res_conv);
28198 }
28199
28200 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
28201         LDKCounterpartyCommitmentSecrets o_conv;
28202         o_conv.inner = untag_ptr(o);
28203         o_conv.is_owned = ptr_is_owned(o);
28204         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28205         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
28206         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
28207         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
28208         return tag_ptr(ret_conv, true);
28209 }
28210
28211 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
28212         void* e_ptr = untag_ptr(e);
28213         CHECK_ACCESS(e_ptr);
28214         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28215         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28216         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
28217         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
28218         return tag_ptr(ret_conv, true);
28219 }
28220
28221 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
28222         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
28223         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
28224         return ret_conv;
28225 }
28226
28227 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
28228         if (!ptr_is_owned(_res)) return;
28229         void* _res_ptr = untag_ptr(_res);
28230         CHECK_ACCESS(_res_ptr);
28231         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
28232         FREE(untag_ptr(_res));
28233         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
28234 }
28235
28236 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
28237         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
28238         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
28239         return tag_ptr(ret_conv, true);
28240 }
28241 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
28242         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
28243         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
28244         return ret_conv;
28245 }
28246
28247 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
28248         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
28249         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
28250         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
28251         return tag_ptr(ret_conv, true);
28252 }
28253
28254 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
28255         LDKTxCreationKeys o_conv;
28256         o_conv.inner = untag_ptr(o);
28257         o_conv.is_owned = ptr_is_owned(o);
28258         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28259         o_conv = TxCreationKeys_clone(&o_conv);
28260         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28261         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
28262         return tag_ptr(ret_conv, true);
28263 }
28264
28265 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
28266         void* e_ptr = untag_ptr(e);
28267         CHECK_ACCESS(e_ptr);
28268         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28269         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28270         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28271         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
28272         return tag_ptr(ret_conv, true);
28273 }
28274
28275 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
28276         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
28277         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
28278         return ret_conv;
28279 }
28280
28281 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
28282         if (!ptr_is_owned(_res)) return;
28283         void* _res_ptr = untag_ptr(_res);
28284         CHECK_ACCESS(_res_ptr);
28285         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
28286         FREE(untag_ptr(_res));
28287         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
28288 }
28289
28290 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
28291         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28292         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
28293         return tag_ptr(ret_conv, true);
28294 }
28295 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
28296         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
28297         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
28298         return ret_conv;
28299 }
28300
28301 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
28302         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
28303         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28304         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
28305         return tag_ptr(ret_conv, true);
28306 }
28307
28308 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
28309         LDKChannelPublicKeys o_conv;
28310         o_conv.inner = untag_ptr(o);
28311         o_conv.is_owned = ptr_is_owned(o);
28312         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28313         o_conv = ChannelPublicKeys_clone(&o_conv);
28314         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28315         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
28316         return tag_ptr(ret_conv, true);
28317 }
28318
28319 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
28320         void* e_ptr = untag_ptr(e);
28321         CHECK_ACCESS(e_ptr);
28322         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28323         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28324         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28325         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
28326         return tag_ptr(ret_conv, true);
28327 }
28328
28329 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
28330         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
28331         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
28332         return ret_conv;
28333 }
28334
28335 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
28336         if (!ptr_is_owned(_res)) return;
28337         void* _res_ptr = untag_ptr(_res);
28338         CHECK_ACCESS(_res_ptr);
28339         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
28340         FREE(untag_ptr(_res));
28341         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
28342 }
28343
28344 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
28345         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28346         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
28347         return tag_ptr(ret_conv, true);
28348 }
28349 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
28350         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
28351         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
28352         return ret_conv;
28353 }
28354
28355 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
28356         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
28357         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28358         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
28359         return tag_ptr(ret_conv, true);
28360 }
28361
28362 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
28363         LDKHTLCOutputInCommitment o_conv;
28364         o_conv.inner = untag_ptr(o);
28365         o_conv.is_owned = ptr_is_owned(o);
28366         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28367         o_conv = HTLCOutputInCommitment_clone(&o_conv);
28368         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
28369         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
28370         return tag_ptr(ret_conv, true);
28371 }
28372
28373 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
28374         void* e_ptr = untag_ptr(e);
28375         CHECK_ACCESS(e_ptr);
28376         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28377         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28378         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
28379         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
28380         return tag_ptr(ret_conv, true);
28381 }
28382
28383 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
28384         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
28385         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
28386         return ret_conv;
28387 }
28388
28389 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
28390         if (!ptr_is_owned(_res)) return;
28391         void* _res_ptr = untag_ptr(_res);
28392         CHECK_ACCESS(_res_ptr);
28393         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
28394         FREE(untag_ptr(_res));
28395         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
28396 }
28397
28398 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
28399         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
28400         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
28401         return tag_ptr(ret_conv, true);
28402 }
28403 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
28404         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
28405         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
28406         return ret_conv;
28407 }
28408
28409 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
28410         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
28411         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
28412         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
28413         return tag_ptr(ret_conv, true);
28414 }
28415
28416 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
28417         LDKCounterpartyChannelTransactionParameters o_conv;
28418         o_conv.inner = untag_ptr(o);
28419         o_conv.is_owned = ptr_is_owned(o);
28420         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28421         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
28422         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
28423         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
28424         return tag_ptr(ret_conv, true);
28425 }
28426
28427 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
28428         void* e_ptr = untag_ptr(e);
28429         CHECK_ACCESS(e_ptr);
28430         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28431         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28432         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
28433         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
28434         return tag_ptr(ret_conv, true);
28435 }
28436
28437 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
28438         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
28439         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
28440         return ret_conv;
28441 }
28442
28443 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
28444         if (!ptr_is_owned(_res)) return;
28445         void* _res_ptr = untag_ptr(_res);
28446         CHECK_ACCESS(_res_ptr);
28447         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
28448         FREE(untag_ptr(_res));
28449         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
28450 }
28451
28452 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
28453         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
28454         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
28455         return tag_ptr(ret_conv, true);
28456 }
28457 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
28458         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
28459         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
28460         return ret_conv;
28461 }
28462
28463 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
28464         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
28465         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
28466         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
28467         return tag_ptr(ret_conv, true);
28468 }
28469
28470 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
28471         LDKChannelTransactionParameters o_conv;
28472         o_conv.inner = untag_ptr(o);
28473         o_conv.is_owned = ptr_is_owned(o);
28474         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28475         o_conv = ChannelTransactionParameters_clone(&o_conv);
28476         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
28477         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
28478         return tag_ptr(ret_conv, true);
28479 }
28480
28481 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
28482         void* e_ptr = untag_ptr(e);
28483         CHECK_ACCESS(e_ptr);
28484         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28485         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28486         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
28487         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
28488         return tag_ptr(ret_conv, true);
28489 }
28490
28491 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
28492         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
28493         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
28494         return ret_conv;
28495 }
28496
28497 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
28498         if (!ptr_is_owned(_res)) return;
28499         void* _res_ptr = untag_ptr(_res);
28500         CHECK_ACCESS(_res_ptr);
28501         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
28502         FREE(untag_ptr(_res));
28503         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
28504 }
28505
28506 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
28507         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
28508         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
28509         return tag_ptr(ret_conv, true);
28510 }
28511 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
28512         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
28513         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
28514         return ret_conv;
28515 }
28516
28517 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
28518         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
28519         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
28520         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
28521         return tag_ptr(ret_conv, true);
28522 }
28523
28524 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
28525         LDKHolderCommitmentTransaction o_conv;
28526         o_conv.inner = untag_ptr(o);
28527         o_conv.is_owned = ptr_is_owned(o);
28528         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28529         o_conv = HolderCommitmentTransaction_clone(&o_conv);
28530         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
28531         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
28532         return tag_ptr(ret_conv, true);
28533 }
28534
28535 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
28536         void* e_ptr = untag_ptr(e);
28537         CHECK_ACCESS(e_ptr);
28538         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28539         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28540         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
28541         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
28542         return tag_ptr(ret_conv, true);
28543 }
28544
28545 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
28546         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
28547         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
28548         return ret_conv;
28549 }
28550
28551 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
28552         if (!ptr_is_owned(_res)) return;
28553         void* _res_ptr = untag_ptr(_res);
28554         CHECK_ACCESS(_res_ptr);
28555         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
28556         FREE(untag_ptr(_res));
28557         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
28558 }
28559
28560 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
28561         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
28562         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
28563         return tag_ptr(ret_conv, true);
28564 }
28565 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
28566         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
28567         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
28568         return ret_conv;
28569 }
28570
28571 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
28572         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
28573         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
28574         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
28575         return tag_ptr(ret_conv, true);
28576 }
28577
28578 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
28579         LDKBuiltCommitmentTransaction o_conv;
28580         o_conv.inner = untag_ptr(o);
28581         o_conv.is_owned = ptr_is_owned(o);
28582         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28583         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
28584         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
28585         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
28586         return tag_ptr(ret_conv, true);
28587 }
28588
28589 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
28590         void* e_ptr = untag_ptr(e);
28591         CHECK_ACCESS(e_ptr);
28592         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28593         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28594         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
28595         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
28596         return tag_ptr(ret_conv, true);
28597 }
28598
28599 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
28600         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
28601         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
28602         return ret_conv;
28603 }
28604
28605 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
28606         if (!ptr_is_owned(_res)) return;
28607         void* _res_ptr = untag_ptr(_res);
28608         CHECK_ACCESS(_res_ptr);
28609         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
28610         FREE(untag_ptr(_res));
28611         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
28612 }
28613
28614 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
28615         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
28616         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
28617         return tag_ptr(ret_conv, true);
28618 }
28619 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
28620         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
28621         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
28622         return ret_conv;
28623 }
28624
28625 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
28626         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
28627         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
28628         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
28629         return tag_ptr(ret_conv, true);
28630 }
28631
28632 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
28633         LDKTrustedClosingTransaction o_conv;
28634         o_conv.inner = untag_ptr(o);
28635         o_conv.is_owned = ptr_is_owned(o);
28636         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28637         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
28638         
28639         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
28640         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
28641         return tag_ptr(ret_conv, true);
28642 }
28643
28644 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
28645         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
28646         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
28647         return tag_ptr(ret_conv, true);
28648 }
28649
28650 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
28651         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
28652         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
28653         return ret_conv;
28654 }
28655
28656 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
28657         if (!ptr_is_owned(_res)) return;
28658         void* _res_ptr = untag_ptr(_res);
28659         CHECK_ACCESS(_res_ptr);
28660         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
28661         FREE(untag_ptr(_res));
28662         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
28663 }
28664
28665 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
28666         LDKCommitmentTransaction o_conv;
28667         o_conv.inner = untag_ptr(o);
28668         o_conv.is_owned = ptr_is_owned(o);
28669         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28670         o_conv = CommitmentTransaction_clone(&o_conv);
28671         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
28672         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
28673         return tag_ptr(ret_conv, true);
28674 }
28675
28676 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
28677         void* e_ptr = untag_ptr(e);
28678         CHECK_ACCESS(e_ptr);
28679         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28680         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28681         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
28682         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
28683         return tag_ptr(ret_conv, true);
28684 }
28685
28686 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
28687         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
28688         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
28689         return ret_conv;
28690 }
28691
28692 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
28693         if (!ptr_is_owned(_res)) return;
28694         void* _res_ptr = untag_ptr(_res);
28695         CHECK_ACCESS(_res_ptr);
28696         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
28697         FREE(untag_ptr(_res));
28698         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
28699 }
28700
28701 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
28702         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
28703         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
28704         return tag_ptr(ret_conv, true);
28705 }
28706 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
28707         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
28708         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
28709         return ret_conv;
28710 }
28711
28712 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
28713         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
28714         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
28715         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
28716         return tag_ptr(ret_conv, true);
28717 }
28718
28719 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
28720         LDKTrustedCommitmentTransaction o_conv;
28721         o_conv.inner = untag_ptr(o);
28722         o_conv.is_owned = ptr_is_owned(o);
28723         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28724         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
28725         
28726         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
28727         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
28728         return tag_ptr(ret_conv, true);
28729 }
28730
28731 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
28732         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
28733         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
28734         return tag_ptr(ret_conv, true);
28735 }
28736
28737 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
28738         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
28739         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
28740         return ret_conv;
28741 }
28742
28743 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
28744         if (!ptr_is_owned(_res)) return;
28745         void* _res_ptr = untag_ptr(_res);
28746         CHECK_ACCESS(_res_ptr);
28747         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
28748         FREE(untag_ptr(_res));
28749         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
28750 }
28751
28752 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_ok(ptrArray o) {
28753         LDKCVec_ECDSASignatureZ o_constr;
28754         o_constr.datalen = o->arr_len;
28755         if (o_constr.datalen > 0)
28756                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
28757         else
28758                 o_constr.data = NULL;
28759         int8_tArray* o_vals = (void*) o->elems;
28760         for (size_t m = 0; m < o_constr.datalen; m++) {
28761                 int8_tArray o_conv_12 = o_vals[m];
28762                 LDKECDSASignature o_conv_12_ref;
28763                 CHECK(o_conv_12->arr_len == 64);
28764                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
28765                 o_constr.data[m] = o_conv_12_ref;
28766         }
28767         FREE(o);
28768         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
28769         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
28770         return tag_ptr(ret_conv, true);
28771 }
28772
28773 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_err"))) TS_CResult_CVec_ECDSASignatureZNoneZ_err() {
28774         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
28775         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
28776         return tag_ptr(ret_conv, true);
28777 }
28778
28779 jboolean  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_is_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_is_ok(uint64_t o) {
28780         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
28781         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
28782         return ret_conv;
28783 }
28784
28785 void  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_free"))) TS_CResult_CVec_ECDSASignatureZNoneZ_free(uint64_t _res) {
28786         if (!ptr_is_owned(_res)) return;
28787         void* _res_ptr = untag_ptr(_res);
28788         CHECK_ACCESS(_res_ptr);
28789         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
28790         FREE(untag_ptr(_res));
28791         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
28792 }
28793
28794 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
28795         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
28796         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
28797         return tag_ptr(ret_conv, true);
28798 }
28799 int64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(uint64_t arg) {
28800         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
28801         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
28802         return ret_conv;
28803 }
28804
28805 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_clone"))) TS_CResult_CVec_ECDSASignatureZNoneZ_clone(uint64_t orig) {
28806         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
28807         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
28808         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
28809         return tag_ptr(ret_conv, true);
28810 }
28811
28812 uint64_t  __attribute__((export_name("TS_COption_usizeZ_some"))) TS_COption_usizeZ_some(uint32_t o) {
28813         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
28814         *ret_copy = COption_usizeZ_some(o);
28815         uint64_t ret_ref = tag_ptr(ret_copy, true);
28816         return ret_ref;
28817 }
28818
28819 uint64_t  __attribute__((export_name("TS_COption_usizeZ_none"))) TS_COption_usizeZ_none() {
28820         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
28821         *ret_copy = COption_usizeZ_none();
28822         uint64_t ret_ref = tag_ptr(ret_copy, true);
28823         return ret_ref;
28824 }
28825
28826 void  __attribute__((export_name("TS_COption_usizeZ_free"))) TS_COption_usizeZ_free(uint64_t _res) {
28827         if (!ptr_is_owned(_res)) return;
28828         void* _res_ptr = untag_ptr(_res);
28829         CHECK_ACCESS(_res_ptr);
28830         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
28831         FREE(untag_ptr(_res));
28832         COption_usizeZ_free(_res_conv);
28833 }
28834
28835 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
28836         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
28837         *ret_copy = COption_usizeZ_clone(arg);
28838         uint64_t ret_ref = tag_ptr(ret_copy, true);
28839         return ret_ref;
28840 }
28841 int64_t  __attribute__((export_name("TS_COption_usizeZ_clone_ptr"))) TS_COption_usizeZ_clone_ptr(uint64_t arg) {
28842         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
28843         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
28844         return ret_conv;
28845 }
28846
28847 uint64_t  __attribute__((export_name("TS_COption_usizeZ_clone"))) TS_COption_usizeZ_clone(uint64_t orig) {
28848         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
28849         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
28850         *ret_copy = COption_usizeZ_clone(orig_conv);
28851         uint64_t ret_ref = tag_ptr(ret_copy, true);
28852         return ret_ref;
28853 }
28854
28855 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
28856         LDKShutdownScript o_conv;
28857         o_conv.inner = untag_ptr(o);
28858         o_conv.is_owned = ptr_is_owned(o);
28859         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28860         o_conv = ShutdownScript_clone(&o_conv);
28861         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
28862         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
28863         return tag_ptr(ret_conv, true);
28864 }
28865
28866 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
28867         void* e_ptr = untag_ptr(e);
28868         CHECK_ACCESS(e_ptr);
28869         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28870         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28871         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
28872         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
28873         return tag_ptr(ret_conv, true);
28874 }
28875
28876 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
28877         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
28878         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
28879         return ret_conv;
28880 }
28881
28882 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
28883         if (!ptr_is_owned(_res)) return;
28884         void* _res_ptr = untag_ptr(_res);
28885         CHECK_ACCESS(_res_ptr);
28886         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
28887         FREE(untag_ptr(_res));
28888         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
28889 }
28890
28891 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
28892         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
28893         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
28894         return tag_ptr(ret_conv, true);
28895 }
28896 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
28897         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
28898         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
28899         return ret_conv;
28900 }
28901
28902 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
28903         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
28904         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
28905         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
28906         return tag_ptr(ret_conv, true);
28907 }
28908
28909 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
28910         LDKShutdownScript o_conv;
28911         o_conv.inner = untag_ptr(o);
28912         o_conv.is_owned = ptr_is_owned(o);
28913         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28914         o_conv = ShutdownScript_clone(&o_conv);
28915         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
28916         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
28917         return tag_ptr(ret_conv, true);
28918 }
28919
28920 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
28921         LDKInvalidShutdownScript e_conv;
28922         e_conv.inner = untag_ptr(e);
28923         e_conv.is_owned = ptr_is_owned(e);
28924         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
28925         e_conv = InvalidShutdownScript_clone(&e_conv);
28926         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
28927         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
28928         return tag_ptr(ret_conv, true);
28929 }
28930
28931 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
28932         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
28933         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
28934         return ret_conv;
28935 }
28936
28937 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
28938         if (!ptr_is_owned(_res)) return;
28939         void* _res_ptr = untag_ptr(_res);
28940         CHECK_ACCESS(_res_ptr);
28941         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
28942         FREE(untag_ptr(_res));
28943         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
28944 }
28945
28946 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
28947         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
28948         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
28949         return tag_ptr(ret_conv, true);
28950 }
28951 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
28952         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
28953         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
28954         return ret_conv;
28955 }
28956
28957 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
28958         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
28959         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
28960         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
28961         return tag_ptr(ret_conv, true);
28962 }
28963
28964 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
28965         void* o_ptr = untag_ptr(o);
28966         CHECK_ACCESS(o_ptr);
28967         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
28968         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
28969         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
28970         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
28971         return tag_ptr(ret_conv, true);
28972 }
28973
28974 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
28975         void* e_ptr = untag_ptr(e);
28976         CHECK_ACCESS(e_ptr);
28977         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28978         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28979         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
28980         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
28981         return tag_ptr(ret_conv, true);
28982 }
28983
28984 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
28985         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
28986         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
28987         return ret_conv;
28988 }
28989
28990 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
28991         if (!ptr_is_owned(_res)) return;
28992         void* _res_ptr = untag_ptr(_res);
28993         CHECK_ACCESS(_res_ptr);
28994         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
28995         FREE(untag_ptr(_res));
28996         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
28997 }
28998
28999 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
29000         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
29001         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
29002         return tag_ptr(ret_conv, true);
29003 }
29004 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
29005         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
29006         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
29007         return ret_conv;
29008 }
29009
29010 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
29011         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
29012         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
29013         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
29014         return tag_ptr(ret_conv, true);
29015 }
29016
29017 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_ok(uint64_t o) {
29018         LDKClaimedHTLC o_conv;
29019         o_conv.inner = untag_ptr(o);
29020         o_conv.is_owned = ptr_is_owned(o);
29021         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29022         o_conv = ClaimedHTLC_clone(&o_conv);
29023         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
29024         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
29025         return tag_ptr(ret_conv, true);
29026 }
29027
29028 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_err"))) TS_CResult_ClaimedHTLCDecodeErrorZ_err(uint64_t e) {
29029         void* e_ptr = untag_ptr(e);
29030         CHECK_ACCESS(e_ptr);
29031         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29032         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29033         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
29034         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
29035         return tag_ptr(ret_conv, true);
29036 }
29037
29038 jboolean  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_is_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_is_ok(uint64_t o) {
29039         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
29040         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
29041         return ret_conv;
29042 }
29043
29044 void  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_free"))) TS_CResult_ClaimedHTLCDecodeErrorZ_free(uint64_t _res) {
29045         if (!ptr_is_owned(_res)) return;
29046         void* _res_ptr = untag_ptr(_res);
29047         CHECK_ACCESS(_res_ptr);
29048         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
29049         FREE(untag_ptr(_res));
29050         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
29051 }
29052
29053 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
29054         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
29055         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
29056         return tag_ptr(ret_conv, true);
29057 }
29058 int64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
29059         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
29060         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
29061         return ret_conv;
29062 }
29063
29064 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_clone"))) TS_CResult_ClaimedHTLCDecodeErrorZ_clone(uint64_t orig) {
29065         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
29066         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
29067         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
29068         return tag_ptr(ret_conv, true);
29069 }
29070
29071 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_some"))) TS_COption_PathFailureZ_some(uint64_t o) {
29072         void* o_ptr = untag_ptr(o);
29073         CHECK_ACCESS(o_ptr);
29074         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
29075         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
29076         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
29077         *ret_copy = COption_PathFailureZ_some(o_conv);
29078         uint64_t ret_ref = tag_ptr(ret_copy, true);
29079         return ret_ref;
29080 }
29081
29082 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_none"))) TS_COption_PathFailureZ_none() {
29083         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
29084         *ret_copy = COption_PathFailureZ_none();
29085         uint64_t ret_ref = tag_ptr(ret_copy, true);
29086         return ret_ref;
29087 }
29088
29089 void  __attribute__((export_name("TS_COption_PathFailureZ_free"))) TS_COption_PathFailureZ_free(uint64_t _res) {
29090         if (!ptr_is_owned(_res)) return;
29091         void* _res_ptr = untag_ptr(_res);
29092         CHECK_ACCESS(_res_ptr);
29093         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
29094         FREE(untag_ptr(_res));
29095         COption_PathFailureZ_free(_res_conv);
29096 }
29097
29098 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
29099         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
29100         *ret_copy = COption_PathFailureZ_clone(arg);
29101         uint64_t ret_ref = tag_ptr(ret_copy, true);
29102         return ret_ref;
29103 }
29104 int64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone_ptr"))) TS_COption_PathFailureZ_clone_ptr(uint64_t arg) {
29105         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
29106         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
29107         return ret_conv;
29108 }
29109
29110 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone"))) TS_COption_PathFailureZ_clone(uint64_t orig) {
29111         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
29112         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
29113         *ret_copy = COption_PathFailureZ_clone(orig_conv);
29114         uint64_t ret_ref = tag_ptr(ret_copy, true);
29115         return ret_ref;
29116 }
29117
29118 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_ok(uint64_t o) {
29119         void* o_ptr = untag_ptr(o);
29120         CHECK_ACCESS(o_ptr);
29121         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
29122         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
29123         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
29124         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
29125         return tag_ptr(ret_conv, true);
29126 }
29127
29128 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_err(uint64_t e) {
29129         void* e_ptr = untag_ptr(e);
29130         CHECK_ACCESS(e_ptr);
29131         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29132         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29133         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
29134         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
29135         return tag_ptr(ret_conv, true);
29136 }
29137
29138 jboolean  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok(uint64_t o) {
29139         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
29140         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
29141         return ret_conv;
29142 }
29143
29144 void  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_free"))) TS_CResult_COption_PathFailureZDecodeErrorZ_free(uint64_t _res) {
29145         if (!ptr_is_owned(_res)) return;
29146         void* _res_ptr = untag_ptr(_res);
29147         CHECK_ACCESS(_res_ptr);
29148         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
29149         FREE(untag_ptr(_res));
29150         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
29151 }
29152
29153 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
29154         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
29155         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
29156         return tag_ptr(ret_conv, true);
29157 }
29158 int64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(uint64_t arg) {
29159         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
29160         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
29161         return ret_conv;
29162 }
29163
29164 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone(uint64_t orig) {
29165         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
29166         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
29167         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
29168         return tag_ptr(ret_conv, true);
29169 }
29170
29171 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
29172         void* o_ptr = untag_ptr(o);
29173         CHECK_ACCESS(o_ptr);
29174         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
29175         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
29176         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
29177         *ret_copy = COption_ClosureReasonZ_some(o_conv);
29178         uint64_t ret_ref = tag_ptr(ret_copy, true);
29179         return ret_ref;
29180 }
29181
29182 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
29183         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
29184         *ret_copy = COption_ClosureReasonZ_none();
29185         uint64_t ret_ref = tag_ptr(ret_copy, true);
29186         return ret_ref;
29187 }
29188
29189 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
29190         if (!ptr_is_owned(_res)) return;
29191         void* _res_ptr = untag_ptr(_res);
29192         CHECK_ACCESS(_res_ptr);
29193         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
29194         FREE(untag_ptr(_res));
29195         COption_ClosureReasonZ_free(_res_conv);
29196 }
29197
29198 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
29199         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
29200         *ret_copy = COption_ClosureReasonZ_clone(arg);
29201         uint64_t ret_ref = tag_ptr(ret_copy, true);
29202         return ret_ref;
29203 }
29204 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
29205         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
29206         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
29207         return ret_conv;
29208 }
29209
29210 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
29211         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
29212         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
29213         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
29214         uint64_t ret_ref = tag_ptr(ret_copy, true);
29215         return ret_ref;
29216 }
29217
29218 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
29219         void* o_ptr = untag_ptr(o);
29220         CHECK_ACCESS(o_ptr);
29221         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
29222         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
29223         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
29224         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
29225         return tag_ptr(ret_conv, true);
29226 }
29227
29228 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
29229         void* e_ptr = untag_ptr(e);
29230         CHECK_ACCESS(e_ptr);
29231         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29232         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29233         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
29234         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
29235         return tag_ptr(ret_conv, true);
29236 }
29237
29238 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
29239         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
29240         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
29241         return ret_conv;
29242 }
29243
29244 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
29245         if (!ptr_is_owned(_res)) return;
29246         void* _res_ptr = untag_ptr(_res);
29247         CHECK_ACCESS(_res_ptr);
29248         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
29249         FREE(untag_ptr(_res));
29250         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
29251 }
29252
29253 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
29254         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
29255         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
29256         return tag_ptr(ret_conv, true);
29257 }
29258 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
29259         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
29260         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
29261         return ret_conv;
29262 }
29263
29264 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
29265         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
29266         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
29267         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
29268         return tag_ptr(ret_conv, true);
29269 }
29270
29271 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
29272         void* o_ptr = untag_ptr(o);
29273         CHECK_ACCESS(o_ptr);
29274         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
29275         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
29276         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
29277         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
29278         uint64_t ret_ref = tag_ptr(ret_copy, true);
29279         return ret_ref;
29280 }
29281
29282 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
29283         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
29284         *ret_copy = COption_HTLCDestinationZ_none();
29285         uint64_t ret_ref = tag_ptr(ret_copy, true);
29286         return ret_ref;
29287 }
29288
29289 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
29290         if (!ptr_is_owned(_res)) return;
29291         void* _res_ptr = untag_ptr(_res);
29292         CHECK_ACCESS(_res_ptr);
29293         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
29294         FREE(untag_ptr(_res));
29295         COption_HTLCDestinationZ_free(_res_conv);
29296 }
29297
29298 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
29299         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
29300         *ret_copy = COption_HTLCDestinationZ_clone(arg);
29301         uint64_t ret_ref = tag_ptr(ret_copy, true);
29302         return ret_ref;
29303 }
29304 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
29305         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
29306         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
29307         return ret_conv;
29308 }
29309
29310 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
29311         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
29312         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
29313         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
29314         uint64_t ret_ref = tag_ptr(ret_copy, true);
29315         return ret_ref;
29316 }
29317
29318 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
29319         void* o_ptr = untag_ptr(o);
29320         CHECK_ACCESS(o_ptr);
29321         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
29322         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
29323         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
29324         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
29325         return tag_ptr(ret_conv, true);
29326 }
29327
29328 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
29329         void* e_ptr = untag_ptr(e);
29330         CHECK_ACCESS(e_ptr);
29331         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29332         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29333         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
29334         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
29335         return tag_ptr(ret_conv, true);
29336 }
29337
29338 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
29339         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
29340         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
29341         return ret_conv;
29342 }
29343
29344 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
29345         if (!ptr_is_owned(_res)) return;
29346         void* _res_ptr = untag_ptr(_res);
29347         CHECK_ACCESS(_res_ptr);
29348         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
29349         FREE(untag_ptr(_res));
29350         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
29351 }
29352
29353 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
29354         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
29355         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
29356         return tag_ptr(ret_conv, true);
29357 }
29358 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
29359         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
29360         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
29361         return ret_conv;
29362 }
29363
29364 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
29365         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
29366         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
29367         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
29368         return tag_ptr(ret_conv, true);
29369 }
29370
29371 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_ok(uint32_t o) {
29372         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
29373         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
29374         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
29375         return tag_ptr(ret_conv, true);
29376 }
29377
29378 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_err(uint64_t e) {
29379         void* e_ptr = untag_ptr(e);
29380         CHECK_ACCESS(e_ptr);
29381         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29382         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29383         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
29384         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
29385         return tag_ptr(ret_conv, true);
29386 }
29387
29388 jboolean  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok(uint64_t o) {
29389         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
29390         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
29391         return ret_conv;
29392 }
29393
29394 void  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_free"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_free(uint64_t _res) {
29395         if (!ptr_is_owned(_res)) return;
29396         void* _res_ptr = untag_ptr(_res);
29397         CHECK_ACCESS(_res_ptr);
29398         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
29399         FREE(untag_ptr(_res));
29400         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
29401 }
29402
29403 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
29404         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
29405         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
29406         return tag_ptr(ret_conv, true);
29407 }
29408 int64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(uint64_t arg) {
29409         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
29410         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
29411         return ret_conv;
29412 }
29413
29414 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone(uint64_t orig) {
29415         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
29416         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
29417         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
29418         return tag_ptr(ret_conv, true);
29419 }
29420
29421 uint64_t  __attribute__((export_name("TS_COption_U128Z_some"))) TS_COption_U128Z_some(int8_tArray o) {
29422         LDKU128 o_ref;
29423         CHECK(o->arr_len == 16);
29424         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
29425         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
29426         *ret_copy = COption_U128Z_some(o_ref);
29427         uint64_t ret_ref = tag_ptr(ret_copy, true);
29428         return ret_ref;
29429 }
29430
29431 uint64_t  __attribute__((export_name("TS_COption_U128Z_none"))) TS_COption_U128Z_none() {
29432         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
29433         *ret_copy = COption_U128Z_none();
29434         uint64_t ret_ref = tag_ptr(ret_copy, true);
29435         return ret_ref;
29436 }
29437
29438 void  __attribute__((export_name("TS_COption_U128Z_free"))) TS_COption_U128Z_free(uint64_t _res) {
29439         if (!ptr_is_owned(_res)) return;
29440         void* _res_ptr = untag_ptr(_res);
29441         CHECK_ACCESS(_res_ptr);
29442         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
29443         FREE(untag_ptr(_res));
29444         COption_U128Z_free(_res_conv);
29445 }
29446
29447 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
29448         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
29449         *ret_copy = COption_U128Z_clone(arg);
29450         uint64_t ret_ref = tag_ptr(ret_copy, true);
29451         return ret_ref;
29452 }
29453 int64_t  __attribute__((export_name("TS_COption_U128Z_clone_ptr"))) TS_COption_U128Z_clone_ptr(uint64_t arg) {
29454         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
29455         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
29456         return ret_conv;
29457 }
29458
29459 uint64_t  __attribute__((export_name("TS_COption_U128Z_clone"))) TS_COption_U128Z_clone(uint64_t orig) {
29460         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
29461         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
29462         *ret_copy = COption_U128Z_clone(orig_conv);
29463         uint64_t ret_ref = tag_ptr(ret_copy, true);
29464         return ret_ref;
29465 }
29466
29467 void  __attribute__((export_name("TS_CVec_ClaimedHTLCZ_free"))) TS_CVec_ClaimedHTLCZ_free(uint64_tArray _res) {
29468         LDKCVec_ClaimedHTLCZ _res_constr;
29469         _res_constr.datalen = _res->arr_len;
29470         if (_res_constr.datalen > 0)
29471                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
29472         else
29473                 _res_constr.data = NULL;
29474         uint64_t* _res_vals = _res->elems;
29475         for (size_t n = 0; n < _res_constr.datalen; n++) {
29476                 uint64_t _res_conv_13 = _res_vals[n];
29477                 LDKClaimedHTLC _res_conv_13_conv;
29478                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
29479                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
29480                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
29481                 _res_constr.data[n] = _res_conv_13_conv;
29482         }
29483         FREE(_res);
29484         CVec_ClaimedHTLCZ_free(_res_constr);
29485 }
29486
29487 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_some"))) TS_COption_PaymentFailureReasonZ_some(uint32_t o) {
29488         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
29489         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
29490         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
29491         uint64_t ret_ref = tag_ptr(ret_copy, true);
29492         return ret_ref;
29493 }
29494
29495 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_none"))) TS_COption_PaymentFailureReasonZ_none() {
29496         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
29497         *ret_copy = COption_PaymentFailureReasonZ_none();
29498         uint64_t ret_ref = tag_ptr(ret_copy, true);
29499         return ret_ref;
29500 }
29501
29502 void  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_free"))) TS_COption_PaymentFailureReasonZ_free(uint64_t _res) {
29503         if (!ptr_is_owned(_res)) return;
29504         void* _res_ptr = untag_ptr(_res);
29505         CHECK_ACCESS(_res_ptr);
29506         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
29507         FREE(untag_ptr(_res));
29508         COption_PaymentFailureReasonZ_free(_res_conv);
29509 }
29510
29511 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
29512         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
29513         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
29514         uint64_t ret_ref = tag_ptr(ret_copy, true);
29515         return ret_ref;
29516 }
29517 int64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone_ptr"))) TS_COption_PaymentFailureReasonZ_clone_ptr(uint64_t arg) {
29518         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
29519         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
29520         return ret_conv;
29521 }
29522
29523 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone"))) TS_COption_PaymentFailureReasonZ_clone(uint64_t orig) {
29524         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
29525         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
29526         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
29527         uint64_t ret_ref = tag_ptr(ret_copy, true);
29528         return ret_ref;
29529 }
29530
29531 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
29532         void* o_ptr = untag_ptr(o);
29533         CHECK_ACCESS(o_ptr);
29534         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
29535         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
29536         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
29537         *ret_copy = COption_EventZ_some(o_conv);
29538         uint64_t ret_ref = tag_ptr(ret_copy, true);
29539         return ret_ref;
29540 }
29541
29542 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
29543         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
29544         *ret_copy = COption_EventZ_none();
29545         uint64_t ret_ref = tag_ptr(ret_copy, true);
29546         return ret_ref;
29547 }
29548
29549 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
29550         if (!ptr_is_owned(_res)) return;
29551         void* _res_ptr = untag_ptr(_res);
29552         CHECK_ACCESS(_res_ptr);
29553         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
29554         FREE(untag_ptr(_res));
29555         COption_EventZ_free(_res_conv);
29556 }
29557
29558 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
29559         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
29560         *ret_copy = COption_EventZ_clone(arg);
29561         uint64_t ret_ref = tag_ptr(ret_copy, true);
29562         return ret_ref;
29563 }
29564 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
29565         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
29566         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
29567         return ret_conv;
29568 }
29569
29570 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
29571         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
29572         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
29573         *ret_copy = COption_EventZ_clone(orig_conv);
29574         uint64_t ret_ref = tag_ptr(ret_copy, true);
29575         return ret_ref;
29576 }
29577
29578 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
29579         void* o_ptr = untag_ptr(o);
29580         CHECK_ACCESS(o_ptr);
29581         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
29582         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
29583         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
29584         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
29585         return tag_ptr(ret_conv, true);
29586 }
29587
29588 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
29589         void* e_ptr = untag_ptr(e);
29590         CHECK_ACCESS(e_ptr);
29591         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29592         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29593         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
29594         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
29595         return tag_ptr(ret_conv, true);
29596 }
29597
29598 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
29599         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
29600         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
29601         return ret_conv;
29602 }
29603
29604 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
29605         if (!ptr_is_owned(_res)) return;
29606         void* _res_ptr = untag_ptr(_res);
29607         CHECK_ACCESS(_res_ptr);
29608         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
29609         FREE(untag_ptr(_res));
29610         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
29611 }
29612
29613 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
29614         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
29615         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
29616         return tag_ptr(ret_conv, true);
29617 }
29618 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
29619         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
29620         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
29621         return ret_conv;
29622 }
29623
29624 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
29625         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
29626         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
29627         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
29628         return tag_ptr(ret_conv, true);
29629 }
29630
29631 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_ok(uint32_t o) {
29632         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
29633         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
29634         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
29635         return tag_ptr(ret_conv, true);
29636 }
29637
29638 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_err(uint64_t e) {
29639         void* e_ptr = untag_ptr(e);
29640         CHECK_ACCESS(e_ptr);
29641         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
29642         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
29643         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
29644         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
29645         return tag_ptr(ret_conv, true);
29646 }
29647
29648 jboolean  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok(uint64_t o) {
29649         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
29650         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
29651         return ret_conv;
29652 }
29653
29654 void  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_free"))) TS_CResult_SiPrefixBolt11ParseErrorZ_free(uint64_t _res) {
29655         if (!ptr_is_owned(_res)) return;
29656         void* _res_ptr = untag_ptr(_res);
29657         CHECK_ACCESS(_res_ptr);
29658         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
29659         FREE(untag_ptr(_res));
29660         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
29661 }
29662
29663 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
29664         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
29665         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
29666         return tag_ptr(ret_conv, true);
29667 }
29668 int64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
29669         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
29670         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
29671         return ret_conv;
29672 }
29673
29674 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone(uint64_t orig) {
29675         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
29676         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
29677         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
29678         return tag_ptr(ret_conv, true);
29679 }
29680
29681 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
29682         LDKBolt11Invoice o_conv;
29683         o_conv.inner = untag_ptr(o);
29684         o_conv.is_owned = ptr_is_owned(o);
29685         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29686         o_conv = Bolt11Invoice_clone(&o_conv);
29687         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
29688         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
29689         return tag_ptr(ret_conv, true);
29690 }
29691
29692 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
29693         void* e_ptr = untag_ptr(e);
29694         CHECK_ACCESS(e_ptr);
29695         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
29696         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
29697         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
29698         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
29699         return tag_ptr(ret_conv, true);
29700 }
29701
29702 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
29703         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
29704         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
29705         return ret_conv;
29706 }
29707
29708 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
29709         if (!ptr_is_owned(_res)) return;
29710         void* _res_ptr = untag_ptr(_res);
29711         CHECK_ACCESS(_res_ptr);
29712         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
29713         FREE(untag_ptr(_res));
29714         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
29715 }
29716
29717 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
29718         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
29719         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
29720         return tag_ptr(ret_conv, true);
29721 }
29722 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
29723         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
29724         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
29725         return ret_conv;
29726 }
29727
29728 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
29729         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
29730         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
29731         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
29732         return tag_ptr(ret_conv, true);
29733 }
29734
29735 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(uint64_t o) {
29736         LDKSignedRawBolt11Invoice o_conv;
29737         o_conv.inner = untag_ptr(o);
29738         o_conv.is_owned = ptr_is_owned(o);
29739         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29740         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
29741         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
29742         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
29743         return tag_ptr(ret_conv, true);
29744 }
29745
29746 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(uint64_t e) {
29747         void* e_ptr = untag_ptr(e);
29748         CHECK_ACCESS(e_ptr);
29749         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
29750         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
29751         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
29752         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
29753         return tag_ptr(ret_conv, true);
29754 }
29755
29756 jboolean  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(uint64_t o) {
29757         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
29758         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
29759         return ret_conv;
29760 }
29761
29762 void  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(uint64_t _res) {
29763         if (!ptr_is_owned(_res)) return;
29764         void* _res_ptr = untag_ptr(_res);
29765         CHECK_ACCESS(_res_ptr);
29766         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
29767         FREE(untag_ptr(_res));
29768         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
29769 }
29770
29771 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
29772         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
29773         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
29774         return tag_ptr(ret_conv, true);
29775 }
29776 int64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
29777         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
29778         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
29779         return ret_conv;
29780 }
29781
29782 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(uint64_t orig) {
29783         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
29784         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
29785         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
29786         return tag_ptr(ret_conv, true);
29787 }
29788
29789 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
29790         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
29791         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
29792         return tag_ptr(ret_conv, true);
29793 }
29794 int64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(uint64_t arg) {
29795         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
29796         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
29797         return ret_conv;
29798 }
29799
29800 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(uint64_t orig) {
29801         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
29802         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
29803         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
29804         return tag_ptr(ret_conv, true);
29805 }
29806
29807 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
29808         LDKRawBolt11Invoice a_conv;
29809         a_conv.inner = untag_ptr(a);
29810         a_conv.is_owned = ptr_is_owned(a);
29811         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29812         a_conv = RawBolt11Invoice_clone(&a_conv);
29813         LDKThirtyTwoBytes b_ref;
29814         CHECK(b->arr_len == 32);
29815         memcpy(b_ref.data, b->elems, 32); FREE(b);
29816         LDKBolt11InvoiceSignature c_conv;
29817         c_conv.inner = untag_ptr(c);
29818         c_conv.is_owned = ptr_is_owned(c);
29819         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
29820         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
29821         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
29822         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
29823         return tag_ptr(ret_conv, true);
29824 }
29825
29826 void  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(uint64_t _res) {
29827         if (!ptr_is_owned(_res)) return;
29828         void* _res_ptr = untag_ptr(_res);
29829         CHECK_ACCESS(_res_ptr);
29830         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
29831         FREE(untag_ptr(_res));
29832         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
29833 }
29834
29835 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_ok(uint64_t o) {
29836         LDKPayeePubKey o_conv;
29837         o_conv.inner = untag_ptr(o);
29838         o_conv.is_owned = ptr_is_owned(o);
29839         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29840         o_conv = PayeePubKey_clone(&o_conv);
29841         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
29842         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
29843         return tag_ptr(ret_conv, true);
29844 }
29845
29846 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_err"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_err(uint32_t e) {
29847         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
29848         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
29849         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
29850         return tag_ptr(ret_conv, true);
29851 }
29852
29853 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_is_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_is_ok(uint64_t o) {
29854         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
29855         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
29856         return ret_conv;
29857 }
29858
29859 void  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_free"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_free(uint64_t _res) {
29860         if (!ptr_is_owned(_res)) return;
29861         void* _res_ptr = untag_ptr(_res);
29862         CHECK_ACCESS(_res_ptr);
29863         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
29864         FREE(untag_ptr(_res));
29865         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
29866 }
29867
29868 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
29869         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
29870         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
29871         return tag_ptr(ret_conv, true);
29872 }
29873 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(uint64_t arg) {
29874         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
29875         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
29876         return ret_conv;
29877 }
29878
29879 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_clone"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_clone(uint64_t orig) {
29880         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
29881         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
29882         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
29883         return tag_ptr(ret_conv, true);
29884 }
29885
29886 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
29887         LDKCVec_PrivateRouteZ _res_constr;
29888         _res_constr.datalen = _res->arr_len;
29889         if (_res_constr.datalen > 0)
29890                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
29891         else
29892                 _res_constr.data = NULL;
29893         uint64_t* _res_vals = _res->elems;
29894         for (size_t o = 0; o < _res_constr.datalen; o++) {
29895                 uint64_t _res_conv_14 = _res_vals[o];
29896                 LDKPrivateRoute _res_conv_14_conv;
29897                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
29898                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
29899                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
29900                 _res_constr.data[o] = _res_conv_14_conv;
29901         }
29902         FREE(_res);
29903         CVec_PrivateRouteZ_free(_res_constr);
29904 }
29905
29906 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
29907         LDKPositiveTimestamp o_conv;
29908         o_conv.inner = untag_ptr(o);
29909         o_conv.is_owned = ptr_is_owned(o);
29910         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29911         o_conv = PositiveTimestamp_clone(&o_conv);
29912         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
29913         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
29914         return tag_ptr(ret_conv, true);
29915 }
29916
29917 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
29918         LDKCreationError e_conv = LDKCreationError_from_js(e);
29919         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
29920         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
29921         return tag_ptr(ret_conv, true);
29922 }
29923
29924 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
29925         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
29926         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
29927         return ret_conv;
29928 }
29929
29930 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
29931         if (!ptr_is_owned(_res)) return;
29932         void* _res_ptr = untag_ptr(_res);
29933         CHECK_ACCESS(_res_ptr);
29934         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
29935         FREE(untag_ptr(_res));
29936         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
29937 }
29938
29939 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
29940         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
29941         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
29942         return tag_ptr(ret_conv, true);
29943 }
29944 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
29945         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
29946         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
29947         return ret_conv;
29948 }
29949
29950 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
29951         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
29952         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
29953         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
29954         return tag_ptr(ret_conv, true);
29955 }
29956
29957 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_ok() {
29958         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
29959         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
29960         return tag_ptr(ret_conv, true);
29961 }
29962
29963 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_err"))) TS_CResult_NoneBolt11SemanticErrorZ_err(uint32_t e) {
29964         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
29965         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
29966         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
29967         return tag_ptr(ret_conv, true);
29968 }
29969
29970 jboolean  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_is_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_is_ok(uint64_t o) {
29971         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
29972         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
29973         return ret_conv;
29974 }
29975
29976 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_free"))) TS_CResult_NoneBolt11SemanticErrorZ_free(uint64_t _res) {
29977         if (!ptr_is_owned(_res)) return;
29978         void* _res_ptr = untag_ptr(_res);
29979         CHECK_ACCESS(_res_ptr);
29980         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
29981         FREE(untag_ptr(_res));
29982         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
29983 }
29984
29985 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
29986         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
29987         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
29988         return tag_ptr(ret_conv, true);
29989 }
29990 int64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
29991         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
29992         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
29993         return ret_conv;
29994 }
29995
29996 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone"))) TS_CResult_NoneBolt11SemanticErrorZ_clone(uint64_t orig) {
29997         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
29998         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
29999         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
30000         return tag_ptr(ret_conv, true);
30001 }
30002
30003 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(uint64_t o) {
30004         LDKBolt11Invoice o_conv;
30005         o_conv.inner = untag_ptr(o);
30006         o_conv.is_owned = ptr_is_owned(o);
30007         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30008         o_conv = Bolt11Invoice_clone(&o_conv);
30009         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
30010         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
30011         return tag_ptr(ret_conv, true);
30012 }
30013
30014 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(uint32_t e) {
30015         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
30016         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
30017         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
30018         return tag_ptr(ret_conv, true);
30019 }
30020
30021 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(uint64_t o) {
30022         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
30023         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
30024         return ret_conv;
30025 }
30026
30027 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(uint64_t _res) {
30028         if (!ptr_is_owned(_res)) return;
30029         void* _res_ptr = untag_ptr(_res);
30030         CHECK_ACCESS(_res_ptr);
30031         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
30032         FREE(untag_ptr(_res));
30033         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
30034 }
30035
30036 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
30037         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
30038         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
30039         return tag_ptr(ret_conv, true);
30040 }
30041 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
30042         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
30043         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
30044         return ret_conv;
30045 }
30046
30047 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(uint64_t orig) {
30048         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
30049         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
30050         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
30051         return tag_ptr(ret_conv, true);
30052 }
30053
30054 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
30055         LDKDescription o_conv;
30056         o_conv.inner = untag_ptr(o);
30057         o_conv.is_owned = ptr_is_owned(o);
30058         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30059         o_conv = Description_clone(&o_conv);
30060         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
30061         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
30062         return tag_ptr(ret_conv, true);
30063 }
30064
30065 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
30066         LDKCreationError e_conv = LDKCreationError_from_js(e);
30067         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
30068         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
30069         return tag_ptr(ret_conv, true);
30070 }
30071
30072 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
30073         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
30074         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
30075         return ret_conv;
30076 }
30077
30078 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
30079         if (!ptr_is_owned(_res)) return;
30080         void* _res_ptr = untag_ptr(_res);
30081         CHECK_ACCESS(_res_ptr);
30082         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
30083         FREE(untag_ptr(_res));
30084         CResult_DescriptionCreationErrorZ_free(_res_conv);
30085 }
30086
30087 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
30088         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
30089         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
30090         return tag_ptr(ret_conv, true);
30091 }
30092 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
30093         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
30094         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
30095         return ret_conv;
30096 }
30097
30098 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
30099         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
30100         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
30101         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
30102         return tag_ptr(ret_conv, true);
30103 }
30104
30105 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
30106         LDKPrivateRoute o_conv;
30107         o_conv.inner = untag_ptr(o);
30108         o_conv.is_owned = ptr_is_owned(o);
30109         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30110         o_conv = PrivateRoute_clone(&o_conv);
30111         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
30112         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
30113         return tag_ptr(ret_conv, true);
30114 }
30115
30116 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
30117         LDKCreationError e_conv = LDKCreationError_from_js(e);
30118         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
30119         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
30120         return tag_ptr(ret_conv, true);
30121 }
30122
30123 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
30124         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
30125         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
30126         return ret_conv;
30127 }
30128
30129 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
30130         if (!ptr_is_owned(_res)) return;
30131         void* _res_ptr = untag_ptr(_res);
30132         CHECK_ACCESS(_res_ptr);
30133         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
30134         FREE(untag_ptr(_res));
30135         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
30136 }
30137
30138 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
30139         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
30140         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
30141         return tag_ptr(ret_conv, true);
30142 }
30143 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
30144         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
30145         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
30146         return ret_conv;
30147 }
30148
30149 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
30150         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
30151         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
30152         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
30153         return tag_ptr(ret_conv, true);
30154 }
30155
30156 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
30157         LDKOutPoint o_conv;
30158         o_conv.inner = untag_ptr(o);
30159         o_conv.is_owned = ptr_is_owned(o);
30160         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30161         o_conv = OutPoint_clone(&o_conv);
30162         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
30163         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
30164         return tag_ptr(ret_conv, true);
30165 }
30166
30167 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
30168         void* e_ptr = untag_ptr(e);
30169         CHECK_ACCESS(e_ptr);
30170         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30171         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30172         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
30173         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
30174         return tag_ptr(ret_conv, true);
30175 }
30176
30177 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
30178         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
30179         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
30180         return ret_conv;
30181 }
30182
30183 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
30184         if (!ptr_is_owned(_res)) return;
30185         void* _res_ptr = untag_ptr(_res);
30186         CHECK_ACCESS(_res_ptr);
30187         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
30188         FREE(untag_ptr(_res));
30189         CResult_OutPointDecodeErrorZ_free(_res_conv);
30190 }
30191
30192 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
30193         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
30194         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
30195         return tag_ptr(ret_conv, true);
30196 }
30197 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
30198         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
30199         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
30200         return ret_conv;
30201 }
30202
30203 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
30204         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
30205         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
30206         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
30207         return tag_ptr(ret_conv, true);
30208 }
30209
30210 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_ok"))) TS_CResult_BigSizeDecodeErrorZ_ok(uint64_t o) {
30211         LDKBigSize o_conv;
30212         o_conv.inner = untag_ptr(o);
30213         o_conv.is_owned = ptr_is_owned(o);
30214         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30215         o_conv = BigSize_clone(&o_conv);
30216         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
30217         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
30218         return tag_ptr(ret_conv, true);
30219 }
30220
30221 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_err"))) TS_CResult_BigSizeDecodeErrorZ_err(uint64_t e) {
30222         void* e_ptr = untag_ptr(e);
30223         CHECK_ACCESS(e_ptr);
30224         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30225         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30226         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
30227         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
30228         return tag_ptr(ret_conv, true);
30229 }
30230
30231 jboolean  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_is_ok"))) TS_CResult_BigSizeDecodeErrorZ_is_ok(uint64_t o) {
30232         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
30233         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
30234         return ret_conv;
30235 }
30236
30237 void  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_free"))) TS_CResult_BigSizeDecodeErrorZ_free(uint64_t _res) {
30238         if (!ptr_is_owned(_res)) return;
30239         void* _res_ptr = untag_ptr(_res);
30240         CHECK_ACCESS(_res_ptr);
30241         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
30242         FREE(untag_ptr(_res));
30243         CResult_BigSizeDecodeErrorZ_free(_res_conv);
30244 }
30245
30246 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
30247         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
30248         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
30249         return tag_ptr(ret_conv, true);
30250 }
30251 int64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone_ptr"))) TS_CResult_BigSizeDecodeErrorZ_clone_ptr(uint64_t arg) {
30252         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
30253         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
30254         return ret_conv;
30255 }
30256
30257 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone"))) TS_CResult_BigSizeDecodeErrorZ_clone(uint64_t orig) {
30258         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
30259         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
30260         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
30261         return tag_ptr(ret_conv, true);
30262 }
30263
30264 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_ok"))) TS_CResult_HostnameDecodeErrorZ_ok(uint64_t o) {
30265         LDKHostname o_conv;
30266         o_conv.inner = untag_ptr(o);
30267         o_conv.is_owned = ptr_is_owned(o);
30268         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30269         o_conv = Hostname_clone(&o_conv);
30270         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
30271         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
30272         return tag_ptr(ret_conv, true);
30273 }
30274
30275 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_err"))) TS_CResult_HostnameDecodeErrorZ_err(uint64_t e) {
30276         void* e_ptr = untag_ptr(e);
30277         CHECK_ACCESS(e_ptr);
30278         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30279         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30280         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
30281         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
30282         return tag_ptr(ret_conv, true);
30283 }
30284
30285 jboolean  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_is_ok"))) TS_CResult_HostnameDecodeErrorZ_is_ok(uint64_t o) {
30286         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
30287         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
30288         return ret_conv;
30289 }
30290
30291 void  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_free"))) TS_CResult_HostnameDecodeErrorZ_free(uint64_t _res) {
30292         if (!ptr_is_owned(_res)) return;
30293         void* _res_ptr = untag_ptr(_res);
30294         CHECK_ACCESS(_res_ptr);
30295         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
30296         FREE(untag_ptr(_res));
30297         CResult_HostnameDecodeErrorZ_free(_res_conv);
30298 }
30299
30300 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
30301         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
30302         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
30303         return tag_ptr(ret_conv, true);
30304 }
30305 int64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone_ptr"))) TS_CResult_HostnameDecodeErrorZ_clone_ptr(uint64_t arg) {
30306         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
30307         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
30308         return ret_conv;
30309 }
30310
30311 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone"))) TS_CResult_HostnameDecodeErrorZ_clone(uint64_t orig) {
30312         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
30313         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
30314         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
30315         return tag_ptr(ret_conv, true);
30316 }
30317
30318 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_ok(uint64_t o) {
30319         LDKTransactionU16LenLimited o_conv;
30320         o_conv.inner = untag_ptr(o);
30321         o_conv.is_owned = ptr_is_owned(o);
30322         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30323         o_conv = TransactionU16LenLimited_clone(&o_conv);
30324         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
30325         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
30326         return tag_ptr(ret_conv, true);
30327 }
30328
30329 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_err() {
30330         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
30331         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
30332         return tag_ptr(ret_conv, true);
30333 }
30334
30335 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_is_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_is_ok(uint64_t o) {
30336         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
30337         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
30338         return ret_conv;
30339 }
30340
30341 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_free"))) TS_CResult_TransactionU16LenLimitedNoneZ_free(uint64_t _res) {
30342         if (!ptr_is_owned(_res)) return;
30343         void* _res_ptr = untag_ptr(_res);
30344         CHECK_ACCESS(_res_ptr);
30345         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
30346         FREE(untag_ptr(_res));
30347         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
30348 }
30349
30350 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
30351         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
30352         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
30353         return tag_ptr(ret_conv, true);
30354 }
30355 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr(uint64_t arg) {
30356         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
30357         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
30358         return ret_conv;
30359 }
30360
30361 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone(uint64_t orig) {
30362         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
30363         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
30364         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
30365         return tag_ptr(ret_conv, true);
30366 }
30367
30368 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok(uint64_t o) {
30369         LDKTransactionU16LenLimited o_conv;
30370         o_conv.inner = untag_ptr(o);
30371         o_conv.is_owned = ptr_is_owned(o);
30372         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30373         o_conv = TransactionU16LenLimited_clone(&o_conv);
30374         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
30375         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
30376         return tag_ptr(ret_conv, true);
30377 }
30378
30379 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err(uint64_t e) {
30380         void* e_ptr = untag_ptr(e);
30381         CHECK_ACCESS(e_ptr);
30382         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30383         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30384         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
30385         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
30386         return tag_ptr(ret_conv, true);
30387 }
30388
30389 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(uint64_t o) {
30390         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
30391         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
30392         return ret_conv;
30393 }
30394
30395 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free(uint64_t _res) {
30396         if (!ptr_is_owned(_res)) return;
30397         void* _res_ptr = untag_ptr(_res);
30398         CHECK_ACCESS(_res_ptr);
30399         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
30400         FREE(untag_ptr(_res));
30401         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
30402 }
30403
30404 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
30405         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
30406         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
30407         return tag_ptr(ret_conv, true);
30408 }
30409 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(uint64_t arg) {
30410         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
30411         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
30412         return ret_conv;
30413 }
30414
30415 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone(uint64_t orig) {
30416         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
30417         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
30418         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
30419         return tag_ptr(ret_conv, true);
30420 }
30421
30422 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_ok(uint64_t o) {
30423         LDKUntrustedString o_conv;
30424         o_conv.inner = untag_ptr(o);
30425         o_conv.is_owned = ptr_is_owned(o);
30426         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30427         o_conv = UntrustedString_clone(&o_conv);
30428         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
30429         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
30430         return tag_ptr(ret_conv, true);
30431 }
30432
30433 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_err"))) TS_CResult_UntrustedStringDecodeErrorZ_err(uint64_t e) {
30434         void* e_ptr = untag_ptr(e);
30435         CHECK_ACCESS(e_ptr);
30436         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30437         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30438         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
30439         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
30440         return tag_ptr(ret_conv, true);
30441 }
30442
30443 jboolean  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_is_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_is_ok(uint64_t o) {
30444         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
30445         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
30446         return ret_conv;
30447 }
30448
30449 void  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_free"))) TS_CResult_UntrustedStringDecodeErrorZ_free(uint64_t _res) {
30450         if (!ptr_is_owned(_res)) return;
30451         void* _res_ptr = untag_ptr(_res);
30452         CHECK_ACCESS(_res_ptr);
30453         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
30454         FREE(untag_ptr(_res));
30455         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
30456 }
30457
30458 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
30459         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
30460         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
30461         return tag_ptr(ret_conv, true);
30462 }
30463 int64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr"))) TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr(uint64_t arg) {
30464         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
30465         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
30466         return ret_conv;
30467 }
30468
30469 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone"))) TS_CResult_UntrustedStringDecodeErrorZ_clone(uint64_t orig) {
30470         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
30471         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
30472         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
30473         return tag_ptr(ret_conv, true);
30474 }
30475
30476 static inline uint64_t C2Tuple__u832u16Z_clone_ptr(LDKC2Tuple__u832u16Z *NONNULL_PTR arg) {
30477         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
30478         *ret_conv = C2Tuple__u832u16Z_clone(arg);
30479         return tag_ptr(ret_conv, true);
30480 }
30481 int64_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_clone_ptr"))) TS_C2Tuple__u832u16Z_clone_ptr(uint64_t arg) {
30482         LDKC2Tuple__u832u16Z* arg_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(arg);
30483         int64_t ret_conv = C2Tuple__u832u16Z_clone_ptr(arg_conv);
30484         return ret_conv;
30485 }
30486
30487 uint64_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_clone"))) TS_C2Tuple__u832u16Z_clone(uint64_t orig) {
30488         LDKC2Tuple__u832u16Z* orig_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(orig);
30489         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
30490         *ret_conv = C2Tuple__u832u16Z_clone(orig_conv);
30491         return tag_ptr(ret_conv, true);
30492 }
30493
30494 uint64_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_new"))) TS_C2Tuple__u832u16Z_new(int8_tArray a, int16_t b) {
30495         LDKThirtyTwoBytes a_ref;
30496         CHECK(a->arr_len == 32);
30497         memcpy(a_ref.data, a->elems, 32); FREE(a);
30498         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
30499         *ret_conv = C2Tuple__u832u16Z_new(a_ref, b);
30500         return tag_ptr(ret_conv, true);
30501 }
30502
30503 void  __attribute__((export_name("TS_C2Tuple__u832u16Z_free"))) TS_C2Tuple__u832u16Z_free(uint64_t _res) {
30504         if (!ptr_is_owned(_res)) return;
30505         void* _res_ptr = untag_ptr(_res);
30506         CHECK_ACCESS(_res_ptr);
30507         LDKC2Tuple__u832u16Z _res_conv = *(LDKC2Tuple__u832u16Z*)(_res_ptr);
30508         FREE(untag_ptr(_res));
30509         C2Tuple__u832u16Z_free(_res_conv);
30510 }
30511
30512 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_ok(uint64_t o) {
30513         LDKPaymentRelay o_conv;
30514         o_conv.inner = untag_ptr(o);
30515         o_conv.is_owned = ptr_is_owned(o);
30516         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30517         o_conv = PaymentRelay_clone(&o_conv);
30518         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
30519         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
30520         return tag_ptr(ret_conv, true);
30521 }
30522
30523 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_err"))) TS_CResult_PaymentRelayDecodeErrorZ_err(uint64_t e) {
30524         void* e_ptr = untag_ptr(e);
30525         CHECK_ACCESS(e_ptr);
30526         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30527         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30528         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
30529         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
30530         return tag_ptr(ret_conv, true);
30531 }
30532
30533 jboolean  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_is_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_is_ok(uint64_t o) {
30534         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
30535         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
30536         return ret_conv;
30537 }
30538
30539 void  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_free"))) TS_CResult_PaymentRelayDecodeErrorZ_free(uint64_t _res) {
30540         if (!ptr_is_owned(_res)) return;
30541         void* _res_ptr = untag_ptr(_res);
30542         CHECK_ACCESS(_res_ptr);
30543         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
30544         FREE(untag_ptr(_res));
30545         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
30546 }
30547
30548 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
30549         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
30550         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
30551         return tag_ptr(ret_conv, true);
30552 }
30553 int64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentRelayDecodeErrorZ_clone_ptr(uint64_t arg) {
30554         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
30555         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
30556         return ret_conv;
30557 }
30558
30559 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_clone"))) TS_CResult_PaymentRelayDecodeErrorZ_clone(uint64_t orig) {
30560         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
30561         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
30562         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
30563         return tag_ptr(ret_conv, true);
30564 }
30565
30566 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_ok(uint64_t o) {
30567         LDKPaymentConstraints o_conv;
30568         o_conv.inner = untag_ptr(o);
30569         o_conv.is_owned = ptr_is_owned(o);
30570         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30571         o_conv = PaymentConstraints_clone(&o_conv);
30572         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
30573         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
30574         return tag_ptr(ret_conv, true);
30575 }
30576
30577 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_err"))) TS_CResult_PaymentConstraintsDecodeErrorZ_err(uint64_t e) {
30578         void* e_ptr = untag_ptr(e);
30579         CHECK_ACCESS(e_ptr);
30580         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30581         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30582         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
30583         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
30584         return tag_ptr(ret_conv, true);
30585 }
30586
30587 jboolean  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_is_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_is_ok(uint64_t o) {
30588         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
30589         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
30590         return ret_conv;
30591 }
30592
30593 void  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_free"))) TS_CResult_PaymentConstraintsDecodeErrorZ_free(uint64_t _res) {
30594         if (!ptr_is_owned(_res)) return;
30595         void* _res_ptr = untag_ptr(_res);
30596         CHECK_ACCESS(_res_ptr);
30597         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
30598         FREE(untag_ptr(_res));
30599         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
30600 }
30601
30602 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
30603         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
30604         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
30605         return tag_ptr(ret_conv, true);
30606 }
30607 int64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(uint64_t arg) {
30608         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
30609         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
30610         return ret_conv;
30611 }
30612
30613 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_clone"))) TS_CResult_PaymentConstraintsDecodeErrorZ_clone(uint64_t orig) {
30614         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
30615         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
30616         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
30617         return tag_ptr(ret_conv, true);
30618 }
30619
30620 static inline uint64_t C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR arg) {
30621         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
30622         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(arg);
30623         return tag_ptr(ret_conv, true);
30624 }
30625 int64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(uint64_t arg) {
30626         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(arg);
30627         int64_t ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(arg_conv);
30628         return ret_conv;
30629 }
30630
30631 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(uint64_t orig) {
30632         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(orig);
30633         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
30634         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig_conv);
30635         return tag_ptr(ret_conv, true);
30636 }
30637
30638 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(int8_tArray a, uint64_t b, uint64_t c) {
30639         LDKThirtyTwoBytes a_ref;
30640         CHECK(a->arr_len == 32);
30641         memcpy(a_ref.data, a->elems, 32); FREE(a);
30642         LDKRecipientOnionFields b_conv;
30643         b_conv.inner = untag_ptr(b);
30644         b_conv.is_owned = ptr_is_owned(b);
30645         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30646         b_conv = RecipientOnionFields_clone(&b_conv);
30647         LDKRouteParameters c_conv;
30648         c_conv.inner = untag_ptr(c);
30649         c_conv.is_owned = ptr_is_owned(c);
30650         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
30651         c_conv = RouteParameters_clone(&c_conv);
30652         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
30653         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a_ref, b_conv, c_conv);
30654         return tag_ptr(ret_conv, true);
30655 }
30656
30657 void  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(uint64_t _res) {
30658         if (!ptr_is_owned(_res)) return;
30659         void* _res_ptr = untag_ptr(_res);
30660         CHECK_ACCESS(_res_ptr);
30661         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(_res_ptr);
30662         FREE(untag_ptr(_res));
30663         C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res_conv);
30664 }
30665
30666 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(uint64_t o) {
30667         void* o_ptr = untag_ptr(o);
30668         CHECK_ACCESS(o_ptr);
30669         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ o_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(o_ptr);
30670         o_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone((LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(o));
30671         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
30672         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o_conv);
30673         return tag_ptr(ret_conv, true);
30674 }
30675
30676 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() {
30677         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
30678         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err();
30679         return tag_ptr(ret_conv, true);
30680 }
30681
30682 jboolean  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(uint64_t o) {
30683         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* o_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(o);
30684         jboolean ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o_conv);
30685         return ret_conv;
30686 }
30687
30688 void  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(uint64_t _res) {
30689         if (!ptr_is_owned(_res)) return;
30690         void* _res_ptr = untag_ptr(_res);
30691         CHECK_ACCESS(_res_ptr);
30692         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ _res_conv = *(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)(_res_ptr);
30693         FREE(untag_ptr(_res));
30694         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res_conv);
30695 }
30696
30697 static inline uint64_t CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR arg) {
30698         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
30699         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(arg);
30700         return tag_ptr(ret_conv, true);
30701 }
30702 int64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(uint64_t arg) {
30703         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* arg_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(arg);
30704         int64_t ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(arg_conv);
30705         return ret_conv;
30706 }
30707
30708 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(uint64_t orig) {
30709         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* orig_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(orig);
30710         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
30711         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig_conv);
30712         return tag_ptr(ret_conv, true);
30713 }
30714
30715 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_ok"))) TS_CResult_StrSecp256k1ErrorZ_ok(jstring o) {
30716         LDKStr o_conv = str_ref_to_owned_c(o);
30717         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
30718         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
30719         return tag_ptr(ret_conv, true);
30720 }
30721
30722 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_err"))) TS_CResult_StrSecp256k1ErrorZ_err(uint32_t e) {
30723         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
30724         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
30725         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
30726         return tag_ptr(ret_conv, true);
30727 }
30728
30729 jboolean  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_is_ok"))) TS_CResult_StrSecp256k1ErrorZ_is_ok(uint64_t o) {
30730         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
30731         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
30732         return ret_conv;
30733 }
30734
30735 void  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_free"))) TS_CResult_StrSecp256k1ErrorZ_free(uint64_t _res) {
30736         if (!ptr_is_owned(_res)) return;
30737         void* _res_ptr = untag_ptr(_res);
30738         CHECK_ACCESS(_res_ptr);
30739         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
30740         FREE(untag_ptr(_res));
30741         CResult_StrSecp256k1ErrorZ_free(_res_conv);
30742 }
30743
30744 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
30745         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
30746         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
30747         return tag_ptr(ret_conv, true);
30748 }
30749 int64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_clone_ptr"))) TS_CResult_StrSecp256k1ErrorZ_clone_ptr(uint64_t arg) {
30750         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
30751         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
30752         return ret_conv;
30753 }
30754
30755 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_clone"))) TS_CResult_StrSecp256k1ErrorZ_clone(uint64_t orig) {
30756         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
30757         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
30758         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
30759         return tag_ptr(ret_conv, true);
30760 }
30761
30762 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_ok(uint64_t o) {
30763         void* o_ptr = untag_ptr(o);
30764         CHECK_ACCESS(o_ptr);
30765         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
30766         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
30767         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
30768         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
30769         return tag_ptr(ret_conv, true);
30770 }
30771
30772 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_err"))) TS_CResult_TxOutUtxoLookupErrorZ_err(uint32_t e) {
30773         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_js(e);
30774         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
30775         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
30776         return tag_ptr(ret_conv, true);
30777 }
30778
30779 jboolean  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_is_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_is_ok(uint64_t o) {
30780         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
30781         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
30782         return ret_conv;
30783 }
30784
30785 void  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_free"))) TS_CResult_TxOutUtxoLookupErrorZ_free(uint64_t _res) {
30786         if (!ptr_is_owned(_res)) return;
30787         void* _res_ptr = untag_ptr(_res);
30788         CHECK_ACCESS(_res_ptr);
30789         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
30790         FREE(untag_ptr(_res));
30791         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
30792 }
30793
30794 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
30795         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
30796         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
30797         return tag_ptr(ret_conv, true);
30798 }
30799 int64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr"))) TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr(uint64_t arg) {
30800         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
30801         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
30802         return ret_conv;
30803 }
30804
30805 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone"))) TS_CResult_TxOutUtxoLookupErrorZ_clone(uint64_t orig) {
30806         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
30807         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
30808         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
30809         return tag_ptr(ret_conv, true);
30810 }
30811
30812 static inline uint64_t C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR arg) {
30813         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
30814         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(arg);
30815         return tag_ptr(ret_conv, true);
30816 }
30817 int64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(uint64_t arg) {
30818         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* arg_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(arg);
30819         int64_t ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(arg_conv);
30820         return ret_conv;
30821 }
30822
30823 uint64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(uint64_t orig) {
30824         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* orig_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(orig);
30825         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
30826         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig_conv);
30827         return tag_ptr(ret_conv, true);
30828 }
30829
30830 uint64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(int8_tArray a, uint64_t b, uint64_t c) {
30831         LDKPublicKey a_ref;
30832         CHECK(a->arr_len == 33);
30833         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
30834         LDKOnionMessage b_conv;
30835         b_conv.inner = untag_ptr(b);
30836         b_conv.is_owned = ptr_is_owned(b);
30837         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30838         b_conv = OnionMessage_clone(&b_conv);
30839         void* c_ptr = untag_ptr(c);
30840         CHECK_ACCESS(c_ptr);
30841         LDKCOption_CVec_SocketAddressZZ c_conv = *(LDKCOption_CVec_SocketAddressZZ*)(c_ptr);
30842         c_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(c));
30843         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
30844         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(a_ref, b_conv, c_conv);
30845         return tag_ptr(ret_conv, true);
30846 }
30847
30848 void  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(uint64_t _res) {
30849         if (!ptr_is_owned(_res)) return;
30850         void* _res_ptr = untag_ptr(_res);
30851         CHECK_ACCESS(_res_ptr);
30852         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ _res_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(_res_ptr);
30853         FREE(untag_ptr(_res));
30854         C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res_conv);
30855 }
30856
30857 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(uint64_t o) {
30858         void* o_ptr = untag_ptr(o);
30859         CHECK_ACCESS(o_ptr);
30860         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ o_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(o_ptr);
30861         o_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone((LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(o));
30862         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
30863         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o_conv);
30864         return tag_ptr(ret_conv, true);
30865 }
30866
30867 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(uint64_t e) {
30868         void* e_ptr = untag_ptr(e);
30869         CHECK_ACCESS(e_ptr);
30870         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
30871         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
30872         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
30873         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e_conv);
30874         return tag_ptr(ret_conv, true);
30875 }
30876
30877 jboolean  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(uint64_t o) {
30878         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* o_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(o);
30879         jboolean ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o_conv);
30880         return ret_conv;
30881 }
30882
30883 void  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(uint64_t _res) {
30884         if (!ptr_is_owned(_res)) return;
30885         void* _res_ptr = untag_ptr(_res);
30886         CHECK_ACCESS(_res_ptr);
30887         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ _res_conv = *(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)(_res_ptr);
30888         FREE(untag_ptr(_res));
30889         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res_conv);
30890 }
30891
30892 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_ok"))) TS_CResult_PeeledOnionNoneZ_ok(uint64_t o) {
30893         void* o_ptr = untag_ptr(o);
30894         CHECK_ACCESS(o_ptr);
30895         LDKPeeledOnion o_conv = *(LDKPeeledOnion*)(o_ptr);
30896         o_conv = PeeledOnion_clone((LDKPeeledOnion*)untag_ptr(o));
30897         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
30898         *ret_conv = CResult_PeeledOnionNoneZ_ok(o_conv);
30899         return tag_ptr(ret_conv, true);
30900 }
30901
30902 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_err"))) TS_CResult_PeeledOnionNoneZ_err() {
30903         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
30904         *ret_conv = CResult_PeeledOnionNoneZ_err();
30905         return tag_ptr(ret_conv, true);
30906 }
30907
30908 jboolean  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_is_ok"))) TS_CResult_PeeledOnionNoneZ_is_ok(uint64_t o) {
30909         LDKCResult_PeeledOnionNoneZ* o_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(o);
30910         jboolean ret_conv = CResult_PeeledOnionNoneZ_is_ok(o_conv);
30911         return ret_conv;
30912 }
30913
30914 void  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_free"))) TS_CResult_PeeledOnionNoneZ_free(uint64_t _res) {
30915         if (!ptr_is_owned(_res)) return;
30916         void* _res_ptr = untag_ptr(_res);
30917         CHECK_ACCESS(_res_ptr);
30918         LDKCResult_PeeledOnionNoneZ _res_conv = *(LDKCResult_PeeledOnionNoneZ*)(_res_ptr);
30919         FREE(untag_ptr(_res));
30920         CResult_PeeledOnionNoneZ_free(_res_conv);
30921 }
30922
30923 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_ok"))) TS_CResult_SendSuccessSendErrorZ_ok(uint64_t o) {
30924         void* o_ptr = untag_ptr(o);
30925         CHECK_ACCESS(o_ptr);
30926         LDKSendSuccess o_conv = *(LDKSendSuccess*)(o_ptr);
30927         o_conv = SendSuccess_clone((LDKSendSuccess*)untag_ptr(o));
30928         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
30929         *ret_conv = CResult_SendSuccessSendErrorZ_ok(o_conv);
30930         return tag_ptr(ret_conv, true);
30931 }
30932
30933 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_err"))) TS_CResult_SendSuccessSendErrorZ_err(uint64_t e) {
30934         void* e_ptr = untag_ptr(e);
30935         CHECK_ACCESS(e_ptr);
30936         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
30937         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
30938         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
30939         *ret_conv = CResult_SendSuccessSendErrorZ_err(e_conv);
30940         return tag_ptr(ret_conv, true);
30941 }
30942
30943 jboolean  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_is_ok"))) TS_CResult_SendSuccessSendErrorZ_is_ok(uint64_t o) {
30944         LDKCResult_SendSuccessSendErrorZ* o_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(o);
30945         jboolean ret_conv = CResult_SendSuccessSendErrorZ_is_ok(o_conv);
30946         return ret_conv;
30947 }
30948
30949 void  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_free"))) TS_CResult_SendSuccessSendErrorZ_free(uint64_t _res) {
30950         if (!ptr_is_owned(_res)) return;
30951         void* _res_ptr = untag_ptr(_res);
30952         CHECK_ACCESS(_res_ptr);
30953         LDKCResult_SendSuccessSendErrorZ _res_conv = *(LDKCResult_SendSuccessSendErrorZ*)(_res_ptr);
30954         FREE(untag_ptr(_res));
30955         CResult_SendSuccessSendErrorZ_free(_res_conv);
30956 }
30957
30958 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) {
30959         LDKBlindedPath o_conv;
30960         o_conv.inner = untag_ptr(o);
30961         o_conv.is_owned = ptr_is_owned(o);
30962         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30963         o_conv = BlindedPath_clone(&o_conv);
30964         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
30965         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
30966         return tag_ptr(ret_conv, true);
30967 }
30968
30969 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() {
30970         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
30971         *ret_conv = CResult_BlindedPathNoneZ_err();
30972         return tag_ptr(ret_conv, true);
30973 }
30974
30975 jboolean  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) {
30976         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
30977         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
30978         return ret_conv;
30979 }
30980
30981 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) {
30982         if (!ptr_is_owned(_res)) return;
30983         void* _res_ptr = untag_ptr(_res);
30984         CHECK_ACCESS(_res_ptr);
30985         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
30986         FREE(untag_ptr(_res));
30987         CResult_BlindedPathNoneZ_free(_res_conv);
30988 }
30989
30990 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
30991         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
30992         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
30993         return tag_ptr(ret_conv, true);
30994 }
30995 int64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) {
30996         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
30997         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
30998         return ret_conv;
30999 }
31000
31001 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) {
31002         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
31003         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
31004         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
31005         return tag_ptr(ret_conv, true);
31006 }
31007
31008 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(uint64_t o) {
31009         void* o_ptr = untag_ptr(o);
31010         CHECK_ACCESS(o_ptr);
31011         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
31012         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
31013         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
31014         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
31015         return tag_ptr(ret_conv, true);
31016 }
31017
31018 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() {
31019         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
31020         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
31021         return tag_ptr(ret_conv, true);
31022 }
31023
31024 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(uint64_t o) {
31025         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
31026         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
31027         return ret_conv;
31028 }
31029
31030 void  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(uint64_t _res) {
31031         if (!ptr_is_owned(_res)) return;
31032         void* _res_ptr = untag_ptr(_res);
31033         CHECK_ACCESS(_res_ptr);
31034         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
31035         FREE(untag_ptr(_res));
31036         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
31037 }
31038
31039 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
31040         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
31041         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
31042         return tag_ptr(ret_conv, true);
31043 }
31044 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(uint64_t arg) {
31045         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
31046         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
31047         return ret_conv;
31048 }
31049
31050 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(uint64_t orig) {
31051         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
31052         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
31053         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
31054         return tag_ptr(ret_conv, true);
31055 }
31056
31057 void  __attribute__((export_name("TS_CVec_ForwardNodeZ_free"))) TS_CVec_ForwardNodeZ_free(uint64_tArray _res) {
31058         LDKCVec_ForwardNodeZ _res_constr;
31059         _res_constr.datalen = _res->arr_len;
31060         if (_res_constr.datalen > 0)
31061                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
31062         else
31063                 _res_constr.data = NULL;
31064         uint64_t* _res_vals = _res->elems;
31065         for (size_t n = 0; n < _res_constr.datalen; n++) {
31066                 uint64_t _res_conv_13 = _res_vals[n];
31067                 LDKForwardNode _res_conv_13_conv;
31068                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
31069                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
31070                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
31071                 _res_constr.data[n] = _res_conv_13_conv;
31072         }
31073         FREE(_res);
31074         CVec_ForwardNodeZ_free(_res_constr);
31075 }
31076
31077 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) {
31078         LDKBlindedPath o_conv;
31079         o_conv.inner = untag_ptr(o);
31080         o_conv.is_owned = ptr_is_owned(o);
31081         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31082         o_conv = BlindedPath_clone(&o_conv);
31083         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
31084         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
31085         return tag_ptr(ret_conv, true);
31086 }
31087
31088 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) {
31089         void* e_ptr = untag_ptr(e);
31090         CHECK_ACCESS(e_ptr);
31091         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31092         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31093         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
31094         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
31095         return tag_ptr(ret_conv, true);
31096 }
31097
31098 jboolean  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) {
31099         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
31100         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
31101         return ret_conv;
31102 }
31103
31104 void  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) {
31105         if (!ptr_is_owned(_res)) return;
31106         void* _res_ptr = untag_ptr(_res);
31107         CHECK_ACCESS(_res_ptr);
31108         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
31109         FREE(untag_ptr(_res));
31110         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
31111 }
31112
31113 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
31114         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
31115         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
31116         return tag_ptr(ret_conv, true);
31117 }
31118 int64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) {
31119         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
31120         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
31121         return ret_conv;
31122 }
31123
31124 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) {
31125         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
31126         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
31127         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
31128         return tag_ptr(ret_conv, true);
31129 }
31130
31131 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
31132         LDKBlindedHop o_conv;
31133         o_conv.inner = untag_ptr(o);
31134         o_conv.is_owned = ptr_is_owned(o);
31135         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31136         o_conv = BlindedHop_clone(&o_conv);
31137         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
31138         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
31139         return tag_ptr(ret_conv, true);
31140 }
31141
31142 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
31143         void* e_ptr = untag_ptr(e);
31144         CHECK_ACCESS(e_ptr);
31145         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31146         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31147         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
31148         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
31149         return tag_ptr(ret_conv, true);
31150 }
31151
31152 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
31153         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
31154         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
31155         return ret_conv;
31156 }
31157
31158 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
31159         if (!ptr_is_owned(_res)) return;
31160         void* _res_ptr = untag_ptr(_res);
31161         CHECK_ACCESS(_res_ptr);
31162         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
31163         FREE(untag_ptr(_res));
31164         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
31165 }
31166
31167 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
31168         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
31169         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
31170         return tag_ptr(ret_conv, true);
31171 }
31172 int64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) {
31173         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
31174         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
31175         return ret_conv;
31176 }
31177
31178 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) {
31179         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
31180         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
31181         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
31182         return tag_ptr(ret_conv, true);
31183 }
31184
31185 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_ok(uint64_t o) {
31186         LDKInvoiceError o_conv;
31187         o_conv.inner = untag_ptr(o);
31188         o_conv.is_owned = ptr_is_owned(o);
31189         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31190         o_conv = InvoiceError_clone(&o_conv);
31191         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
31192         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
31193         return tag_ptr(ret_conv, true);
31194 }
31195
31196 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_err(uint64_t e) {
31197         void* e_ptr = untag_ptr(e);
31198         CHECK_ACCESS(e_ptr);
31199         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31200         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31201         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
31202         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
31203         return tag_ptr(ret_conv, true);
31204 }
31205
31206 jboolean  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_is_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_is_ok(uint64_t o) {
31207         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
31208         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
31209         return ret_conv;
31210 }
31211
31212 void  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_free"))) TS_CResult_InvoiceErrorDecodeErrorZ_free(uint64_t _res) {
31213         if (!ptr_is_owned(_res)) return;
31214         void* _res_ptr = untag_ptr(_res);
31215         CHECK_ACCESS(_res_ptr);
31216         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
31217         FREE(untag_ptr(_res));
31218         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
31219 }
31220
31221 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
31222         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
31223         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
31224         return tag_ptr(ret_conv, true);
31225 }
31226 int64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr(uint64_t arg) {
31227         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
31228         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
31229         return ret_conv;
31230 }
31231
31232 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone(uint64_t orig) {
31233         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
31234         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
31235         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
31236         return tag_ptr(ret_conv, true);
31237 }
31238
31239 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_ok(uint64_t o) {
31240         LDKDelayedPaymentBasepoint o_conv;
31241         o_conv.inner = untag_ptr(o);
31242         o_conv.is_owned = ptr_is_owned(o);
31243         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31244         o_conv = DelayedPaymentBasepoint_clone(&o_conv);
31245         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
31246         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o_conv);
31247         return tag_ptr(ret_conv, true);
31248 }
31249
31250 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_err"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_err(uint64_t e) {
31251         void* e_ptr = untag_ptr(e);
31252         CHECK_ACCESS(e_ptr);
31253         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31254         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31255         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
31256         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_err(e_conv);
31257         return tag_ptr(ret_conv, true);
31258 }
31259
31260 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(uint64_t o) {
31261         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(o);
31262         jboolean ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o_conv);
31263         return ret_conv;
31264 }
31265
31266 void  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_free"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_free(uint64_t _res) {
31267         if (!ptr_is_owned(_res)) return;
31268         void* _res_ptr = untag_ptr(_res);
31269         CHECK_ACCESS(_res_ptr);
31270         LDKCResult_DelayedPaymentBasepointDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)(_res_ptr);
31271         FREE(untag_ptr(_res));
31272         CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res_conv);
31273 }
31274
31275 static inline uint64_t CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR arg) {
31276         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
31277         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(arg);
31278         return tag_ptr(ret_conv, true);
31279 }
31280 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(uint64_t arg) {
31281         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(arg);
31282         int64_t ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(arg_conv);
31283         return ret_conv;
31284 }
31285
31286 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone(uint64_t orig) {
31287         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(orig);
31288         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
31289         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig_conv);
31290         return tag_ptr(ret_conv, true);
31291 }
31292
31293 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_ok(uint64_t o) {
31294         LDKDelayedPaymentKey o_conv;
31295         o_conv.inner = untag_ptr(o);
31296         o_conv.is_owned = ptr_is_owned(o);
31297         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31298         o_conv = DelayedPaymentKey_clone(&o_conv);
31299         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
31300         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_ok(o_conv);
31301         return tag_ptr(ret_conv, true);
31302 }
31303
31304 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_err"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_err(uint64_t e) {
31305         void* e_ptr = untag_ptr(e);
31306         CHECK_ACCESS(e_ptr);
31307         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31308         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31309         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
31310         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_err(e_conv);
31311         return tag_ptr(ret_conv, true);
31312 }
31313
31314 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(uint64_t o) {
31315         LDKCResult_DelayedPaymentKeyDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(o);
31316         jboolean ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o_conv);
31317         return ret_conv;
31318 }
31319
31320 void  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_free"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_free(uint64_t _res) {
31321         if (!ptr_is_owned(_res)) return;
31322         void* _res_ptr = untag_ptr(_res);
31323         CHECK_ACCESS(_res_ptr);
31324         LDKCResult_DelayedPaymentKeyDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentKeyDecodeErrorZ*)(_res_ptr);
31325         FREE(untag_ptr(_res));
31326         CResult_DelayedPaymentKeyDecodeErrorZ_free(_res_conv);
31327 }
31328
31329 static inline uint64_t CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR arg) {
31330         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
31331         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(arg);
31332         return tag_ptr(ret_conv, true);
31333 }
31334 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(uint64_t arg) {
31335         LDKCResult_DelayedPaymentKeyDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(arg);
31336         int64_t ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(arg_conv);
31337         return ret_conv;
31338 }
31339
31340 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone(uint64_t orig) {
31341         LDKCResult_DelayedPaymentKeyDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(orig);
31342         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
31343         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig_conv);
31344         return tag_ptr(ret_conv, true);
31345 }
31346
31347 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_ok"))) TS_CResult_HtlcBasepointDecodeErrorZ_ok(uint64_t o) {
31348         LDKHtlcBasepoint o_conv;
31349         o_conv.inner = untag_ptr(o);
31350         o_conv.is_owned = ptr_is_owned(o);
31351         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31352         o_conv = HtlcBasepoint_clone(&o_conv);
31353         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
31354         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_ok(o_conv);
31355         return tag_ptr(ret_conv, true);
31356 }
31357
31358 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_err"))) TS_CResult_HtlcBasepointDecodeErrorZ_err(uint64_t e) {
31359         void* e_ptr = untag_ptr(e);
31360         CHECK_ACCESS(e_ptr);
31361         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31362         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31363         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
31364         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_err(e_conv);
31365         return tag_ptr(ret_conv, true);
31366 }
31367
31368 jboolean  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_is_ok"))) TS_CResult_HtlcBasepointDecodeErrorZ_is_ok(uint64_t o) {
31369         LDKCResult_HtlcBasepointDecodeErrorZ* o_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(o);
31370         jboolean ret_conv = CResult_HtlcBasepointDecodeErrorZ_is_ok(o_conv);
31371         return ret_conv;
31372 }
31373
31374 void  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_free"))) TS_CResult_HtlcBasepointDecodeErrorZ_free(uint64_t _res) {
31375         if (!ptr_is_owned(_res)) return;
31376         void* _res_ptr = untag_ptr(_res);
31377         CHECK_ACCESS(_res_ptr);
31378         LDKCResult_HtlcBasepointDecodeErrorZ _res_conv = *(LDKCResult_HtlcBasepointDecodeErrorZ*)(_res_ptr);
31379         FREE(untag_ptr(_res));
31380         CResult_HtlcBasepointDecodeErrorZ_free(_res_conv);
31381 }
31382
31383 static inline uint64_t CResult_HtlcBasepointDecodeErrorZ_clone_ptr(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR arg) {
31384         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
31385         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(arg);
31386         return tag_ptr(ret_conv, true);
31387 }
31388 int64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_clone_ptr"))) TS_CResult_HtlcBasepointDecodeErrorZ_clone_ptr(uint64_t arg) {
31389         LDKCResult_HtlcBasepointDecodeErrorZ* arg_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(arg);
31390         int64_t ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone_ptr(arg_conv);
31391         return ret_conv;
31392 }
31393
31394 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_clone"))) TS_CResult_HtlcBasepointDecodeErrorZ_clone(uint64_t orig) {
31395         LDKCResult_HtlcBasepointDecodeErrorZ* orig_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(orig);
31396         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
31397         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(orig_conv);
31398         return tag_ptr(ret_conv, true);
31399 }
31400
31401 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_ok"))) TS_CResult_HtlcKeyDecodeErrorZ_ok(uint64_t o) {
31402         LDKHtlcKey o_conv;
31403         o_conv.inner = untag_ptr(o);
31404         o_conv.is_owned = ptr_is_owned(o);
31405         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31406         o_conv = HtlcKey_clone(&o_conv);
31407         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
31408         *ret_conv = CResult_HtlcKeyDecodeErrorZ_ok(o_conv);
31409         return tag_ptr(ret_conv, true);
31410 }
31411
31412 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_err"))) TS_CResult_HtlcKeyDecodeErrorZ_err(uint64_t e) {
31413         void* e_ptr = untag_ptr(e);
31414         CHECK_ACCESS(e_ptr);
31415         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31416         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31417         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
31418         *ret_conv = CResult_HtlcKeyDecodeErrorZ_err(e_conv);
31419         return tag_ptr(ret_conv, true);
31420 }
31421
31422 jboolean  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_is_ok"))) TS_CResult_HtlcKeyDecodeErrorZ_is_ok(uint64_t o) {
31423         LDKCResult_HtlcKeyDecodeErrorZ* o_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(o);
31424         jboolean ret_conv = CResult_HtlcKeyDecodeErrorZ_is_ok(o_conv);
31425         return ret_conv;
31426 }
31427
31428 void  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_free"))) TS_CResult_HtlcKeyDecodeErrorZ_free(uint64_t _res) {
31429         if (!ptr_is_owned(_res)) return;
31430         void* _res_ptr = untag_ptr(_res);
31431         CHECK_ACCESS(_res_ptr);
31432         LDKCResult_HtlcKeyDecodeErrorZ _res_conv = *(LDKCResult_HtlcKeyDecodeErrorZ*)(_res_ptr);
31433         FREE(untag_ptr(_res));
31434         CResult_HtlcKeyDecodeErrorZ_free(_res_conv);
31435 }
31436
31437 static inline uint64_t CResult_HtlcKeyDecodeErrorZ_clone_ptr(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR arg) {
31438         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
31439         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(arg);
31440         return tag_ptr(ret_conv, true);
31441 }
31442 int64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_clone_ptr"))) TS_CResult_HtlcKeyDecodeErrorZ_clone_ptr(uint64_t arg) {
31443         LDKCResult_HtlcKeyDecodeErrorZ* arg_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(arg);
31444         int64_t ret_conv = CResult_HtlcKeyDecodeErrorZ_clone_ptr(arg_conv);
31445         return ret_conv;
31446 }
31447
31448 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_clone"))) TS_CResult_HtlcKeyDecodeErrorZ_clone(uint64_t orig) {
31449         LDKCResult_HtlcKeyDecodeErrorZ* orig_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(orig);
31450         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
31451         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(orig_conv);
31452         return tag_ptr(ret_conv, true);
31453 }
31454
31455 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_ok"))) TS_CResult_RevocationBasepointDecodeErrorZ_ok(uint64_t o) {
31456         LDKRevocationBasepoint o_conv;
31457         o_conv.inner = untag_ptr(o);
31458         o_conv.is_owned = ptr_is_owned(o);
31459         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31460         o_conv = RevocationBasepoint_clone(&o_conv);
31461         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
31462         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_ok(o_conv);
31463         return tag_ptr(ret_conv, true);
31464 }
31465
31466 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_err"))) TS_CResult_RevocationBasepointDecodeErrorZ_err(uint64_t e) {
31467         void* e_ptr = untag_ptr(e);
31468         CHECK_ACCESS(e_ptr);
31469         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31470         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31471         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
31472         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_err(e_conv);
31473         return tag_ptr(ret_conv, true);
31474 }
31475
31476 jboolean  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_is_ok"))) TS_CResult_RevocationBasepointDecodeErrorZ_is_ok(uint64_t o) {
31477         LDKCResult_RevocationBasepointDecodeErrorZ* o_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(o);
31478         jboolean ret_conv = CResult_RevocationBasepointDecodeErrorZ_is_ok(o_conv);
31479         return ret_conv;
31480 }
31481
31482 void  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_free"))) TS_CResult_RevocationBasepointDecodeErrorZ_free(uint64_t _res) {
31483         if (!ptr_is_owned(_res)) return;
31484         void* _res_ptr = untag_ptr(_res);
31485         CHECK_ACCESS(_res_ptr);
31486         LDKCResult_RevocationBasepointDecodeErrorZ _res_conv = *(LDKCResult_RevocationBasepointDecodeErrorZ*)(_res_ptr);
31487         FREE(untag_ptr(_res));
31488         CResult_RevocationBasepointDecodeErrorZ_free(_res_conv);
31489 }
31490
31491 static inline uint64_t CResult_RevocationBasepointDecodeErrorZ_clone_ptr(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR arg) {
31492         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
31493         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(arg);
31494         return tag_ptr(ret_conv, true);
31495 }
31496 int64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_clone_ptr"))) TS_CResult_RevocationBasepointDecodeErrorZ_clone_ptr(uint64_t arg) {
31497         LDKCResult_RevocationBasepointDecodeErrorZ* arg_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(arg);
31498         int64_t ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone_ptr(arg_conv);
31499         return ret_conv;
31500 }
31501
31502 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_clone"))) TS_CResult_RevocationBasepointDecodeErrorZ_clone(uint64_t orig) {
31503         LDKCResult_RevocationBasepointDecodeErrorZ* orig_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(orig);
31504         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
31505         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(orig_conv);
31506         return tag_ptr(ret_conv, true);
31507 }
31508
31509 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_ok"))) TS_CResult_RevocationKeyDecodeErrorZ_ok(uint64_t o) {
31510         LDKRevocationKey o_conv;
31511         o_conv.inner = untag_ptr(o);
31512         o_conv.is_owned = ptr_is_owned(o);
31513         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31514         o_conv = RevocationKey_clone(&o_conv);
31515         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
31516         *ret_conv = CResult_RevocationKeyDecodeErrorZ_ok(o_conv);
31517         return tag_ptr(ret_conv, true);
31518 }
31519
31520 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_err"))) TS_CResult_RevocationKeyDecodeErrorZ_err(uint64_t e) {
31521         void* e_ptr = untag_ptr(e);
31522         CHECK_ACCESS(e_ptr);
31523         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31524         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31525         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
31526         *ret_conv = CResult_RevocationKeyDecodeErrorZ_err(e_conv);
31527         return tag_ptr(ret_conv, true);
31528 }
31529
31530 jboolean  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_is_ok"))) TS_CResult_RevocationKeyDecodeErrorZ_is_ok(uint64_t o) {
31531         LDKCResult_RevocationKeyDecodeErrorZ* o_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(o);
31532         jboolean ret_conv = CResult_RevocationKeyDecodeErrorZ_is_ok(o_conv);
31533         return ret_conv;
31534 }
31535
31536 void  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_free"))) TS_CResult_RevocationKeyDecodeErrorZ_free(uint64_t _res) {
31537         if (!ptr_is_owned(_res)) return;
31538         void* _res_ptr = untag_ptr(_res);
31539         CHECK_ACCESS(_res_ptr);
31540         LDKCResult_RevocationKeyDecodeErrorZ _res_conv = *(LDKCResult_RevocationKeyDecodeErrorZ*)(_res_ptr);
31541         FREE(untag_ptr(_res));
31542         CResult_RevocationKeyDecodeErrorZ_free(_res_conv);
31543 }
31544
31545 static inline uint64_t CResult_RevocationKeyDecodeErrorZ_clone_ptr(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR arg) {
31546         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
31547         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(arg);
31548         return tag_ptr(ret_conv, true);
31549 }
31550 int64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_clone_ptr"))) TS_CResult_RevocationKeyDecodeErrorZ_clone_ptr(uint64_t arg) {
31551         LDKCResult_RevocationKeyDecodeErrorZ* arg_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(arg);
31552         int64_t ret_conv = CResult_RevocationKeyDecodeErrorZ_clone_ptr(arg_conv);
31553         return ret_conv;
31554 }
31555
31556 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_clone"))) TS_CResult_RevocationKeyDecodeErrorZ_clone(uint64_t orig) {
31557         LDKCResult_RevocationKeyDecodeErrorZ* orig_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(orig);
31558         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
31559         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(orig_conv);
31560         return tag_ptr(ret_conv, true);
31561 }
31562
31563 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
31564         void* o_ptr = untag_ptr(o);
31565         CHECK_ACCESS(o_ptr);
31566         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
31567         if (o_conv.free == LDKFilter_JCalls_free) {
31568                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31569                 LDKFilter_JCalls_cloned(&o_conv);
31570         }
31571         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
31572         *ret_copy = COption_FilterZ_some(o_conv);
31573         uint64_t ret_ref = tag_ptr(ret_copy, true);
31574         return ret_ref;
31575 }
31576
31577 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
31578         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
31579         *ret_copy = COption_FilterZ_none();
31580         uint64_t ret_ref = tag_ptr(ret_copy, true);
31581         return ret_ref;
31582 }
31583
31584 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
31585         if (!ptr_is_owned(_res)) return;
31586         void* _res_ptr = untag_ptr(_res);
31587         CHECK_ACCESS(_res_ptr);
31588         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
31589         FREE(untag_ptr(_res));
31590         COption_FilterZ_free(_res_conv);
31591 }
31592
31593 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
31594         LDKLockedChannelMonitor o_conv;
31595         o_conv.inner = untag_ptr(o);
31596         o_conv.is_owned = ptr_is_owned(o);
31597         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31598         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
31599         
31600         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
31601         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
31602         return tag_ptr(ret_conv, true);
31603 }
31604
31605 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
31606         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
31607         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
31608         return tag_ptr(ret_conv, true);
31609 }
31610
31611 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
31612         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
31613         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
31614         return ret_conv;
31615 }
31616
31617 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
31618         if (!ptr_is_owned(_res)) return;
31619         void* _res_ptr = untag_ptr(_res);
31620         CHECK_ACCESS(_res_ptr);
31621         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
31622         FREE(untag_ptr(_res));
31623         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
31624 }
31625
31626 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
31627         LDKCVec_OutPointZ _res_constr;
31628         _res_constr.datalen = _res->arr_len;
31629         if (_res_constr.datalen > 0)
31630                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
31631         else
31632                 _res_constr.data = NULL;
31633         uint64_t* _res_vals = _res->elems;
31634         for (size_t k = 0; k < _res_constr.datalen; k++) {
31635                 uint64_t _res_conv_10 = _res_vals[k];
31636                 LDKOutPoint _res_conv_10_conv;
31637                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
31638                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
31639                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
31640                 _res_constr.data[k] = _res_conv_10_conv;
31641         }
31642         FREE(_res);
31643         CVec_OutPointZ_free(_res_constr);
31644 }
31645
31646 void  __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) {
31647         LDKCVec_MonitorUpdateIdZ _res_constr;
31648         _res_constr.datalen = _res->arr_len;
31649         if (_res_constr.datalen > 0)
31650                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
31651         else
31652                 _res_constr.data = NULL;
31653         uint64_t* _res_vals = _res->elems;
31654         for (size_t r = 0; r < _res_constr.datalen; r++) {
31655                 uint64_t _res_conv_17 = _res_vals[r];
31656                 LDKMonitorUpdateId _res_conv_17_conv;
31657                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
31658                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
31659                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
31660                 _res_constr.data[r] = _res_conv_17_conv;
31661         }
31662         FREE(_res);
31663         CVec_MonitorUpdateIdZ_free(_res_constr);
31664 }
31665
31666 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
31667         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
31668         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
31669         return tag_ptr(ret_conv, true);
31670 }
31671 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) {
31672         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
31673         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
31674         return ret_conv;
31675 }
31676
31677 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) {
31678         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
31679         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
31680         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
31681         return tag_ptr(ret_conv, true);
31682 }
31683
31684 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) {
31685         LDKOutPoint a_conv;
31686         a_conv.inner = untag_ptr(a);
31687         a_conv.is_owned = ptr_is_owned(a);
31688         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31689         a_conv = OutPoint_clone(&a_conv);
31690         LDKCVec_MonitorUpdateIdZ b_constr;
31691         b_constr.datalen = b->arr_len;
31692         if (b_constr.datalen > 0)
31693                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
31694         else
31695                 b_constr.data = NULL;
31696         uint64_t* b_vals = b->elems;
31697         for (size_t r = 0; r < b_constr.datalen; r++) {
31698                 uint64_t b_conv_17 = b_vals[r];
31699                 LDKMonitorUpdateId b_conv_17_conv;
31700                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
31701                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
31702                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
31703                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
31704                 b_constr.data[r] = b_conv_17_conv;
31705         }
31706         FREE(b);
31707         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
31708         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
31709         return tag_ptr(ret_conv, true);
31710 }
31711
31712 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) {
31713         if (!ptr_is_owned(_res)) return;
31714         void* _res_ptr = untag_ptr(_res);
31715         CHECK_ACCESS(_res_ptr);
31716         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
31717         FREE(untag_ptr(_res));
31718         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
31719 }
31720
31721 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) {
31722         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
31723         _res_constr.datalen = _res->arr_len;
31724         if (_res_constr.datalen > 0)
31725                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
31726         else
31727                 _res_constr.data = NULL;
31728         uint64_t* _res_vals = _res->elems;
31729         for (size_t p = 0; p < _res_constr.datalen; p++) {
31730                 uint64_t _res_conv_41 = _res_vals[p];
31731                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
31732                 CHECK_ACCESS(_res_conv_41_ptr);
31733                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
31734                 FREE(untag_ptr(_res_conv_41));
31735                 _res_constr.data[p] = _res_conv_41_conv;
31736         }
31737         FREE(_res);
31738         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
31739 }
31740
31741 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
31742         if (!ptr_is_owned(this_ptr)) return;
31743         void* this_ptr_ptr = untag_ptr(this_ptr);
31744         CHECK_ACCESS(this_ptr_ptr);
31745         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
31746         FREE(untag_ptr(this_ptr));
31747         APIError_free(this_ptr_conv);
31748 }
31749
31750 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
31751         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
31752         *ret_copy = APIError_clone(arg);
31753         uint64_t ret_ref = tag_ptr(ret_copy, true);
31754         return ret_ref;
31755 }
31756 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
31757         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
31758         int64_t ret_conv = APIError_clone_ptr(arg_conv);
31759         return ret_conv;
31760 }
31761
31762 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
31763         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
31764         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
31765         *ret_copy = APIError_clone(orig_conv);
31766         uint64_t ret_ref = tag_ptr(ret_copy, true);
31767         return ret_ref;
31768 }
31769
31770 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
31771         LDKStr err_conv = str_ref_to_owned_c(err);
31772         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
31773         *ret_copy = APIError_apimisuse_error(err_conv);
31774         uint64_t ret_ref = tag_ptr(ret_copy, true);
31775         return ret_ref;
31776 }
31777
31778 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
31779         LDKStr err_conv = str_ref_to_owned_c(err);
31780         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
31781         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
31782         uint64_t ret_ref = tag_ptr(ret_copy, true);
31783         return ret_ref;
31784 }
31785
31786 uint64_t  __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) {
31787         LDKStr err_conv = str_ref_to_owned_c(err);
31788         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
31789         *ret_copy = APIError_invalid_route(err_conv);
31790         uint64_t ret_ref = tag_ptr(ret_copy, true);
31791         return ret_ref;
31792 }
31793
31794 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
31795         LDKStr err_conv = str_ref_to_owned_c(err);
31796         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
31797         *ret_copy = APIError_channel_unavailable(err_conv);
31798         uint64_t ret_ref = tag_ptr(ret_copy, true);
31799         return ret_ref;
31800 }
31801
31802 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
31803         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
31804         *ret_copy = APIError_monitor_update_in_progress();
31805         uint64_t ret_ref = tag_ptr(ret_copy, true);
31806         return ret_ref;
31807 }
31808
31809 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
31810         LDKShutdownScript script_conv;
31811         script_conv.inner = untag_ptr(script);
31812         script_conv.is_owned = ptr_is_owned(script);
31813         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
31814         script_conv = ShutdownScript_clone(&script_conv);
31815         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
31816         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
31817         uint64_t ret_ref = tag_ptr(ret_copy, true);
31818         return ret_ref;
31819 }
31820
31821 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
31822         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
31823         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
31824         jboolean ret_conv = APIError_eq(a_conv, b_conv);
31825         return ret_conv;
31826 }
31827
31828 int8_tArray  __attribute__((export_name("TS_APIError_write"))) TS_APIError_write(uint64_t obj) {
31829         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
31830         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
31831         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31832         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31833         CVec_u8Z_free(ret_var);
31834         return ret_arr;
31835 }
31836
31837 uint64_t  __attribute__((export_name("TS_APIError_read"))) TS_APIError_read(int8_tArray ser) {
31838         LDKu8slice ser_ref;
31839         ser_ref.datalen = ser->arr_len;
31840         ser_ref.data = ser->elems;
31841         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
31842         *ret_conv = APIError_read(ser_ref);
31843         FREE(ser);
31844         return tag_ptr(ret_conv, true);
31845 }
31846
31847 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
31848         LDKBigSize this_obj_conv;
31849         this_obj_conv.inner = untag_ptr(this_obj);
31850         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31852         BigSize_free(this_obj_conv);
31853 }
31854
31855 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
31856         LDKBigSize this_ptr_conv;
31857         this_ptr_conv.inner = untag_ptr(this_ptr);
31858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31860         this_ptr_conv.is_owned = false;
31861         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
31862         return ret_conv;
31863 }
31864
31865 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
31866         LDKBigSize this_ptr_conv;
31867         this_ptr_conv.inner = untag_ptr(this_ptr);
31868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31870         this_ptr_conv.is_owned = false;
31871         BigSize_set_a(&this_ptr_conv, val);
31872 }
31873
31874 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
31875         LDKBigSize ret_var = BigSize_new(a_arg);
31876         uint64_t ret_ref = 0;
31877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31879         return ret_ref;
31880 }
31881
31882 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
31883         LDKBigSize ret_var = BigSize_clone(arg);
31884         uint64_t ret_ref = 0;
31885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31887         return ret_ref;
31888 }
31889 int64_t  __attribute__((export_name("TS_BigSize_clone_ptr"))) TS_BigSize_clone_ptr(uint64_t arg) {
31890         LDKBigSize arg_conv;
31891         arg_conv.inner = untag_ptr(arg);
31892         arg_conv.is_owned = ptr_is_owned(arg);
31893         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31894         arg_conv.is_owned = false;
31895         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
31896         return ret_conv;
31897 }
31898
31899 uint64_t  __attribute__((export_name("TS_BigSize_clone"))) TS_BigSize_clone(uint64_t orig) {
31900         LDKBigSize orig_conv;
31901         orig_conv.inner = untag_ptr(orig);
31902         orig_conv.is_owned = ptr_is_owned(orig);
31903         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31904         orig_conv.is_owned = false;
31905         LDKBigSize ret_var = BigSize_clone(&orig_conv);
31906         uint64_t ret_ref = 0;
31907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31909         return ret_ref;
31910 }
31911
31912 int64_t  __attribute__((export_name("TS_BigSize_hash"))) TS_BigSize_hash(uint64_t o) {
31913         LDKBigSize o_conv;
31914         o_conv.inner = untag_ptr(o);
31915         o_conv.is_owned = ptr_is_owned(o);
31916         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31917         o_conv.is_owned = false;
31918         int64_t ret_conv = BigSize_hash(&o_conv);
31919         return ret_conv;
31920 }
31921
31922 jboolean  __attribute__((export_name("TS_BigSize_eq"))) TS_BigSize_eq(uint64_t a, uint64_t b) {
31923         LDKBigSize a_conv;
31924         a_conv.inner = untag_ptr(a);
31925         a_conv.is_owned = ptr_is_owned(a);
31926         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31927         a_conv.is_owned = false;
31928         LDKBigSize b_conv;
31929         b_conv.inner = untag_ptr(b);
31930         b_conv.is_owned = ptr_is_owned(b);
31931         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31932         b_conv.is_owned = false;
31933         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
31934         return ret_conv;
31935 }
31936
31937 int8_tArray  __attribute__((export_name("TS_BigSize_write"))) TS_BigSize_write(uint64_t obj) {
31938         LDKBigSize obj_conv;
31939         obj_conv.inner = untag_ptr(obj);
31940         obj_conv.is_owned = ptr_is_owned(obj);
31941         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31942         obj_conv.is_owned = false;
31943         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
31944         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31945         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31946         CVec_u8Z_free(ret_var);
31947         return ret_arr;
31948 }
31949
31950 uint64_t  __attribute__((export_name("TS_BigSize_read"))) TS_BigSize_read(int8_tArray ser) {
31951         LDKu8slice ser_ref;
31952         ser_ref.datalen = ser->arr_len;
31953         ser_ref.data = ser->elems;
31954         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
31955         *ret_conv = BigSize_read(ser_ref);
31956         FREE(ser);
31957         return tag_ptr(ret_conv, true);
31958 }
31959
31960 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
31961         LDKHostname this_obj_conv;
31962         this_obj_conv.inner = untag_ptr(this_obj);
31963         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31965         Hostname_free(this_obj_conv);
31966 }
31967
31968 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
31969         LDKHostname ret_var = Hostname_clone(arg);
31970         uint64_t ret_ref = 0;
31971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31973         return ret_ref;
31974 }
31975 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
31976         LDKHostname arg_conv;
31977         arg_conv.inner = untag_ptr(arg);
31978         arg_conv.is_owned = ptr_is_owned(arg);
31979         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31980         arg_conv.is_owned = false;
31981         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
31982         return ret_conv;
31983 }
31984
31985 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
31986         LDKHostname orig_conv;
31987         orig_conv.inner = untag_ptr(orig);
31988         orig_conv.is_owned = ptr_is_owned(orig);
31989         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31990         orig_conv.is_owned = false;
31991         LDKHostname ret_var = Hostname_clone(&orig_conv);
31992         uint64_t ret_ref = 0;
31993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31995         return ret_ref;
31996 }
31997
31998 int64_t  __attribute__((export_name("TS_Hostname_hash"))) TS_Hostname_hash(uint64_t o) {
31999         LDKHostname o_conv;
32000         o_conv.inner = untag_ptr(o);
32001         o_conv.is_owned = ptr_is_owned(o);
32002         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32003         o_conv.is_owned = false;
32004         int64_t ret_conv = Hostname_hash(&o_conv);
32005         return ret_conv;
32006 }
32007
32008 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
32009         LDKHostname a_conv;
32010         a_conv.inner = untag_ptr(a);
32011         a_conv.is_owned = ptr_is_owned(a);
32012         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32013         a_conv.is_owned = false;
32014         LDKHostname b_conv;
32015         b_conv.inner = untag_ptr(b);
32016         b_conv.is_owned = ptr_is_owned(b);
32017         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32018         b_conv.is_owned = false;
32019         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
32020         return ret_conv;
32021 }
32022
32023 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
32024         LDKHostname this_arg_conv;
32025         this_arg_conv.inner = untag_ptr(this_arg);
32026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32028         this_arg_conv.is_owned = false;
32029         int8_t ret_conv = Hostname_len(&this_arg_conv);
32030         return ret_conv;
32031 }
32032
32033 int8_tArray  __attribute__((export_name("TS_Hostname_write"))) TS_Hostname_write(uint64_t obj) {
32034         LDKHostname obj_conv;
32035         obj_conv.inner = untag_ptr(obj);
32036         obj_conv.is_owned = ptr_is_owned(obj);
32037         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32038         obj_conv.is_owned = false;
32039         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
32040         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32041         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32042         CVec_u8Z_free(ret_var);
32043         return ret_arr;
32044 }
32045
32046 uint64_t  __attribute__((export_name("TS_Hostname_read"))) TS_Hostname_read(int8_tArray ser) {
32047         LDKu8slice ser_ref;
32048         ser_ref.datalen = ser->arr_len;
32049         ser_ref.data = ser->elems;
32050         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
32051         *ret_conv = Hostname_read(ser_ref);
32052         FREE(ser);
32053         return tag_ptr(ret_conv, true);
32054 }
32055
32056 void  __attribute__((export_name("TS_TransactionU16LenLimited_free"))) TS_TransactionU16LenLimited_free(uint64_t this_obj) {
32057         LDKTransactionU16LenLimited this_obj_conv;
32058         this_obj_conv.inner = untag_ptr(this_obj);
32059         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32061         TransactionU16LenLimited_free(this_obj_conv);
32062 }
32063
32064 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
32065         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
32066         uint64_t ret_ref = 0;
32067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32069         return ret_ref;
32070 }
32071 int64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone_ptr"))) TS_TransactionU16LenLimited_clone_ptr(uint64_t arg) {
32072         LDKTransactionU16LenLimited arg_conv;
32073         arg_conv.inner = untag_ptr(arg);
32074         arg_conv.is_owned = ptr_is_owned(arg);
32075         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32076         arg_conv.is_owned = false;
32077         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
32078         return ret_conv;
32079 }
32080
32081 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone"))) TS_TransactionU16LenLimited_clone(uint64_t orig) {
32082         LDKTransactionU16LenLimited orig_conv;
32083         orig_conv.inner = untag_ptr(orig);
32084         orig_conv.is_owned = ptr_is_owned(orig);
32085         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32086         orig_conv.is_owned = false;
32087         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
32088         uint64_t ret_ref = 0;
32089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32091         return ret_ref;
32092 }
32093
32094 int64_t  __attribute__((export_name("TS_TransactionU16LenLimited_hash"))) TS_TransactionU16LenLimited_hash(uint64_t o) {
32095         LDKTransactionU16LenLimited o_conv;
32096         o_conv.inner = untag_ptr(o);
32097         o_conv.is_owned = ptr_is_owned(o);
32098         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32099         o_conv.is_owned = false;
32100         int64_t ret_conv = TransactionU16LenLimited_hash(&o_conv);
32101         return ret_conv;
32102 }
32103
32104 jboolean  __attribute__((export_name("TS_TransactionU16LenLimited_eq"))) TS_TransactionU16LenLimited_eq(uint64_t a, uint64_t b) {
32105         LDKTransactionU16LenLimited a_conv;
32106         a_conv.inner = untag_ptr(a);
32107         a_conv.is_owned = ptr_is_owned(a);
32108         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32109         a_conv.is_owned = false;
32110         LDKTransactionU16LenLimited b_conv;
32111         b_conv.inner = untag_ptr(b);
32112         b_conv.is_owned = ptr_is_owned(b);
32113         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32114         b_conv.is_owned = false;
32115         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
32116         return ret_conv;
32117 }
32118
32119 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_new"))) TS_TransactionU16LenLimited_new(int8_tArray transaction) {
32120         LDKTransaction transaction_ref;
32121         transaction_ref.datalen = transaction->arr_len;
32122         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
32123         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
32124         transaction_ref.data_is_owned = true;
32125         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
32126         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
32127         return tag_ptr(ret_conv, true);
32128 }
32129
32130 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_into_transaction"))) TS_TransactionU16LenLimited_into_transaction(uint64_t this_arg) {
32131         LDKTransactionU16LenLimited this_arg_conv;
32132         this_arg_conv.inner = untag_ptr(this_arg);
32133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32135         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
32136         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
32137         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32138         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32139         Transaction_free(ret_var);
32140         return ret_arr;
32141 }
32142
32143 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_write"))) TS_TransactionU16LenLimited_write(uint64_t obj) {
32144         LDKTransactionU16LenLimited obj_conv;
32145         obj_conv.inner = untag_ptr(obj);
32146         obj_conv.is_owned = ptr_is_owned(obj);
32147         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32148         obj_conv.is_owned = false;
32149         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
32150         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32151         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32152         CVec_u8Z_free(ret_var);
32153         return ret_arr;
32154 }
32155
32156 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_read"))) TS_TransactionU16LenLimited_read(int8_tArray ser) {
32157         LDKu8slice ser_ref;
32158         ser_ref.datalen = ser->arr_len;
32159         ser_ref.data = ser->elems;
32160         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
32161         *ret_conv = TransactionU16LenLimited_read(ser_ref);
32162         FREE(ser);
32163         return tag_ptr(ret_conv, true);
32164 }
32165
32166 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
32167         LDKu8slice msg_ref;
32168         msg_ref.datalen = msg->arr_len;
32169         msg_ref.data = msg->elems;
32170         uint8_t sk_arr[32];
32171         CHECK(sk->arr_len == 32);
32172         memcpy(sk_arr, sk->elems, 32); FREE(sk);
32173         uint8_t (*sk_ref)[32] = &sk_arr;
32174         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
32175         *ret_conv = sign(msg_ref, sk_ref);
32176         FREE(msg);
32177         return tag_ptr(ret_conv, true);
32178 }
32179
32180 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
32181         LDKu8slice msg_ref;
32182         msg_ref.datalen = msg->arr_len;
32183         msg_ref.data = msg->elems;
32184         LDKStr sig_conv = str_ref_to_owned_c(sig);
32185         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
32186         *ret_conv = recover_pk(msg_ref, sig_conv);
32187         FREE(msg);
32188         return tag_ptr(ret_conv, true);
32189 }
32190
32191 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
32192         LDKu8slice msg_ref;
32193         msg_ref.datalen = msg->arr_len;
32194         msg_ref.data = msg->elems;
32195         LDKStr sig_conv = str_ref_to_owned_c(sig);
32196         LDKPublicKey pk_ref;
32197         CHECK(pk->arr_len == 33);
32198         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
32199         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
32200         FREE(msg);
32201         return ret_conv;
32202 }
32203
32204 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
32205         LDKu8slice hrp_bytes_ref;
32206         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
32207         hrp_bytes_ref.data = hrp_bytes->elems;
32208         LDKCVec_U5Z data_without_signature_constr;
32209         data_without_signature_constr.datalen = data_without_signature->arr_len;
32210         if (data_without_signature_constr.datalen > 0)
32211                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
32212         else
32213                 data_without_signature_constr.data = NULL;
32214         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
32215         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
32216                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
32217                 
32218                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
32219         }
32220         FREE(data_without_signature);
32221         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
32222         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32223         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32224         CVec_u8Z_free(ret_var);
32225         FREE(hrp_bytes);
32226         return ret_arr;
32227 }
32228
32229 void  __attribute__((export_name("TS_KVStore_free"))) TS_KVStore_free(uint64_t this_ptr) {
32230         if (!ptr_is_owned(this_ptr)) return;
32231         void* this_ptr_ptr = untag_ptr(this_ptr);
32232         CHECK_ACCESS(this_ptr_ptr);
32233         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
32234         FREE(untag_ptr(this_ptr));
32235         KVStore_free(this_ptr_conv);
32236 }
32237
32238 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
32239         if (!ptr_is_owned(this_ptr)) return;
32240         void* this_ptr_ptr = untag_ptr(this_ptr);
32241         CHECK_ACCESS(this_ptr_ptr);
32242         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
32243         FREE(untag_ptr(this_ptr));
32244         Persister_free(this_ptr_conv);
32245 }
32246
32247 uint64_t  __attribute__((export_name("TS_read_channel_monitors"))) TS_read_channel_monitors(uint64_t kv_store, uint64_t entropy_source, uint64_t signer_provider) {
32248         void* kv_store_ptr = untag_ptr(kv_store);
32249         CHECK_ACCESS(kv_store_ptr);
32250         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
32251         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
32252                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32253                 LDKKVStore_JCalls_cloned(&kv_store_conv);
32254         }
32255         void* entropy_source_ptr = untag_ptr(entropy_source);
32256         CHECK_ACCESS(entropy_source_ptr);
32257         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
32258         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
32259                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32260                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
32261         }
32262         void* signer_provider_ptr = untag_ptr(signer_provider);
32263         CHECK_ACCESS(signer_provider_ptr);
32264         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
32265         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
32266                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32267                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
32268         }
32269         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32270         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
32271         return tag_ptr(ret_conv, true);
32272 }
32273
32274 void  __attribute__((export_name("TS_MonitorUpdatingPersister_free"))) TS_MonitorUpdatingPersister_free(uint64_t this_obj) {
32275         LDKMonitorUpdatingPersister this_obj_conv;
32276         this_obj_conv.inner = untag_ptr(this_obj);
32277         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32279         MonitorUpdatingPersister_free(this_obj_conv);
32280 }
32281
32282 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_new"))) TS_MonitorUpdatingPersister_new(uint64_t kv_store, uint64_t logger, int64_t maximum_pending_updates, uint64_t entropy_source, uint64_t signer_provider) {
32283         void* kv_store_ptr = untag_ptr(kv_store);
32284         CHECK_ACCESS(kv_store_ptr);
32285         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
32286         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
32287                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32288                 LDKKVStore_JCalls_cloned(&kv_store_conv);
32289         }
32290         void* logger_ptr = untag_ptr(logger);
32291         CHECK_ACCESS(logger_ptr);
32292         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32293         if (logger_conv.free == LDKLogger_JCalls_free) {
32294                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32295                 LDKLogger_JCalls_cloned(&logger_conv);
32296         }
32297         void* entropy_source_ptr = untag_ptr(entropy_source);
32298         CHECK_ACCESS(entropy_source_ptr);
32299         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
32300         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
32301                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32302                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
32303         }
32304         void* signer_provider_ptr = untag_ptr(signer_provider);
32305         CHECK_ACCESS(signer_provider_ptr);
32306         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
32307         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
32308                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32309                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
32310         }
32311         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
32312         uint64_t ret_ref = 0;
32313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32315         return ret_ref;
32316 }
32317
32318 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_read_all_channel_monitors_with_updates"))) TS_MonitorUpdatingPersister_read_all_channel_monitors_with_updates(uint64_t this_arg, uint64_t broadcaster, uint64_t fee_estimator) {
32319         LDKMonitorUpdatingPersister this_arg_conv;
32320         this_arg_conv.inner = untag_ptr(this_arg);
32321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32323         this_arg_conv.is_owned = false;
32324         void* broadcaster_ptr = untag_ptr(broadcaster);
32325         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
32326         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
32327         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32328         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
32329         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
32330         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32331         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
32332         return tag_ptr(ret_conv, true);
32333 }
32334
32335 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_read_channel_monitor_with_updates"))) TS_MonitorUpdatingPersister_read_channel_monitor_with_updates(uint64_t this_arg, uint64_t broadcaster, uint64_t fee_estimator, jstring monitor_key) {
32336         LDKMonitorUpdatingPersister this_arg_conv;
32337         this_arg_conv.inner = untag_ptr(this_arg);
32338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32340         this_arg_conv.is_owned = false;
32341         void* broadcaster_ptr = untag_ptr(broadcaster);
32342         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
32343         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
32344         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32345         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
32346         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
32347         LDKStr monitor_key_conv = str_ref_to_owned_c(monitor_key);
32348         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
32349         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
32350         return tag_ptr(ret_conv, true);
32351 }
32352
32353 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_cleanup_stale_updates"))) TS_MonitorUpdatingPersister_cleanup_stale_updates(uint64_t this_arg, jboolean lazy) {
32354         LDKMonitorUpdatingPersister this_arg_conv;
32355         this_arg_conv.inner = untag_ptr(this_arg);
32356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32358         this_arg_conv.is_owned = false;
32359         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
32360         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
32361         return tag_ptr(ret_conv, true);
32362 }
32363
32364 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_as_Persist"))) TS_MonitorUpdatingPersister_as_Persist(uint64_t this_arg) {
32365         LDKMonitorUpdatingPersister this_arg_conv;
32366         this_arg_conv.inner = untag_ptr(this_arg);
32367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32369         this_arg_conv.is_owned = false;
32370         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
32371         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
32372         return tag_ptr(ret_ret, true);
32373 }
32374
32375 void  __attribute__((export_name("TS_UntrustedString_free"))) TS_UntrustedString_free(uint64_t this_obj) {
32376         LDKUntrustedString this_obj_conv;
32377         this_obj_conv.inner = untag_ptr(this_obj);
32378         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32380         UntrustedString_free(this_obj_conv);
32381 }
32382
32383 jstring  __attribute__((export_name("TS_UntrustedString_get_a"))) TS_UntrustedString_get_a(uint64_t this_ptr) {
32384         LDKUntrustedString this_ptr_conv;
32385         this_ptr_conv.inner = untag_ptr(this_ptr);
32386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32388         this_ptr_conv.is_owned = false;
32389         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
32390         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
32391         Str_free(ret_str);
32392         return ret_conv;
32393 }
32394
32395 void  __attribute__((export_name("TS_UntrustedString_set_a"))) TS_UntrustedString_set_a(uint64_t this_ptr, jstring val) {
32396         LDKUntrustedString this_ptr_conv;
32397         this_ptr_conv.inner = untag_ptr(this_ptr);
32398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32400         this_ptr_conv.is_owned = false;
32401         LDKStr val_conv = str_ref_to_owned_c(val);
32402         UntrustedString_set_a(&this_ptr_conv, val_conv);
32403 }
32404
32405 uint64_t  __attribute__((export_name("TS_UntrustedString_new"))) TS_UntrustedString_new(jstring a_arg) {
32406         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
32407         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
32408         uint64_t ret_ref = 0;
32409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32411         return ret_ref;
32412 }
32413
32414 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
32415         LDKUntrustedString ret_var = UntrustedString_clone(arg);
32416         uint64_t ret_ref = 0;
32417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32419         return ret_ref;
32420 }
32421 int64_t  __attribute__((export_name("TS_UntrustedString_clone_ptr"))) TS_UntrustedString_clone_ptr(uint64_t arg) {
32422         LDKUntrustedString arg_conv;
32423         arg_conv.inner = untag_ptr(arg);
32424         arg_conv.is_owned = ptr_is_owned(arg);
32425         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32426         arg_conv.is_owned = false;
32427         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
32428         return ret_conv;
32429 }
32430
32431 uint64_t  __attribute__((export_name("TS_UntrustedString_clone"))) TS_UntrustedString_clone(uint64_t orig) {
32432         LDKUntrustedString orig_conv;
32433         orig_conv.inner = untag_ptr(orig);
32434         orig_conv.is_owned = ptr_is_owned(orig);
32435         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32436         orig_conv.is_owned = false;
32437         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
32438         uint64_t ret_ref = 0;
32439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32441         return ret_ref;
32442 }
32443
32444 jboolean  __attribute__((export_name("TS_UntrustedString_eq"))) TS_UntrustedString_eq(uint64_t a, uint64_t b) {
32445         LDKUntrustedString a_conv;
32446         a_conv.inner = untag_ptr(a);
32447         a_conv.is_owned = ptr_is_owned(a);
32448         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32449         a_conv.is_owned = false;
32450         LDKUntrustedString b_conv;
32451         b_conv.inner = untag_ptr(b);
32452         b_conv.is_owned = ptr_is_owned(b);
32453         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32454         b_conv.is_owned = false;
32455         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
32456         return ret_conv;
32457 }
32458
32459 int64_t  __attribute__((export_name("TS_UntrustedString_hash"))) TS_UntrustedString_hash(uint64_t o) {
32460         LDKUntrustedString o_conv;
32461         o_conv.inner = untag_ptr(o);
32462         o_conv.is_owned = ptr_is_owned(o);
32463         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32464         o_conv.is_owned = false;
32465         int64_t ret_conv = UntrustedString_hash(&o_conv);
32466         return ret_conv;
32467 }
32468
32469 int8_tArray  __attribute__((export_name("TS_UntrustedString_write"))) TS_UntrustedString_write(uint64_t obj) {
32470         LDKUntrustedString obj_conv;
32471         obj_conv.inner = untag_ptr(obj);
32472         obj_conv.is_owned = ptr_is_owned(obj);
32473         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32474         obj_conv.is_owned = false;
32475         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
32476         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32477         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32478         CVec_u8Z_free(ret_var);
32479         return ret_arr;
32480 }
32481
32482 uint64_t  __attribute__((export_name("TS_UntrustedString_read"))) TS_UntrustedString_read(int8_tArray ser) {
32483         LDKu8slice ser_ref;
32484         ser_ref.datalen = ser->arr_len;
32485         ser_ref.data = ser->elems;
32486         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
32487         *ret_conv = UntrustedString_read(ser_ref);
32488         FREE(ser);
32489         return tag_ptr(ret_conv, true);
32490 }
32491
32492 void  __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) {
32493         LDKPrintableString this_obj_conv;
32494         this_obj_conv.inner = untag_ptr(this_obj);
32495         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32497         PrintableString_free(this_obj_conv);
32498 }
32499
32500 jstring  __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) {
32501         LDKPrintableString this_ptr_conv;
32502         this_ptr_conv.inner = untag_ptr(this_ptr);
32503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32505         this_ptr_conv.is_owned = false;
32506         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
32507         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
32508         Str_free(ret_str);
32509         return ret_conv;
32510 }
32511
32512 void  __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) {
32513         LDKPrintableString this_ptr_conv;
32514         this_ptr_conv.inner = untag_ptr(this_ptr);
32515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32517         this_ptr_conv.is_owned = false;
32518         LDKStr val_conv = str_ref_to_owned_c(val);
32519         PrintableString_set_a(&this_ptr_conv, val_conv);
32520 }
32521
32522 uint64_t  __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) {
32523         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
32524         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
32525         uint64_t ret_ref = 0;
32526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32528         return ret_ref;
32529 }
32530
32531 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
32532         if (!ptr_is_owned(this_ptr)) return;
32533         void* this_ptr_ptr = untag_ptr(this_ptr);
32534         CHECK_ACCESS(this_ptr_ptr);
32535         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
32536         FREE(untag_ptr(this_ptr));
32537         FutureCallback_free(this_ptr_conv);
32538 }
32539
32540 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
32541         LDKFuture this_obj_conv;
32542         this_obj_conv.inner = untag_ptr(this_obj);
32543         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32545         Future_free(this_obj_conv);
32546 }
32547
32548 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
32549         LDKFuture ret_var = Future_clone(arg);
32550         uint64_t ret_ref = 0;
32551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32553         return ret_ref;
32554 }
32555 int64_t  __attribute__((export_name("TS_Future_clone_ptr"))) TS_Future_clone_ptr(uint64_t arg) {
32556         LDKFuture arg_conv;
32557         arg_conv.inner = untag_ptr(arg);
32558         arg_conv.is_owned = ptr_is_owned(arg);
32559         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32560         arg_conv.is_owned = false;
32561         int64_t ret_conv = Future_clone_ptr(&arg_conv);
32562         return ret_conv;
32563 }
32564
32565 uint64_t  __attribute__((export_name("TS_Future_clone"))) TS_Future_clone(uint64_t orig) {
32566         LDKFuture orig_conv;
32567         orig_conv.inner = untag_ptr(orig);
32568         orig_conv.is_owned = ptr_is_owned(orig);
32569         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32570         orig_conv.is_owned = false;
32571         LDKFuture ret_var = Future_clone(&orig_conv);
32572         uint64_t ret_ref = 0;
32573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32575         return ret_ref;
32576 }
32577
32578 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
32579         LDKFuture this_arg_conv;
32580         this_arg_conv.inner = untag_ptr(this_arg);
32581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32583         this_arg_conv.is_owned = false;
32584         void* callback_ptr = untag_ptr(callback);
32585         CHECK_ACCESS(callback_ptr);
32586         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
32587         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
32588                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32589                 LDKFutureCallback_JCalls_cloned(&callback_conv);
32590         }
32591         Future_register_callback_fn(&this_arg_conv, callback_conv);
32592 }
32593
32594 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
32595         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
32596         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
32597         return ret_conv;
32598 }
32599
32600 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
32601         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
32602         return ret_conv;
32603 }
32604
32605 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
32606         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
32607         return ret_conv;
32608 }
32609
32610 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
32611         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
32612         return ret_conv;
32613 }
32614
32615 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
32616         uint32_t ret_conv = LDKLevel_to_js(Level_info());
32617         return ret_conv;
32618 }
32619
32620 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
32621         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
32622         return ret_conv;
32623 }
32624
32625 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
32626         uint32_t ret_conv = LDKLevel_to_js(Level_error());
32627         return ret_conv;
32628 }
32629
32630 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
32631         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
32632         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
32633         jboolean ret_conv = Level_eq(a_conv, b_conv);
32634         return ret_conv;
32635 }
32636
32637 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
32638         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
32639         int64_t ret_conv = Level_hash(o_conv);
32640         return ret_conv;
32641 }
32642
32643 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
32644         uint32_t ret_conv = LDKLevel_to_js(Level_max());
32645         return ret_conv;
32646 }
32647
32648 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
32649         LDKRecord this_obj_conv;
32650         this_obj_conv.inner = untag_ptr(this_obj);
32651         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32653         Record_free(this_obj_conv);
32654 }
32655
32656 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
32657         LDKRecord this_ptr_conv;
32658         this_ptr_conv.inner = untag_ptr(this_ptr);
32659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32661         this_ptr_conv.is_owned = false;
32662         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
32663         return ret_conv;
32664 }
32665
32666 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
32667         LDKRecord this_ptr_conv;
32668         this_ptr_conv.inner = untag_ptr(this_ptr);
32669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32671         this_ptr_conv.is_owned = false;
32672         LDKLevel val_conv = LDKLevel_from_js(val);
32673         Record_set_level(&this_ptr_conv, val_conv);
32674 }
32675
32676 int8_tArray  __attribute__((export_name("TS_Record_get_peer_id"))) TS_Record_get_peer_id(uint64_t this_ptr) {
32677         LDKRecord this_ptr_conv;
32678         this_ptr_conv.inner = untag_ptr(this_ptr);
32679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32681         this_ptr_conv.is_owned = false;
32682         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32683         memcpy(ret_arr->elems, Record_get_peer_id(&this_ptr_conv).compressed_form, 33);
32684         return ret_arr;
32685 }
32686
32687 void  __attribute__((export_name("TS_Record_set_peer_id"))) TS_Record_set_peer_id(uint64_t this_ptr, int8_tArray val) {
32688         LDKRecord this_ptr_conv;
32689         this_ptr_conv.inner = untag_ptr(this_ptr);
32690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32692         this_ptr_conv.is_owned = false;
32693         LDKPublicKey val_ref;
32694         CHECK(val->arr_len == 33);
32695         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32696         Record_set_peer_id(&this_ptr_conv, val_ref);
32697 }
32698
32699 uint64_t  __attribute__((export_name("TS_Record_get_channel_id"))) TS_Record_get_channel_id(uint64_t this_ptr) {
32700         LDKRecord this_ptr_conv;
32701         this_ptr_conv.inner = untag_ptr(this_ptr);
32702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32704         this_ptr_conv.is_owned = false;
32705         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
32706         *ret_copy = Record_get_channel_id(&this_ptr_conv);
32707         uint64_t ret_ref = tag_ptr(ret_copy, true);
32708         return ret_ref;
32709 }
32710
32711 void  __attribute__((export_name("TS_Record_set_channel_id"))) TS_Record_set_channel_id(uint64_t this_ptr, uint64_t val) {
32712         LDKRecord this_ptr_conv;
32713         this_ptr_conv.inner = untag_ptr(this_ptr);
32714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32716         this_ptr_conv.is_owned = false;
32717         void* val_ptr = untag_ptr(val);
32718         CHECK_ACCESS(val_ptr);
32719         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
32720         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
32721         Record_set_channel_id(&this_ptr_conv, val_conv);
32722 }
32723
32724 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
32725         LDKRecord this_ptr_conv;
32726         this_ptr_conv.inner = untag_ptr(this_ptr);
32727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32729         this_ptr_conv.is_owned = false;
32730         LDKStr ret_str = Record_get_args(&this_ptr_conv);
32731         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
32732         Str_free(ret_str);
32733         return ret_conv;
32734 }
32735
32736 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
32737         LDKRecord this_ptr_conv;
32738         this_ptr_conv.inner = untag_ptr(this_ptr);
32739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32741         this_ptr_conv.is_owned = false;
32742         LDKStr val_conv = str_ref_to_owned_c(val);
32743         Record_set_args(&this_ptr_conv, val_conv);
32744 }
32745
32746 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
32747         LDKRecord this_ptr_conv;
32748         this_ptr_conv.inner = untag_ptr(this_ptr);
32749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32751         this_ptr_conv.is_owned = false;
32752         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
32753         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
32754         Str_free(ret_str);
32755         return ret_conv;
32756 }
32757
32758 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
32759         LDKRecord this_ptr_conv;
32760         this_ptr_conv.inner = untag_ptr(this_ptr);
32761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32763         this_ptr_conv.is_owned = false;
32764         LDKStr val_conv = str_ref_to_owned_c(val);
32765         Record_set_module_path(&this_ptr_conv, val_conv);
32766 }
32767
32768 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
32769         LDKRecord this_ptr_conv;
32770         this_ptr_conv.inner = untag_ptr(this_ptr);
32771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32773         this_ptr_conv.is_owned = false;
32774         LDKStr ret_str = Record_get_file(&this_ptr_conv);
32775         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
32776         Str_free(ret_str);
32777         return ret_conv;
32778 }
32779
32780 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
32781         LDKRecord this_ptr_conv;
32782         this_ptr_conv.inner = untag_ptr(this_ptr);
32783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32785         this_ptr_conv.is_owned = false;
32786         LDKStr val_conv = str_ref_to_owned_c(val);
32787         Record_set_file(&this_ptr_conv, val_conv);
32788 }
32789
32790 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
32791         LDKRecord this_ptr_conv;
32792         this_ptr_conv.inner = untag_ptr(this_ptr);
32793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32795         this_ptr_conv.is_owned = false;
32796         int32_t ret_conv = Record_get_line(&this_ptr_conv);
32797         return ret_conv;
32798 }
32799
32800 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
32801         LDKRecord this_ptr_conv;
32802         this_ptr_conv.inner = untag_ptr(this_ptr);
32803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32805         this_ptr_conv.is_owned = false;
32806         Record_set_line(&this_ptr_conv, val);
32807 }
32808
32809 uint64_t  __attribute__((export_name("TS_Record_new"))) TS_Record_new(uint32_t level_arg, int8_tArray peer_id_arg, uint64_t channel_id_arg, jstring args_arg, jstring module_path_arg, jstring file_arg, int32_t line_arg) {
32810         LDKLevel level_arg_conv = LDKLevel_from_js(level_arg);
32811         LDKPublicKey peer_id_arg_ref;
32812         CHECK(peer_id_arg->arr_len == 33);
32813         memcpy(peer_id_arg_ref.compressed_form, peer_id_arg->elems, 33); FREE(peer_id_arg);
32814         void* channel_id_arg_ptr = untag_ptr(channel_id_arg);
32815         CHECK_ACCESS(channel_id_arg_ptr);
32816         LDKCOption_ThirtyTwoBytesZ channel_id_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_arg_ptr);
32817         channel_id_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id_arg));
32818         LDKStr args_arg_conv = str_ref_to_owned_c(args_arg);
32819         LDKStr module_path_arg_conv = str_ref_to_owned_c(module_path_arg);
32820         LDKStr file_arg_conv = str_ref_to_owned_c(file_arg);
32821         LDKRecord ret_var = Record_new(level_arg_conv, peer_id_arg_ref, channel_id_arg_conv, args_arg_conv, module_path_arg_conv, file_arg_conv, line_arg);
32822         uint64_t ret_ref = 0;
32823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32825         return ret_ref;
32826 }
32827
32828 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
32829         LDKRecord ret_var = Record_clone(arg);
32830         uint64_t ret_ref = 0;
32831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32833         return ret_ref;
32834 }
32835 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
32836         LDKRecord arg_conv;
32837         arg_conv.inner = untag_ptr(arg);
32838         arg_conv.is_owned = ptr_is_owned(arg);
32839         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32840         arg_conv.is_owned = false;
32841         int64_t ret_conv = Record_clone_ptr(&arg_conv);
32842         return ret_conv;
32843 }
32844
32845 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
32846         LDKRecord orig_conv;
32847         orig_conv.inner = untag_ptr(orig);
32848         orig_conv.is_owned = ptr_is_owned(orig);
32849         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32850         orig_conv.is_owned = false;
32851         LDKRecord ret_var = Record_clone(&orig_conv);
32852         uint64_t ret_ref = 0;
32853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32855         return ret_ref;
32856 }
32857
32858 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
32859         if (!ptr_is_owned(this_ptr)) return;
32860         void* this_ptr_ptr = untag_ptr(this_ptr);
32861         CHECK_ACCESS(this_ptr_ptr);
32862         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
32863         FREE(untag_ptr(this_ptr));
32864         Logger_free(this_ptr_conv);
32865 }
32866
32867 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
32868         LDKChannelHandshakeConfig this_obj_conv;
32869         this_obj_conv.inner = untag_ptr(this_obj);
32870         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32872         ChannelHandshakeConfig_free(this_obj_conv);
32873 }
32874
32875 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
32876         LDKChannelHandshakeConfig this_ptr_conv;
32877         this_ptr_conv.inner = untag_ptr(this_ptr);
32878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32880         this_ptr_conv.is_owned = false;
32881         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
32882         return ret_conv;
32883 }
32884
32885 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
32886         LDKChannelHandshakeConfig this_ptr_conv;
32887         this_ptr_conv.inner = untag_ptr(this_ptr);
32888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32890         this_ptr_conv.is_owned = false;
32891         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
32892 }
32893
32894 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
32895         LDKChannelHandshakeConfig this_ptr_conv;
32896         this_ptr_conv.inner = untag_ptr(this_ptr);
32897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32899         this_ptr_conv.is_owned = false;
32900         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
32901         return ret_conv;
32902 }
32903
32904 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) {
32905         LDKChannelHandshakeConfig this_ptr_conv;
32906         this_ptr_conv.inner = untag_ptr(this_ptr);
32907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32909         this_ptr_conv.is_owned = false;
32910         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
32911 }
32912
32913 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
32914         LDKChannelHandshakeConfig this_ptr_conv;
32915         this_ptr_conv.inner = untag_ptr(this_ptr);
32916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32918         this_ptr_conv.is_owned = false;
32919         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
32920         return ret_conv;
32921 }
32922
32923 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) {
32924         LDKChannelHandshakeConfig this_ptr_conv;
32925         this_ptr_conv.inner = untag_ptr(this_ptr);
32926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32928         this_ptr_conv.is_owned = false;
32929         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
32930 }
32931
32932 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) {
32933         LDKChannelHandshakeConfig this_ptr_conv;
32934         this_ptr_conv.inner = untag_ptr(this_ptr);
32935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32937         this_ptr_conv.is_owned = false;
32938         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
32939         return ret_conv;
32940 }
32941
32942 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) {
32943         LDKChannelHandshakeConfig this_ptr_conv;
32944         this_ptr_conv.inner = untag_ptr(this_ptr);
32945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32947         this_ptr_conv.is_owned = false;
32948         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
32949 }
32950
32951 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
32952         LDKChannelHandshakeConfig this_ptr_conv;
32953         this_ptr_conv.inner = untag_ptr(this_ptr);
32954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32956         this_ptr_conv.is_owned = false;
32957         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
32958         return ret_conv;
32959 }
32960
32961 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
32962         LDKChannelHandshakeConfig this_ptr_conv;
32963         this_ptr_conv.inner = untag_ptr(this_ptr);
32964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32966         this_ptr_conv.is_owned = false;
32967         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
32968 }
32969
32970 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
32971         LDKChannelHandshakeConfig this_ptr_conv;
32972         this_ptr_conv.inner = untag_ptr(this_ptr);
32973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32975         this_ptr_conv.is_owned = false;
32976         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
32977         return ret_conv;
32978 }
32979
32980 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
32981         LDKChannelHandshakeConfig this_ptr_conv;
32982         this_ptr_conv.inner = untag_ptr(this_ptr);
32983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32985         this_ptr_conv.is_owned = false;
32986         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
32987 }
32988
32989 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
32990         LDKChannelHandshakeConfig this_ptr_conv;
32991         this_ptr_conv.inner = untag_ptr(this_ptr);
32992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32994         this_ptr_conv.is_owned = false;
32995         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
32996         return ret_conv;
32997 }
32998
32999 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
33000         LDKChannelHandshakeConfig this_ptr_conv;
33001         this_ptr_conv.inner = untag_ptr(this_ptr);
33002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33004         this_ptr_conv.is_owned = false;
33005         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
33006 }
33007
33008 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) {
33009         LDKChannelHandshakeConfig this_ptr_conv;
33010         this_ptr_conv.inner = untag_ptr(this_ptr);
33011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33013         this_ptr_conv.is_owned = false;
33014         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
33015         return ret_conv;
33016 }
33017
33018 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) {
33019         LDKChannelHandshakeConfig this_ptr_conv;
33020         this_ptr_conv.inner = untag_ptr(this_ptr);
33021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33023         this_ptr_conv.is_owned = false;
33024         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
33025 }
33026
33027 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) {
33028         LDKChannelHandshakeConfig this_ptr_conv;
33029         this_ptr_conv.inner = untag_ptr(this_ptr);
33030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33032         this_ptr_conv.is_owned = false;
33033         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
33034         return ret_conv;
33035 }
33036
33037 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) {
33038         LDKChannelHandshakeConfig this_ptr_conv;
33039         this_ptr_conv.inner = untag_ptr(this_ptr);
33040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33042         this_ptr_conv.is_owned = false;
33043         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
33044 }
33045
33046 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs"))) TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs(uint64_t this_ptr) {
33047         LDKChannelHandshakeConfig this_ptr_conv;
33048         this_ptr_conv.inner = untag_ptr(this_ptr);
33049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33051         this_ptr_conv.is_owned = false;
33052         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
33053         return ret_conv;
33054 }
33055
33056 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) {
33057         LDKChannelHandshakeConfig this_ptr_conv;
33058         this_ptr_conv.inner = untag_ptr(this_ptr);
33059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33061         this_ptr_conv.is_owned = false;
33062         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
33063 }
33064
33065 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) {
33066         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);
33067         uint64_t ret_ref = 0;
33068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33070         return ret_ref;
33071 }
33072
33073 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
33074         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
33075         uint64_t ret_ref = 0;
33076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33078         return ret_ref;
33079 }
33080 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
33081         LDKChannelHandshakeConfig arg_conv;
33082         arg_conv.inner = untag_ptr(arg);
33083         arg_conv.is_owned = ptr_is_owned(arg);
33084         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33085         arg_conv.is_owned = false;
33086         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
33087         return ret_conv;
33088 }
33089
33090 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
33091         LDKChannelHandshakeConfig orig_conv;
33092         orig_conv.inner = untag_ptr(orig);
33093         orig_conv.is_owned = ptr_is_owned(orig);
33094         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33095         orig_conv.is_owned = false;
33096         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
33097         uint64_t ret_ref = 0;
33098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33100         return ret_ref;
33101 }
33102
33103 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
33104         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
33105         uint64_t ret_ref = 0;
33106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33108         return ret_ref;
33109 }
33110
33111 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
33112         LDKChannelHandshakeLimits this_obj_conv;
33113         this_obj_conv.inner = untag_ptr(this_obj);
33114         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33116         ChannelHandshakeLimits_free(this_obj_conv);
33117 }
33118
33119 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
33120         LDKChannelHandshakeLimits this_ptr_conv;
33121         this_ptr_conv.inner = untag_ptr(this_ptr);
33122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33124         this_ptr_conv.is_owned = false;
33125         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
33126         return ret_conv;
33127 }
33128
33129 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
33130         LDKChannelHandshakeLimits this_ptr_conv;
33131         this_ptr_conv.inner = untag_ptr(this_ptr);
33132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33134         this_ptr_conv.is_owned = false;
33135         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
33136 }
33137
33138 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
33139         LDKChannelHandshakeLimits this_ptr_conv;
33140         this_ptr_conv.inner = untag_ptr(this_ptr);
33141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33143         this_ptr_conv.is_owned = false;
33144         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
33145         return ret_conv;
33146 }
33147
33148 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
33149         LDKChannelHandshakeLimits this_ptr_conv;
33150         this_ptr_conv.inner = untag_ptr(this_ptr);
33151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33153         this_ptr_conv.is_owned = false;
33154         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
33155 }
33156
33157 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
33158         LDKChannelHandshakeLimits this_ptr_conv;
33159         this_ptr_conv.inner = untag_ptr(this_ptr);
33160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33162         this_ptr_conv.is_owned = false;
33163         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
33164         return ret_conv;
33165 }
33166
33167 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) {
33168         LDKChannelHandshakeLimits this_ptr_conv;
33169         this_ptr_conv.inner = untag_ptr(this_ptr);
33170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33172         this_ptr_conv.is_owned = false;
33173         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
33174 }
33175
33176 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) {
33177         LDKChannelHandshakeLimits this_ptr_conv;
33178         this_ptr_conv.inner = untag_ptr(this_ptr);
33179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33181         this_ptr_conv.is_owned = false;
33182         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
33183         return ret_conv;
33184 }
33185
33186 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) {
33187         LDKChannelHandshakeLimits this_ptr_conv;
33188         this_ptr_conv.inner = untag_ptr(this_ptr);
33189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33191         this_ptr_conv.is_owned = false;
33192         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
33193 }
33194
33195 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
33196         LDKChannelHandshakeLimits this_ptr_conv;
33197         this_ptr_conv.inner = untag_ptr(this_ptr);
33198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33200         this_ptr_conv.is_owned = false;
33201         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
33202         return ret_conv;
33203 }
33204
33205 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) {
33206         LDKChannelHandshakeLimits this_ptr_conv;
33207         this_ptr_conv.inner = untag_ptr(this_ptr);
33208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33210         this_ptr_conv.is_owned = false;
33211         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
33212 }
33213
33214 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
33215         LDKChannelHandshakeLimits this_ptr_conv;
33216         this_ptr_conv.inner = untag_ptr(this_ptr);
33217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33219         this_ptr_conv.is_owned = false;
33220         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
33221         return ret_conv;
33222 }
33223
33224 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) {
33225         LDKChannelHandshakeLimits this_ptr_conv;
33226         this_ptr_conv.inner = untag_ptr(this_ptr);
33227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33229         this_ptr_conv.is_owned = false;
33230         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
33231 }
33232
33233 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
33234         LDKChannelHandshakeLimits this_ptr_conv;
33235         this_ptr_conv.inner = untag_ptr(this_ptr);
33236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33238         this_ptr_conv.is_owned = false;
33239         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
33240         return ret_conv;
33241 }
33242
33243 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
33244         LDKChannelHandshakeLimits this_ptr_conv;
33245         this_ptr_conv.inner = untag_ptr(this_ptr);
33246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33248         this_ptr_conv.is_owned = false;
33249         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
33250 }
33251
33252 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
33253         LDKChannelHandshakeLimits this_ptr_conv;
33254         this_ptr_conv.inner = untag_ptr(this_ptr);
33255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33257         this_ptr_conv.is_owned = false;
33258         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
33259         return ret_conv;
33260 }
33261
33262 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
33263         LDKChannelHandshakeLimits this_ptr_conv;
33264         this_ptr_conv.inner = untag_ptr(this_ptr);
33265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33267         this_ptr_conv.is_owned = false;
33268         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
33269 }
33270
33271 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
33272         LDKChannelHandshakeLimits this_ptr_conv;
33273         this_ptr_conv.inner = untag_ptr(this_ptr);
33274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33276         this_ptr_conv.is_owned = false;
33277         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
33278         return ret_conv;
33279 }
33280
33281 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
33282         LDKChannelHandshakeLimits this_ptr_conv;
33283         this_ptr_conv.inner = untag_ptr(this_ptr);
33284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33286         this_ptr_conv.is_owned = false;
33287         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
33288 }
33289
33290 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
33291         LDKChannelHandshakeLimits this_ptr_conv;
33292         this_ptr_conv.inner = untag_ptr(this_ptr);
33293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33295         this_ptr_conv.is_owned = false;
33296         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
33297         return ret_conv;
33298 }
33299
33300 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) {
33301         LDKChannelHandshakeLimits this_ptr_conv;
33302         this_ptr_conv.inner = untag_ptr(this_ptr);
33303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33305         this_ptr_conv.is_owned = false;
33306         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
33307 }
33308
33309 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) {
33310         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);
33311         uint64_t ret_ref = 0;
33312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33314         return ret_ref;
33315 }
33316
33317 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
33318         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
33319         uint64_t ret_ref = 0;
33320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33322         return ret_ref;
33323 }
33324 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
33325         LDKChannelHandshakeLimits arg_conv;
33326         arg_conv.inner = untag_ptr(arg);
33327         arg_conv.is_owned = ptr_is_owned(arg);
33328         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33329         arg_conv.is_owned = false;
33330         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
33331         return ret_conv;
33332 }
33333
33334 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
33335         LDKChannelHandshakeLimits orig_conv;
33336         orig_conv.inner = untag_ptr(orig);
33337         orig_conv.is_owned = ptr_is_owned(orig);
33338         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33339         orig_conv.is_owned = false;
33340         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
33341         uint64_t ret_ref = 0;
33342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33344         return ret_ref;
33345 }
33346
33347 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
33348         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
33349         uint64_t ret_ref = 0;
33350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33352         return ret_ref;
33353 }
33354
33355 void  __attribute__((export_name("TS_MaxDustHTLCExposure_free"))) TS_MaxDustHTLCExposure_free(uint64_t this_ptr) {
33356         if (!ptr_is_owned(this_ptr)) return;
33357         void* this_ptr_ptr = untag_ptr(this_ptr);
33358         CHECK_ACCESS(this_ptr_ptr);
33359         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
33360         FREE(untag_ptr(this_ptr));
33361         MaxDustHTLCExposure_free(this_ptr_conv);
33362 }
33363
33364 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
33365         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33366         *ret_copy = MaxDustHTLCExposure_clone(arg);
33367         uint64_t ret_ref = tag_ptr(ret_copy, true);
33368         return ret_ref;
33369 }
33370 int64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone_ptr"))) TS_MaxDustHTLCExposure_clone_ptr(uint64_t arg) {
33371         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
33372         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
33373         return ret_conv;
33374 }
33375
33376 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone"))) TS_MaxDustHTLCExposure_clone(uint64_t orig) {
33377         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
33378         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33379         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
33380         uint64_t ret_ref = tag_ptr(ret_copy, true);
33381         return ret_ref;
33382 }
33383
33384 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fixed_limit_msat"))) TS_MaxDustHTLCExposure_fixed_limit_msat(int64_t a) {
33385         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33386         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
33387         uint64_t ret_ref = tag_ptr(ret_copy, true);
33388         return ret_ref;
33389 }
33390
33391 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fee_rate_multiplier"))) TS_MaxDustHTLCExposure_fee_rate_multiplier(int64_t a) {
33392         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33393         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
33394         uint64_t ret_ref = tag_ptr(ret_copy, true);
33395         return ret_ref;
33396 }
33397
33398 jboolean  __attribute__((export_name("TS_MaxDustHTLCExposure_eq"))) TS_MaxDustHTLCExposure_eq(uint64_t a, uint64_t b) {
33399         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
33400         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
33401         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
33402         return ret_conv;
33403 }
33404
33405 int8_tArray  __attribute__((export_name("TS_MaxDustHTLCExposure_write"))) TS_MaxDustHTLCExposure_write(uint64_t obj) {
33406         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
33407         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
33408         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33409         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33410         CVec_u8Z_free(ret_var);
33411         return ret_arr;
33412 }
33413
33414 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_read"))) TS_MaxDustHTLCExposure_read(int8_tArray ser) {
33415         LDKu8slice ser_ref;
33416         ser_ref.datalen = ser->arr_len;
33417         ser_ref.data = ser->elems;
33418         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
33419         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
33420         FREE(ser);
33421         return tag_ptr(ret_conv, true);
33422 }
33423
33424 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
33425         LDKChannelConfig this_obj_conv;
33426         this_obj_conv.inner = untag_ptr(this_obj);
33427         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33429         ChannelConfig_free(this_obj_conv);
33430 }
33431
33432 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
33433         LDKChannelConfig this_ptr_conv;
33434         this_ptr_conv.inner = untag_ptr(this_ptr);
33435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33437         this_ptr_conv.is_owned = false;
33438         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
33439         return ret_conv;
33440 }
33441
33442 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) {
33443         LDKChannelConfig this_ptr_conv;
33444         this_ptr_conv.inner = untag_ptr(this_ptr);
33445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33447         this_ptr_conv.is_owned = false;
33448         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
33449 }
33450
33451 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
33452         LDKChannelConfig this_ptr_conv;
33453         this_ptr_conv.inner = untag_ptr(this_ptr);
33454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33456         this_ptr_conv.is_owned = false;
33457         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
33458         return ret_conv;
33459 }
33460
33461 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) {
33462         LDKChannelConfig this_ptr_conv;
33463         this_ptr_conv.inner = untag_ptr(this_ptr);
33464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33466         this_ptr_conv.is_owned = false;
33467         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
33468 }
33469
33470 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
33471         LDKChannelConfig this_ptr_conv;
33472         this_ptr_conv.inner = untag_ptr(this_ptr);
33473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33475         this_ptr_conv.is_owned = false;
33476         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
33477         return ret_conv;
33478 }
33479
33480 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
33481         LDKChannelConfig this_ptr_conv;
33482         this_ptr_conv.inner = untag_ptr(this_ptr);
33483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33485         this_ptr_conv.is_owned = false;
33486         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
33487 }
33488
33489 uint64_t  __attribute__((export_name("TS_ChannelConfig_get_max_dust_htlc_exposure"))) TS_ChannelConfig_get_max_dust_htlc_exposure(uint64_t this_ptr) {
33490         LDKChannelConfig this_ptr_conv;
33491         this_ptr_conv.inner = untag_ptr(this_ptr);
33492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33494         this_ptr_conv.is_owned = false;
33495         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33496         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
33497         uint64_t ret_ref = tag_ptr(ret_copy, true);
33498         return ret_ref;
33499 }
33500
33501 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) {
33502         LDKChannelConfig this_ptr_conv;
33503         this_ptr_conv.inner = untag_ptr(this_ptr);
33504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33506         this_ptr_conv.is_owned = false;
33507         void* val_ptr = untag_ptr(val);
33508         CHECK_ACCESS(val_ptr);
33509         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
33510         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
33511         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
33512 }
33513
33514 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) {
33515         LDKChannelConfig this_ptr_conv;
33516         this_ptr_conv.inner = untag_ptr(this_ptr);
33517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33519         this_ptr_conv.is_owned = false;
33520         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
33521         return ret_conv;
33522 }
33523
33524 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) {
33525         LDKChannelConfig this_ptr_conv;
33526         this_ptr_conv.inner = untag_ptr(this_ptr);
33527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33529         this_ptr_conv.is_owned = false;
33530         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
33531 }
33532
33533 jboolean  __attribute__((export_name("TS_ChannelConfig_get_accept_underpaying_htlcs"))) TS_ChannelConfig_get_accept_underpaying_htlcs(uint64_t this_ptr) {
33534         LDKChannelConfig this_ptr_conv;
33535         this_ptr_conv.inner = untag_ptr(this_ptr);
33536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33538         this_ptr_conv.is_owned = false;
33539         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
33540         return ret_conv;
33541 }
33542
33543 void  __attribute__((export_name("TS_ChannelConfig_set_accept_underpaying_htlcs"))) TS_ChannelConfig_set_accept_underpaying_htlcs(uint64_t this_ptr, jboolean val) {
33544         LDKChannelConfig this_ptr_conv;
33545         this_ptr_conv.inner = untag_ptr(this_ptr);
33546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33548         this_ptr_conv.is_owned = false;
33549         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
33550 }
33551
33552 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) {
33553         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
33554         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
33555         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
33556         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
33557         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);
33558         uint64_t ret_ref = 0;
33559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33561         return ret_ref;
33562 }
33563
33564 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
33565         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
33566         uint64_t ret_ref = 0;
33567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33569         return ret_ref;
33570 }
33571 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
33572         LDKChannelConfig arg_conv;
33573         arg_conv.inner = untag_ptr(arg);
33574         arg_conv.is_owned = ptr_is_owned(arg);
33575         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33576         arg_conv.is_owned = false;
33577         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
33578         return ret_conv;
33579 }
33580
33581 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
33582         LDKChannelConfig orig_conv;
33583         orig_conv.inner = untag_ptr(orig);
33584         orig_conv.is_owned = ptr_is_owned(orig);
33585         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33586         orig_conv.is_owned = false;
33587         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_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 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
33595         LDKChannelConfig a_conv;
33596         a_conv.inner = untag_ptr(a);
33597         a_conv.is_owned = ptr_is_owned(a);
33598         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33599         a_conv.is_owned = false;
33600         LDKChannelConfig b_conv;
33601         b_conv.inner = untag_ptr(b);
33602         b_conv.is_owned = ptr_is_owned(b);
33603         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33604         b_conv.is_owned = false;
33605         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
33606         return ret_conv;
33607 }
33608
33609 void  __attribute__((export_name("TS_ChannelConfig_apply"))) TS_ChannelConfig_apply(uint64_t this_arg, uint64_t update) {
33610         LDKChannelConfig this_arg_conv;
33611         this_arg_conv.inner = untag_ptr(this_arg);
33612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33614         this_arg_conv.is_owned = false;
33615         LDKChannelConfigUpdate update_conv;
33616         update_conv.inner = untag_ptr(update);
33617         update_conv.is_owned = ptr_is_owned(update);
33618         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
33619         update_conv.is_owned = false;
33620         ChannelConfig_apply(&this_arg_conv, &update_conv);
33621 }
33622
33623 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
33624         LDKChannelConfig ret_var = ChannelConfig_default();
33625         uint64_t ret_ref = 0;
33626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33628         return ret_ref;
33629 }
33630
33631 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
33632         LDKChannelConfig obj_conv;
33633         obj_conv.inner = untag_ptr(obj);
33634         obj_conv.is_owned = ptr_is_owned(obj);
33635         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33636         obj_conv.is_owned = false;
33637         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
33638         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33639         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33640         CVec_u8Z_free(ret_var);
33641         return ret_arr;
33642 }
33643
33644 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
33645         LDKu8slice ser_ref;
33646         ser_ref.datalen = ser->arr_len;
33647         ser_ref.data = ser->elems;
33648         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
33649         *ret_conv = ChannelConfig_read(ser_ref);
33650         FREE(ser);
33651         return tag_ptr(ret_conv, true);
33652 }
33653
33654 void  __attribute__((export_name("TS_ChannelConfigUpdate_free"))) TS_ChannelConfigUpdate_free(uint64_t this_obj) {
33655         LDKChannelConfigUpdate this_obj_conv;
33656         this_obj_conv.inner = untag_ptr(this_obj);
33657         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33659         ChannelConfigUpdate_free(this_obj_conv);
33660 }
33661
33662 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
33663         LDKChannelConfigUpdate this_ptr_conv;
33664         this_ptr_conv.inner = untag_ptr(this_ptr);
33665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33667         this_ptr_conv.is_owned = false;
33668         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
33669         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
33670         uint64_t ret_ref = tag_ptr(ret_copy, true);
33671         return ret_ref;
33672 }
33673
33674 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) {
33675         LDKChannelConfigUpdate this_ptr_conv;
33676         this_ptr_conv.inner = untag_ptr(this_ptr);
33677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33679         this_ptr_conv.is_owned = false;
33680         void* val_ptr = untag_ptr(val);
33681         CHECK_ACCESS(val_ptr);
33682         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
33683         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
33684         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
33685 }
33686
33687 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_base_msat"))) TS_ChannelConfigUpdate_get_forwarding_fee_base_msat(uint64_t this_ptr) {
33688         LDKChannelConfigUpdate this_ptr_conv;
33689         this_ptr_conv.inner = untag_ptr(this_ptr);
33690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33692         this_ptr_conv.is_owned = false;
33693         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
33694         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
33695         uint64_t ret_ref = tag_ptr(ret_copy, true);
33696         return ret_ref;
33697 }
33698
33699 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) {
33700         LDKChannelConfigUpdate this_ptr_conv;
33701         this_ptr_conv.inner = untag_ptr(this_ptr);
33702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33704         this_ptr_conv.is_owned = false;
33705         void* val_ptr = untag_ptr(val);
33706         CHECK_ACCESS(val_ptr);
33707         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
33708         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
33709         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
33710 }
33711
33712 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_cltv_expiry_delta"))) TS_ChannelConfigUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
33713         LDKChannelConfigUpdate this_ptr_conv;
33714         this_ptr_conv.inner = untag_ptr(this_ptr);
33715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33717         this_ptr_conv.is_owned = false;
33718         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
33719         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
33720         uint64_t ret_ref = tag_ptr(ret_copy, true);
33721         return ret_ref;
33722 }
33723
33724 void  __attribute__((export_name("TS_ChannelConfigUpdate_set_cltv_expiry_delta"))) TS_ChannelConfigUpdate_set_cltv_expiry_delta(uint64_t this_ptr, uint64_t val) {
33725         LDKChannelConfigUpdate this_ptr_conv;
33726         this_ptr_conv.inner = untag_ptr(this_ptr);
33727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33729         this_ptr_conv.is_owned = false;
33730         void* val_ptr = untag_ptr(val);
33731         CHECK_ACCESS(val_ptr);
33732         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
33733         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
33734         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
33735 }
33736
33737 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) {
33738         LDKChannelConfigUpdate this_ptr_conv;
33739         this_ptr_conv.inner = untag_ptr(this_ptr);
33740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33742         this_ptr_conv.is_owned = false;
33743         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
33744         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
33745         uint64_t ret_ref = tag_ptr(ret_copy, true);
33746         return ret_ref;
33747 }
33748
33749 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) {
33750         LDKChannelConfigUpdate this_ptr_conv;
33751         this_ptr_conv.inner = untag_ptr(this_ptr);
33752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33754         this_ptr_conv.is_owned = false;
33755         void* val_ptr = untag_ptr(val);
33756         CHECK_ACCESS(val_ptr);
33757         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
33758         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
33759         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
33760 }
33761
33762 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) {
33763         LDKChannelConfigUpdate this_ptr_conv;
33764         this_ptr_conv.inner = untag_ptr(this_ptr);
33765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33767         this_ptr_conv.is_owned = false;
33768         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33769         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
33770         uint64_t ret_ref = tag_ptr(ret_copy, true);
33771         return ret_ref;
33772 }
33773
33774 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) {
33775         LDKChannelConfigUpdate this_ptr_conv;
33776         this_ptr_conv.inner = untag_ptr(this_ptr);
33777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33779         this_ptr_conv.is_owned = false;
33780         void* val_ptr = untag_ptr(val);
33781         CHECK_ACCESS(val_ptr);
33782         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33783         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
33784         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
33785 }
33786
33787 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) {
33788         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
33789         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
33790         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
33791         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
33792         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
33793         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
33794         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
33795         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
33796         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
33797         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
33798         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
33799         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
33800         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
33801         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
33802         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
33803         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
33804         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
33805         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
33806         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
33807         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
33808         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);
33809         uint64_t ret_ref = 0;
33810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33812         return ret_ref;
33813 }
33814
33815 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_default"))) TS_ChannelConfigUpdate_default() {
33816         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
33817         uint64_t ret_ref = 0;
33818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33820         return ret_ref;
33821 }
33822
33823 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
33824         LDKUserConfig this_obj_conv;
33825         this_obj_conv.inner = untag_ptr(this_obj);
33826         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33828         UserConfig_free(this_obj_conv);
33829 }
33830
33831 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
33832         LDKUserConfig 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         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
33838         uint64_t ret_ref = 0;
33839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33841         return ret_ref;
33842 }
33843
33844 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
33845         LDKUserConfig this_ptr_conv;
33846         this_ptr_conv.inner = untag_ptr(this_ptr);
33847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33849         this_ptr_conv.is_owned = false;
33850         LDKChannelHandshakeConfig val_conv;
33851         val_conv.inner = untag_ptr(val);
33852         val_conv.is_owned = ptr_is_owned(val);
33853         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33854         val_conv = ChannelHandshakeConfig_clone(&val_conv);
33855         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
33856 }
33857
33858 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
33859         LDKUserConfig 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         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
33865         uint64_t ret_ref = 0;
33866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33868         return ret_ref;
33869 }
33870
33871 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
33872         LDKUserConfig this_ptr_conv;
33873         this_ptr_conv.inner = untag_ptr(this_ptr);
33874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33876         this_ptr_conv.is_owned = false;
33877         LDKChannelHandshakeLimits val_conv;
33878         val_conv.inner = untag_ptr(val);
33879         val_conv.is_owned = ptr_is_owned(val);
33880         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33881         val_conv = ChannelHandshakeLimits_clone(&val_conv);
33882         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
33883 }
33884
33885 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
33886         LDKUserConfig 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         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
33892         uint64_t ret_ref = 0;
33893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33895         return ret_ref;
33896 }
33897
33898 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
33899         LDKUserConfig this_ptr_conv;
33900         this_ptr_conv.inner = untag_ptr(this_ptr);
33901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33903         this_ptr_conv.is_owned = false;
33904         LDKChannelConfig val_conv;
33905         val_conv.inner = untag_ptr(val);
33906         val_conv.is_owned = ptr_is_owned(val);
33907         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33908         val_conv = ChannelConfig_clone(&val_conv);
33909         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
33910 }
33911
33912 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
33913         LDKUserConfig 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         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
33919         return ret_conv;
33920 }
33921
33922 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) {
33923         LDKUserConfig this_ptr_conv;
33924         this_ptr_conv.inner = untag_ptr(this_ptr);
33925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33927         this_ptr_conv.is_owned = false;
33928         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
33929 }
33930
33931 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
33932         LDKUserConfig this_ptr_conv;
33933         this_ptr_conv.inner = untag_ptr(this_ptr);
33934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33936         this_ptr_conv.is_owned = false;
33937         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
33938         return ret_conv;
33939 }
33940
33941 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
33942         LDKUserConfig this_ptr_conv;
33943         this_ptr_conv.inner = untag_ptr(this_ptr);
33944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33946         this_ptr_conv.is_owned = false;
33947         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
33948 }
33949
33950 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
33951         LDKUserConfig 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         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
33957         return ret_conv;
33958 }
33959
33960 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
33961         LDKUserConfig this_ptr_conv;
33962         this_ptr_conv.inner = untag_ptr(this_ptr);
33963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33965         this_ptr_conv.is_owned = false;
33966         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
33967 }
33968
33969 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) {
33970         LDKUserConfig this_ptr_conv;
33971         this_ptr_conv.inner = untag_ptr(this_ptr);
33972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33974         this_ptr_conv.is_owned = false;
33975         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
33976         return ret_conv;
33977 }
33978
33979 void  __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) {
33980         LDKUserConfig 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         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
33986 }
33987
33988 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_mpp_keysend"))) TS_UserConfig_get_accept_mpp_keysend(uint64_t this_ptr) {
33989         LDKUserConfig this_ptr_conv;
33990         this_ptr_conv.inner = untag_ptr(this_ptr);
33991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33993         this_ptr_conv.is_owned = false;
33994         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
33995         return ret_conv;
33996 }
33997
33998 void  __attribute__((export_name("TS_UserConfig_set_accept_mpp_keysend"))) TS_UserConfig_set_accept_mpp_keysend(uint64_t this_ptr, jboolean val) {
33999         LDKUserConfig this_ptr_conv;
34000         this_ptr_conv.inner = untag_ptr(this_ptr);
34001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34003         this_ptr_conv.is_owned = false;
34004         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
34005 }
34006
34007 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) {
34008         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
34009         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
34010         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
34011         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
34012         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
34013         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
34014         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
34015         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
34016         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
34017         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
34018         LDKChannelConfig channel_config_arg_conv;
34019         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
34020         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
34021         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
34022         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
34023         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);
34024         uint64_t ret_ref = 0;
34025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34027         return ret_ref;
34028 }
34029
34030 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
34031         LDKUserConfig ret_var = UserConfig_clone(arg);
34032         uint64_t ret_ref = 0;
34033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34035         return ret_ref;
34036 }
34037 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
34038         LDKUserConfig arg_conv;
34039         arg_conv.inner = untag_ptr(arg);
34040         arg_conv.is_owned = ptr_is_owned(arg);
34041         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34042         arg_conv.is_owned = false;
34043         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
34044         return ret_conv;
34045 }
34046
34047 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
34048         LDKUserConfig orig_conv;
34049         orig_conv.inner = untag_ptr(orig);
34050         orig_conv.is_owned = ptr_is_owned(orig);
34051         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34052         orig_conv.is_owned = false;
34053         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
34054         uint64_t ret_ref = 0;
34055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34057         return ret_ref;
34058 }
34059
34060 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
34061         LDKUserConfig ret_var = UserConfig_default();
34062         uint64_t ret_ref = 0;
34063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34065         return ret_ref;
34066 }
34067
34068 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
34069         LDKBestBlock this_obj_conv;
34070         this_obj_conv.inner = untag_ptr(this_obj);
34071         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34073         BestBlock_free(this_obj_conv);
34074 }
34075
34076 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
34077         LDKBestBlock ret_var = BestBlock_clone(arg);
34078         uint64_t ret_ref = 0;
34079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34081         return ret_ref;
34082 }
34083 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
34084         LDKBestBlock arg_conv;
34085         arg_conv.inner = untag_ptr(arg);
34086         arg_conv.is_owned = ptr_is_owned(arg);
34087         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34088         arg_conv.is_owned = false;
34089         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
34090         return ret_conv;
34091 }
34092
34093 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
34094         LDKBestBlock orig_conv;
34095         orig_conv.inner = untag_ptr(orig);
34096         orig_conv.is_owned = ptr_is_owned(orig);
34097         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34098         orig_conv.is_owned = false;
34099         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
34100         uint64_t ret_ref = 0;
34101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34103         return ret_ref;
34104 }
34105
34106 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
34107         LDKBestBlock a_conv;
34108         a_conv.inner = untag_ptr(a);
34109         a_conv.is_owned = ptr_is_owned(a);
34110         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34111         a_conv.is_owned = false;
34112         LDKBestBlock b_conv;
34113         b_conv.inner = untag_ptr(b);
34114         b_conv.is_owned = ptr_is_owned(b);
34115         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34116         b_conv.is_owned = false;
34117         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
34118         return ret_conv;
34119 }
34120
34121 uint64_t  __attribute__((export_name("TS_BestBlock_from_network"))) TS_BestBlock_from_network(uint32_t network) {
34122         LDKNetwork network_conv = LDKNetwork_from_js(network);
34123         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
34124         uint64_t ret_ref = 0;
34125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34127         return ret_ref;
34128 }
34129
34130 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
34131         LDKThirtyTwoBytes block_hash_ref;
34132         CHECK(block_hash->arr_len == 32);
34133         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
34134         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
34135         uint64_t ret_ref = 0;
34136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34138         return ret_ref;
34139 }
34140
34141 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
34142         LDKBestBlock this_arg_conv;
34143         this_arg_conv.inner = untag_ptr(this_arg);
34144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34146         this_arg_conv.is_owned = false;
34147         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34148         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
34149         return ret_arr;
34150 }
34151
34152 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
34153         LDKBestBlock this_arg_conv;
34154         this_arg_conv.inner = untag_ptr(this_arg);
34155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34157         this_arg_conv.is_owned = false;
34158         int32_t ret_conv = BestBlock_height(&this_arg_conv);
34159         return ret_conv;
34160 }
34161
34162 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
34163         if (!ptr_is_owned(this_ptr)) return;
34164         void* this_ptr_ptr = untag_ptr(this_ptr);
34165         CHECK_ACCESS(this_ptr_ptr);
34166         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
34167         FREE(untag_ptr(this_ptr));
34168         Listen_free(this_ptr_conv);
34169 }
34170
34171 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
34172         if (!ptr_is_owned(this_ptr)) return;
34173         void* this_ptr_ptr = untag_ptr(this_ptr);
34174         CHECK_ACCESS(this_ptr_ptr);
34175         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
34176         FREE(untag_ptr(this_ptr));
34177         Confirm_free(this_ptr_conv);
34178 }
34179
34180 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
34181         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
34182         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
34183         return ret_conv;
34184 }
34185
34186 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
34187         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
34188         return ret_conv;
34189 }
34190
34191 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
34192         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
34193         return ret_conv;
34194 }
34195
34196 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_unrecoverable_error"))) TS_ChannelMonitorUpdateStatus_unrecoverable_error() {
34197         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_unrecoverable_error());
34198         return ret_conv;
34199 }
34200
34201 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
34202         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
34203         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
34204         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
34205         return ret_conv;
34206 }
34207
34208 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
34209         if (!ptr_is_owned(this_ptr)) return;
34210         void* this_ptr_ptr = untag_ptr(this_ptr);
34211         CHECK_ACCESS(this_ptr_ptr);
34212         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
34213         FREE(untag_ptr(this_ptr));
34214         Watch_free(this_ptr_conv);
34215 }
34216
34217 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
34218         if (!ptr_is_owned(this_ptr)) return;
34219         void* this_ptr_ptr = untag_ptr(this_ptr);
34220         CHECK_ACCESS(this_ptr_ptr);
34221         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
34222         FREE(untag_ptr(this_ptr));
34223         Filter_free(this_ptr_conv);
34224 }
34225
34226 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
34227         LDKWatchedOutput this_obj_conv;
34228         this_obj_conv.inner = untag_ptr(this_obj);
34229         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34231         WatchedOutput_free(this_obj_conv);
34232 }
34233
34234 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
34235         LDKWatchedOutput this_ptr_conv;
34236         this_ptr_conv.inner = untag_ptr(this_ptr);
34237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34239         this_ptr_conv.is_owned = false;
34240         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
34241         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
34242         uint64_t ret_ref = tag_ptr(ret_copy, true);
34243         return ret_ref;
34244 }
34245
34246 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, uint64_t val) {
34247         LDKWatchedOutput this_ptr_conv;
34248         this_ptr_conv.inner = untag_ptr(this_ptr);
34249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34251         this_ptr_conv.is_owned = false;
34252         void* val_ptr = untag_ptr(val);
34253         CHECK_ACCESS(val_ptr);
34254         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
34255         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
34256         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
34257 }
34258
34259 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
34260         LDKWatchedOutput this_ptr_conv;
34261         this_ptr_conv.inner = untag_ptr(this_ptr);
34262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34264         this_ptr_conv.is_owned = false;
34265         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
34266         uint64_t ret_ref = 0;
34267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34269         return ret_ref;
34270 }
34271
34272 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
34273         LDKWatchedOutput this_ptr_conv;
34274         this_ptr_conv.inner = untag_ptr(this_ptr);
34275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34277         this_ptr_conv.is_owned = false;
34278         LDKOutPoint val_conv;
34279         val_conv.inner = untag_ptr(val);
34280         val_conv.is_owned = ptr_is_owned(val);
34281         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34282         val_conv = OutPoint_clone(&val_conv);
34283         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
34284 }
34285
34286 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
34287         LDKWatchedOutput this_ptr_conv;
34288         this_ptr_conv.inner = untag_ptr(this_ptr);
34289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34291         this_ptr_conv.is_owned = false;
34292         LDKCVec_u8Z ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
34293         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34294         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34295         CVec_u8Z_free(ret_var);
34296         return ret_arr;
34297 }
34298
34299 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
34300         LDKWatchedOutput this_ptr_conv;
34301         this_ptr_conv.inner = untag_ptr(this_ptr);
34302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34304         this_ptr_conv.is_owned = false;
34305         LDKCVec_u8Z val_ref;
34306         val_ref.datalen = val->arr_len;
34307         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
34308         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
34309         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
34310 }
34311
34312 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) {
34313         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
34314         CHECK_ACCESS(block_hash_arg_ptr);
34315         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
34316         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
34317         LDKOutPoint outpoint_arg_conv;
34318         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
34319         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
34320         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
34321         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
34322         LDKCVec_u8Z script_pubkey_arg_ref;
34323         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
34324         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
34325         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
34326         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
34327         uint64_t ret_ref = 0;
34328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34330         return ret_ref;
34331 }
34332
34333 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
34334         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
34335         uint64_t ret_ref = 0;
34336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34338         return ret_ref;
34339 }
34340 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
34341         LDKWatchedOutput arg_conv;
34342         arg_conv.inner = untag_ptr(arg);
34343         arg_conv.is_owned = ptr_is_owned(arg);
34344         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34345         arg_conv.is_owned = false;
34346         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
34347         return ret_conv;
34348 }
34349
34350 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
34351         LDKWatchedOutput orig_conv;
34352         orig_conv.inner = untag_ptr(orig);
34353         orig_conv.is_owned = ptr_is_owned(orig);
34354         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34355         orig_conv.is_owned = false;
34356         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
34357         uint64_t ret_ref = 0;
34358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34360         return ret_ref;
34361 }
34362
34363 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
34364         LDKWatchedOutput a_conv;
34365         a_conv.inner = untag_ptr(a);
34366         a_conv.is_owned = ptr_is_owned(a);
34367         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34368         a_conv.is_owned = false;
34369         LDKWatchedOutput b_conv;
34370         b_conv.inner = untag_ptr(b);
34371         b_conv.is_owned = ptr_is_owned(b);
34372         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34373         b_conv.is_owned = false;
34374         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
34375         return ret_conv;
34376 }
34377
34378 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
34379         LDKWatchedOutput o_conv;
34380         o_conv.inner = untag_ptr(o);
34381         o_conv.is_owned = ptr_is_owned(o);
34382         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34383         o_conv.is_owned = false;
34384         int64_t ret_conv = WatchedOutput_hash(&o_conv);
34385         return ret_conv;
34386 }
34387
34388 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
34389         if (!ptr_is_owned(this_ptr)) return;
34390         void* this_ptr_ptr = untag_ptr(this_ptr);
34391         CHECK_ACCESS(this_ptr_ptr);
34392         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
34393         FREE(untag_ptr(this_ptr));
34394         BroadcasterInterface_free(this_ptr_conv);
34395 }
34396
34397 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
34398         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
34399         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
34400         return ret_conv;
34401 }
34402
34403 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_on_chain_sweep"))) TS_ConfirmationTarget_on_chain_sweep() {
34404         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_on_chain_sweep());
34405         return ret_conv;
34406 }
34407
34408 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_min_allowed_anchor_channel_remote_fee"))) TS_ConfirmationTarget_min_allowed_anchor_channel_remote_fee() {
34409         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_min_allowed_anchor_channel_remote_fee());
34410         return ret_conv;
34411 }
34412
34413 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee"))) TS_ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee() {
34414         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee());
34415         return ret_conv;
34416 }
34417
34418 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_anchor_channel_fee"))) TS_ConfirmationTarget_anchor_channel_fee() {
34419         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_anchor_channel_fee());
34420         return ret_conv;
34421 }
34422
34423 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_non_anchor_channel_fee"))) TS_ConfirmationTarget_non_anchor_channel_fee() {
34424         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_non_anchor_channel_fee());
34425         return ret_conv;
34426 }
34427
34428 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_channel_close_minimum"))) TS_ConfirmationTarget_channel_close_minimum() {
34429         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_channel_close_minimum());
34430         return ret_conv;
34431 }
34432
34433 int64_t  __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) {
34434         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
34435         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
34436         return ret_conv;
34437 }
34438
34439 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
34440         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
34441         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
34442         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
34443         return ret_conv;
34444 }
34445
34446 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
34447         if (!ptr_is_owned(this_ptr)) return;
34448         void* this_ptr_ptr = untag_ptr(this_ptr);
34449         CHECK_ACCESS(this_ptr_ptr);
34450         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
34451         FREE(untag_ptr(this_ptr));
34452         FeeEstimator_free(this_ptr_conv);
34453 }
34454
34455 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
34456         LDKMonitorUpdateId this_obj_conv;
34457         this_obj_conv.inner = untag_ptr(this_obj);
34458         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34460         MonitorUpdateId_free(this_obj_conv);
34461 }
34462
34463 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
34464         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
34465         uint64_t ret_ref = 0;
34466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34468         return ret_ref;
34469 }
34470 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
34471         LDKMonitorUpdateId arg_conv;
34472         arg_conv.inner = untag_ptr(arg);
34473         arg_conv.is_owned = ptr_is_owned(arg);
34474         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34475         arg_conv.is_owned = false;
34476         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
34477         return ret_conv;
34478 }
34479
34480 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
34481         LDKMonitorUpdateId orig_conv;
34482         orig_conv.inner = untag_ptr(orig);
34483         orig_conv.is_owned = ptr_is_owned(orig);
34484         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34485         orig_conv.is_owned = false;
34486         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
34487         uint64_t ret_ref = 0;
34488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34490         return ret_ref;
34491 }
34492
34493 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
34494         LDKMonitorUpdateId o_conv;
34495         o_conv.inner = untag_ptr(o);
34496         o_conv.is_owned = ptr_is_owned(o);
34497         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34498         o_conv.is_owned = false;
34499         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
34500         return ret_conv;
34501 }
34502
34503 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
34504         LDKMonitorUpdateId a_conv;
34505         a_conv.inner = untag_ptr(a);
34506         a_conv.is_owned = ptr_is_owned(a);
34507         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34508         a_conv.is_owned = false;
34509         LDKMonitorUpdateId b_conv;
34510         b_conv.inner = untag_ptr(b);
34511         b_conv.is_owned = ptr_is_owned(b);
34512         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34513         b_conv.is_owned = false;
34514         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
34515         return ret_conv;
34516 }
34517
34518 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
34519         if (!ptr_is_owned(this_ptr)) return;
34520         void* this_ptr_ptr = untag_ptr(this_ptr);
34521         CHECK_ACCESS(this_ptr_ptr);
34522         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
34523         FREE(untag_ptr(this_ptr));
34524         Persist_free(this_ptr_conv);
34525 }
34526
34527 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
34528         LDKLockedChannelMonitor this_obj_conv;
34529         this_obj_conv.inner = untag_ptr(this_obj);
34530         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34532         LockedChannelMonitor_free(this_obj_conv);
34533 }
34534
34535 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
34536         LDKChainMonitor this_obj_conv;
34537         this_obj_conv.inner = untag_ptr(this_obj);
34538         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34540         ChainMonitor_free(this_obj_conv);
34541 }
34542
34543 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) {
34544         void* chain_source_ptr = untag_ptr(chain_source);
34545         CHECK_ACCESS(chain_source_ptr);
34546         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
34547         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
34548         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
34549                 // Manually implement clone for Java trait instances
34550                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
34551                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34552                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
34553                 }
34554         }
34555         void* broadcaster_ptr = untag_ptr(broadcaster);
34556         CHECK_ACCESS(broadcaster_ptr);
34557         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
34558         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
34559                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34560                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
34561         }
34562         void* logger_ptr = untag_ptr(logger);
34563         CHECK_ACCESS(logger_ptr);
34564         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34565         if (logger_conv.free == LDKLogger_JCalls_free) {
34566                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34567                 LDKLogger_JCalls_cloned(&logger_conv);
34568         }
34569         void* feeest_ptr = untag_ptr(feeest);
34570         CHECK_ACCESS(feeest_ptr);
34571         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
34572         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
34573                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34574                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
34575         }
34576         void* persister_ptr = untag_ptr(persister);
34577         CHECK_ACCESS(persister_ptr);
34578         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
34579         if (persister_conv.free == LDKPersist_JCalls_free) {
34580                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34581                 LDKPersist_JCalls_cloned(&persister_conv);
34582         }
34583         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
34584         uint64_t ret_ref = 0;
34585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34587         return ret_ref;
34588 }
34589
34590 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
34591         LDKChainMonitor this_arg_conv;
34592         this_arg_conv.inner = untag_ptr(this_arg);
34593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34595         this_arg_conv.is_owned = false;
34596         LDKCVec_ChannelDetailsZ ignored_channels_constr;
34597         ignored_channels_constr.datalen = ignored_channels->arr_len;
34598         if (ignored_channels_constr.datalen > 0)
34599                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
34600         else
34601                 ignored_channels_constr.data = NULL;
34602         uint64_t* ignored_channels_vals = ignored_channels->elems;
34603         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
34604                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
34605                 LDKChannelDetails ignored_channels_conv_16_conv;
34606                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
34607                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
34608                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
34609                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
34610                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
34611         }
34612         FREE(ignored_channels);
34613         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
34614         uint64_tArray ret_arr = NULL;
34615         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34616         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34617         for (size_t j = 0; j < ret_var.datalen; j++) {
34618                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
34619                 *ret_conv_9_copy = ret_var.data[j];
34620                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
34621                 ret_arr_ptr[j] = ret_conv_9_ref;
34622         }
34623         
34624         FREE(ret_var.data);
34625         return ret_arr;
34626 }
34627
34628 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
34629         LDKChainMonitor this_arg_conv;
34630         this_arg_conv.inner = untag_ptr(this_arg);
34631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34633         this_arg_conv.is_owned = false;
34634         LDKOutPoint funding_txo_conv;
34635         funding_txo_conv.inner = untag_ptr(funding_txo);
34636         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
34637         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
34638         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
34639         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
34640         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
34641         return tag_ptr(ret_conv, true);
34642 }
34643
34644 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
34645         LDKChainMonitor this_arg_conv;
34646         this_arg_conv.inner = untag_ptr(this_arg);
34647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34649         this_arg_conv.is_owned = false;
34650         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
34651         uint64_tArray ret_arr = NULL;
34652         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34653         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34654         for (size_t k = 0; k < ret_var.datalen; k++) {
34655                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
34656                 uint64_t ret_conv_10_ref = 0;
34657                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
34658                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
34659                 ret_arr_ptr[k] = ret_conv_10_ref;
34660         }
34661         
34662         FREE(ret_var.data);
34663         return ret_arr;
34664 }
34665
34666 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) {
34667         LDKChainMonitor this_arg_conv;
34668         this_arg_conv.inner = untag_ptr(this_arg);
34669         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34671         this_arg_conv.is_owned = false;
34672         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
34673         uint64_tArray ret_arr = NULL;
34674         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34675         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34676         for (size_t p = 0; p < ret_var.datalen; p++) {
34677                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34678                 *ret_conv_41_conv = ret_var.data[p];
34679                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
34680         }
34681         
34682         FREE(ret_var.data);
34683         return ret_arr;
34684 }
34685
34686 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) {
34687         LDKChainMonitor this_arg_conv;
34688         this_arg_conv.inner = untag_ptr(this_arg);
34689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34691         this_arg_conv.is_owned = false;
34692         LDKOutPoint funding_txo_conv;
34693         funding_txo_conv.inner = untag_ptr(funding_txo);
34694         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
34695         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
34696         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
34697         LDKMonitorUpdateId completed_update_id_conv;
34698         completed_update_id_conv.inner = untag_ptr(completed_update_id);
34699         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
34700         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
34701         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
34702         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
34703         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
34704         return tag_ptr(ret_conv, true);
34705 }
34706
34707 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_update_future"))) TS_ChainMonitor_get_update_future(uint64_t this_arg) {
34708         LDKChainMonitor this_arg_conv;
34709         this_arg_conv.inner = untag_ptr(this_arg);
34710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34712         this_arg_conv.is_owned = false;
34713         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
34714         uint64_t ret_ref = 0;
34715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34717         return ret_ref;
34718 }
34719
34720 void  __attribute__((export_name("TS_ChainMonitor_rebroadcast_pending_claims"))) TS_ChainMonitor_rebroadcast_pending_claims(uint64_t this_arg) {
34721         LDKChainMonitor this_arg_conv;
34722         this_arg_conv.inner = untag_ptr(this_arg);
34723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34725         this_arg_conv.is_owned = false;
34726         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
34727 }
34728
34729 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
34730         LDKChainMonitor this_arg_conv;
34731         this_arg_conv.inner = untag_ptr(this_arg);
34732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34734         this_arg_conv.is_owned = false;
34735         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
34736         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
34737         return tag_ptr(ret_ret, true);
34738 }
34739
34740 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
34741         LDKChainMonitor this_arg_conv;
34742         this_arg_conv.inner = untag_ptr(this_arg);
34743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34745         this_arg_conv.is_owned = false;
34746         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
34747         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
34748         return tag_ptr(ret_ret, true);
34749 }
34750
34751 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
34752         LDKChainMonitor this_arg_conv;
34753         this_arg_conv.inner = untag_ptr(this_arg);
34754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34756         this_arg_conv.is_owned = false;
34757         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
34758         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
34759         return tag_ptr(ret_ret, true);
34760 }
34761
34762 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
34763         LDKChainMonitor this_arg_conv;
34764         this_arg_conv.inner = untag_ptr(this_arg);
34765         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34767         this_arg_conv.is_owned = false;
34768         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
34769         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
34770         return tag_ptr(ret_ret, true);
34771 }
34772
34773 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
34774         LDKChannelMonitorUpdate this_obj_conv;
34775         this_obj_conv.inner = untag_ptr(this_obj);
34776         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34778         ChannelMonitorUpdate_free(this_obj_conv);
34779 }
34780
34781 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
34782         LDKChannelMonitorUpdate this_ptr_conv;
34783         this_ptr_conv.inner = untag_ptr(this_ptr);
34784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34786         this_ptr_conv.is_owned = false;
34787         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
34788         return ret_conv;
34789 }
34790
34791 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
34792         LDKChannelMonitorUpdate this_ptr_conv;
34793         this_ptr_conv.inner = untag_ptr(this_ptr);
34794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34796         this_ptr_conv.is_owned = false;
34797         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
34798 }
34799
34800 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
34801         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
34802         uint64_t ret_ref = 0;
34803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34805         return ret_ref;
34806 }
34807 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
34808         LDKChannelMonitorUpdate arg_conv;
34809         arg_conv.inner = untag_ptr(arg);
34810         arg_conv.is_owned = ptr_is_owned(arg);
34811         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34812         arg_conv.is_owned = false;
34813         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
34814         return ret_conv;
34815 }
34816
34817 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
34818         LDKChannelMonitorUpdate orig_conv;
34819         orig_conv.inner = untag_ptr(orig);
34820         orig_conv.is_owned = ptr_is_owned(orig);
34821         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34822         orig_conv.is_owned = false;
34823         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
34824         uint64_t ret_ref = 0;
34825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34827         return ret_ref;
34828 }
34829
34830 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdate_eq"))) TS_ChannelMonitorUpdate_eq(uint64_t a, uint64_t b) {
34831         LDKChannelMonitorUpdate a_conv;
34832         a_conv.inner = untag_ptr(a);
34833         a_conv.is_owned = ptr_is_owned(a);
34834         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34835         a_conv.is_owned = false;
34836         LDKChannelMonitorUpdate b_conv;
34837         b_conv.inner = untag_ptr(b);
34838         b_conv.is_owned = ptr_is_owned(b);
34839         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34840         b_conv.is_owned = false;
34841         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
34842         return ret_conv;
34843 }
34844
34845 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
34846         LDKChannelMonitorUpdate obj_conv;
34847         obj_conv.inner = untag_ptr(obj);
34848         obj_conv.is_owned = ptr_is_owned(obj);
34849         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34850         obj_conv.is_owned = false;
34851         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
34852         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34853         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34854         CVec_u8Z_free(ret_var);
34855         return ret_arr;
34856 }
34857
34858 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
34859         LDKu8slice ser_ref;
34860         ser_ref.datalen = ser->arr_len;
34861         ser_ref.data = ser->elems;
34862         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
34863         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
34864         FREE(ser);
34865         return tag_ptr(ret_conv, true);
34866 }
34867
34868 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
34869         if (!ptr_is_owned(this_ptr)) return;
34870         void* this_ptr_ptr = untag_ptr(this_ptr);
34871         CHECK_ACCESS(this_ptr_ptr);
34872         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
34873         FREE(untag_ptr(this_ptr));
34874         MonitorEvent_free(this_ptr_conv);
34875 }
34876
34877 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
34878         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
34879         *ret_copy = MonitorEvent_clone(arg);
34880         uint64_t ret_ref = tag_ptr(ret_copy, true);
34881         return ret_ref;
34882 }
34883 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
34884         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
34885         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
34886         return ret_conv;
34887 }
34888
34889 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
34890         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
34891         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
34892         *ret_copy = MonitorEvent_clone(orig_conv);
34893         uint64_t ret_ref = tag_ptr(ret_copy, true);
34894         return ret_ref;
34895 }
34896
34897 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
34898         LDKHTLCUpdate a_conv;
34899         a_conv.inner = untag_ptr(a);
34900         a_conv.is_owned = ptr_is_owned(a);
34901         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34902         a_conv = HTLCUpdate_clone(&a_conv);
34903         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
34904         *ret_copy = MonitorEvent_htlcevent(a_conv);
34905         uint64_t ret_ref = tag_ptr(ret_copy, true);
34906         return ret_ref;
34907 }
34908
34909 uint64_t  __attribute__((export_name("TS_MonitorEvent_holder_force_closed"))) TS_MonitorEvent_holder_force_closed(uint64_t a) {
34910         LDKOutPoint a_conv;
34911         a_conv.inner = untag_ptr(a);
34912         a_conv.is_owned = ptr_is_owned(a);
34913         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34914         a_conv = OutPoint_clone(&a_conv);
34915         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
34916         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
34917         uint64_t ret_ref = tag_ptr(ret_copy, true);
34918         return ret_ref;
34919 }
34920
34921 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, int64_t monitor_update_id) {
34922         LDKOutPoint funding_txo_conv;
34923         funding_txo_conv.inner = untag_ptr(funding_txo);
34924         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
34925         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
34926         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
34927         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
34928         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
34929         uint64_t ret_ref = tag_ptr(ret_copy, true);
34930         return ret_ref;
34931 }
34932
34933 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
34934         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
34935         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
34936         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
34937         return ret_conv;
34938 }
34939
34940 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
34941         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
34942         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
34943         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34944         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34945         CVec_u8Z_free(ret_var);
34946         return ret_arr;
34947 }
34948
34949 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
34950         LDKu8slice ser_ref;
34951         ser_ref.datalen = ser->arr_len;
34952         ser_ref.data = ser->elems;
34953         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
34954         *ret_conv = MonitorEvent_read(ser_ref);
34955         FREE(ser);
34956         return tag_ptr(ret_conv, true);
34957 }
34958
34959 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
34960         LDKHTLCUpdate this_obj_conv;
34961         this_obj_conv.inner = untag_ptr(this_obj);
34962         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34964         HTLCUpdate_free(this_obj_conv);
34965 }
34966
34967 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
34968         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
34969         uint64_t ret_ref = 0;
34970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34972         return ret_ref;
34973 }
34974 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
34975         LDKHTLCUpdate arg_conv;
34976         arg_conv.inner = untag_ptr(arg);
34977         arg_conv.is_owned = ptr_is_owned(arg);
34978         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34979         arg_conv.is_owned = false;
34980         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
34981         return ret_conv;
34982 }
34983
34984 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
34985         LDKHTLCUpdate orig_conv;
34986         orig_conv.inner = untag_ptr(orig);
34987         orig_conv.is_owned = ptr_is_owned(orig);
34988         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34989         orig_conv.is_owned = false;
34990         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
34991         uint64_t ret_ref = 0;
34992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34994         return ret_ref;
34995 }
34996
34997 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
34998         LDKHTLCUpdate a_conv;
34999         a_conv.inner = untag_ptr(a);
35000         a_conv.is_owned = ptr_is_owned(a);
35001         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35002         a_conv.is_owned = false;
35003         LDKHTLCUpdate b_conv;
35004         b_conv.inner = untag_ptr(b);
35005         b_conv.is_owned = ptr_is_owned(b);
35006         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35007         b_conv.is_owned = false;
35008         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
35009         return ret_conv;
35010 }
35011
35012 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
35013         LDKHTLCUpdate obj_conv;
35014         obj_conv.inner = untag_ptr(obj);
35015         obj_conv.is_owned = ptr_is_owned(obj);
35016         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35017         obj_conv.is_owned = false;
35018         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
35019         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35020         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35021         CVec_u8Z_free(ret_var);
35022         return ret_arr;
35023 }
35024
35025 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
35026         LDKu8slice ser_ref;
35027         ser_ref.datalen = ser->arr_len;
35028         ser_ref.data = ser->elems;
35029         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
35030         *ret_conv = HTLCUpdate_read(ser_ref);
35031         FREE(ser);
35032         return tag_ptr(ret_conv, true);
35033 }
35034
35035 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
35036         if (!ptr_is_owned(this_ptr)) return;
35037         void* this_ptr_ptr = untag_ptr(this_ptr);
35038         CHECK_ACCESS(this_ptr_ptr);
35039         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
35040         FREE(untag_ptr(this_ptr));
35041         Balance_free(this_ptr_conv);
35042 }
35043
35044 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
35045         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35046         *ret_copy = Balance_clone(arg);
35047         uint64_t ret_ref = tag_ptr(ret_copy, true);
35048         return ret_ref;
35049 }
35050 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
35051         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
35052         int64_t ret_conv = Balance_clone_ptr(arg_conv);
35053         return ret_conv;
35054 }
35055
35056 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
35057         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
35058         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35059         *ret_copy = Balance_clone(orig_conv);
35060         uint64_t ret_ref = tag_ptr(ret_copy, true);
35061         return ret_ref;
35062 }
35063
35064 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t amount_satoshis) {
35065         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35066         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
35067         uint64_t ret_ref = tag_ptr(ret_copy, true);
35068         return ret_ref;
35069 }
35070
35071 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t amount_satoshis, int32_t confirmation_height) {
35072         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35073         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
35074         uint64_t ret_ref = tag_ptr(ret_copy, true);
35075         return ret_ref;
35076 }
35077
35078 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) {
35079         LDKThirtyTwoBytes payment_hash_ref;
35080         CHECK(payment_hash->arr_len == 32);
35081         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35082         LDKThirtyTwoBytes payment_preimage_ref;
35083         CHECK(payment_preimage->arr_len == 32);
35084         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
35085         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35086         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
35087         uint64_t ret_ref = tag_ptr(ret_copy, true);
35088         return ret_ref;
35089 }
35090
35091 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) {
35092         LDKThirtyTwoBytes payment_hash_ref;
35093         CHECK(payment_hash->arr_len == 32);
35094         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35095         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35096         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
35097         uint64_t ret_ref = tag_ptr(ret_copy, true);
35098         return ret_ref;
35099 }
35100
35101 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) {
35102         LDKThirtyTwoBytes payment_hash_ref;
35103         CHECK(payment_hash->arr_len == 32);
35104         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35105         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35106         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
35107         uint64_t ret_ref = tag_ptr(ret_copy, true);
35108         return ret_ref;
35109 }
35110
35111 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t amount_satoshis) {
35112         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35113         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
35114         uint64_t ret_ref = tag_ptr(ret_copy, true);
35115         return ret_ref;
35116 }
35117
35118 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
35119         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
35120         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
35121         jboolean ret_conv = Balance_eq(a_conv, b_conv);
35122         return ret_conv;
35123 }
35124
35125 int64_t  __attribute__((export_name("TS_Balance_claimable_amount_satoshis"))) TS_Balance_claimable_amount_satoshis(uint64_t this_arg) {
35126         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
35127         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
35128         return ret_conv;
35129 }
35130
35131 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
35132         LDKChannelMonitor this_obj_conv;
35133         this_obj_conv.inner = untag_ptr(this_obj);
35134         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35136         ChannelMonitor_free(this_obj_conv);
35137 }
35138
35139 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
35140         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
35141         uint64_t ret_ref = 0;
35142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35144         return ret_ref;
35145 }
35146 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
35147         LDKChannelMonitor arg_conv;
35148         arg_conv.inner = untag_ptr(arg);
35149         arg_conv.is_owned = ptr_is_owned(arg);
35150         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35151         arg_conv.is_owned = false;
35152         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
35153         return ret_conv;
35154 }
35155
35156 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
35157         LDKChannelMonitor orig_conv;
35158         orig_conv.inner = untag_ptr(orig);
35159         orig_conv.is_owned = ptr_is_owned(orig);
35160         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35161         orig_conv.is_owned = false;
35162         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
35163         uint64_t ret_ref = 0;
35164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35166         return ret_ref;
35167 }
35168
35169 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
35170         LDKChannelMonitor obj_conv;
35171         obj_conv.inner = untag_ptr(obj);
35172         obj_conv.is_owned = ptr_is_owned(obj);
35173         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35174         obj_conv.is_owned = false;
35175         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
35176         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35177         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35178         CVec_u8Z_free(ret_var);
35179         return ret_arr;
35180 }
35181
35182 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) {
35183         LDKChannelMonitor this_arg_conv;
35184         this_arg_conv.inner = untag_ptr(this_arg);
35185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35187         this_arg_conv.is_owned = false;
35188         LDKChannelMonitorUpdate updates_conv;
35189         updates_conv.inner = untag_ptr(updates);
35190         updates_conv.is_owned = ptr_is_owned(updates);
35191         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
35192         updates_conv.is_owned = false;
35193         void* broadcaster_ptr = untag_ptr(broadcaster);
35194         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
35195         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
35196         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35197         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
35198         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
35199         void* logger_ptr = untag_ptr(logger);
35200         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35201         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35202         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
35203         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
35204         return tag_ptr(ret_conv, true);
35205 }
35206
35207 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
35208         LDKChannelMonitor this_arg_conv;
35209         this_arg_conv.inner = untag_ptr(this_arg);
35210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35212         this_arg_conv.is_owned = false;
35213         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
35214         return ret_conv;
35215 }
35216
35217 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
35218         LDKChannelMonitor this_arg_conv;
35219         this_arg_conv.inner = untag_ptr(this_arg);
35220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35222         this_arg_conv.is_owned = false;
35223         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
35224         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
35225         return tag_ptr(ret_conv, true);
35226 }
35227
35228 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
35229         LDKChannelMonitor this_arg_conv;
35230         this_arg_conv.inner = untag_ptr(this_arg);
35231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35233         this_arg_conv.is_owned = false;
35234         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
35235         uint64_tArray ret_arr = NULL;
35236         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35237         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35238         for (size_t a = 0; a < ret_var.datalen; a++) {
35239                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
35240                 *ret_conv_52_conv = ret_var.data[a];
35241                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
35242         }
35243         
35244         FREE(ret_var.data);
35245         return ret_arr;
35246 }
35247
35248 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter, uint64_t logger) {
35249         LDKChannelMonitor this_arg_conv;
35250         this_arg_conv.inner = untag_ptr(this_arg);
35251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35253         this_arg_conv.is_owned = false;
35254         void* filter_ptr = untag_ptr(filter);
35255         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
35256         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
35257         void* logger_ptr = untag_ptr(logger);
35258         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35259         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35260         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv, logger_conv);
35261 }
35262
35263 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) {
35264         LDKChannelMonitor this_arg_conv;
35265         this_arg_conv.inner = untag_ptr(this_arg);
35266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35268         this_arg_conv.is_owned = false;
35269         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
35270         uint64_tArray ret_arr = NULL;
35271         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35272         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35273         for (size_t o = 0; o < ret_var.datalen; o++) {
35274                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35275                 *ret_conv_14_copy = ret_var.data[o];
35276                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
35277                 ret_arr_ptr[o] = ret_conv_14_ref;
35278         }
35279         
35280         FREE(ret_var.data);
35281         return ret_arr;
35282 }
35283
35284 void  __attribute__((export_name("TS_ChannelMonitor_process_pending_events"))) TS_ChannelMonitor_process_pending_events(uint64_t this_arg, uint64_t handler) {
35285         LDKChannelMonitor this_arg_conv;
35286         this_arg_conv.inner = untag_ptr(this_arg);
35287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35289         this_arg_conv.is_owned = false;
35290         void* handler_ptr = untag_ptr(handler);
35291         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
35292         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
35293         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
35294 }
35295
35296 uint64_t  __attribute__((export_name("TS_ChannelMonitor_initial_counterparty_commitment_tx"))) TS_ChannelMonitor_initial_counterparty_commitment_tx(uint64_t this_arg) {
35297         LDKChannelMonitor this_arg_conv;
35298         this_arg_conv.inner = untag_ptr(this_arg);
35299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35301         this_arg_conv.is_owned = false;
35302         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
35303         uint64_t ret_ref = 0;
35304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35306         return ret_ref;
35307 }
35308
35309 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_counterparty_commitment_txs_from_update"))) TS_ChannelMonitor_counterparty_commitment_txs_from_update(uint64_t this_arg, uint64_t update) {
35310         LDKChannelMonitor this_arg_conv;
35311         this_arg_conv.inner = untag_ptr(this_arg);
35312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35314         this_arg_conv.is_owned = false;
35315         LDKChannelMonitorUpdate update_conv;
35316         update_conv.inner = untag_ptr(update);
35317         update_conv.is_owned = ptr_is_owned(update);
35318         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
35319         update_conv.is_owned = false;
35320         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
35321         uint64_tArray ret_arr = NULL;
35322         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35323         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35324         for (size_t x = 0; x < ret_var.datalen; x++) {
35325                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
35326                 uint64_t ret_conv_23_ref = 0;
35327                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
35328                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
35329                 ret_arr_ptr[x] = ret_conv_23_ref;
35330         }
35331         
35332         FREE(ret_var.data);
35333         return ret_arr;
35334 }
35335
35336 uint64_t  __attribute__((export_name("TS_ChannelMonitor_sign_to_local_justice_tx"))) TS_ChannelMonitor_sign_to_local_justice_tx(uint64_t this_arg, int8_tArray justice_tx, uint32_t input_idx, int64_t value, int64_t commitment_number) {
35337         LDKChannelMonitor this_arg_conv;
35338         this_arg_conv.inner = untag_ptr(this_arg);
35339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35341         this_arg_conv.is_owned = false;
35342         LDKTransaction justice_tx_ref;
35343         justice_tx_ref.datalen = justice_tx->arr_len;
35344         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
35345         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
35346         justice_tx_ref.data_is_owned = true;
35347         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
35348         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
35349         return tag_ptr(ret_conv, true);
35350 }
35351
35352 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
35353         LDKChannelMonitor this_arg_conv;
35354         this_arg_conv.inner = untag_ptr(this_arg);
35355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35357         this_arg_conv.is_owned = false;
35358         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35359         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
35360         return ret_arr;
35361 }
35362
35363 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) {
35364         LDKChannelMonitor this_arg_conv;
35365         this_arg_conv.inner = untag_ptr(this_arg);
35366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35368         this_arg_conv.is_owned = false;
35369         void* logger_ptr = untag_ptr(logger);
35370         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35371         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35372         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
35373         ptrArray ret_arr = NULL;
35374         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
35375         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
35376         for (size_t m = 0; m < ret_var.datalen; m++) {
35377                 LDKTransaction ret_conv_12_var = ret_var.data[m];
35378                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
35379                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
35380                 Transaction_free(ret_conv_12_var);
35381                 ret_arr_ptr[m] = ret_conv_12_arr;
35382         }
35383         
35384         FREE(ret_var.data);
35385         return ret_arr;
35386 }
35387
35388 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) {
35389         LDKChannelMonitor this_arg_conv;
35390         this_arg_conv.inner = untag_ptr(this_arg);
35391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35393         this_arg_conv.is_owned = false;
35394         uint8_t header_arr[80];
35395         CHECK(header->arr_len == 80);
35396         memcpy(header_arr, header->elems, 80); FREE(header);
35397         uint8_t (*header_ref)[80] = &header_arr;
35398         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
35399         txdata_constr.datalen = txdata->arr_len;
35400         if (txdata_constr.datalen > 0)
35401                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
35402         else
35403                 txdata_constr.data = NULL;
35404         uint64_t* txdata_vals = txdata->elems;
35405         for (size_t c = 0; c < txdata_constr.datalen; c++) {
35406                 uint64_t txdata_conv_28 = txdata_vals[c];
35407                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
35408                 CHECK_ACCESS(txdata_conv_28_ptr);
35409                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
35410                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
35411                 txdata_constr.data[c] = txdata_conv_28_conv;
35412         }
35413         FREE(txdata);
35414         void* broadcaster_ptr = untag_ptr(broadcaster);
35415         CHECK_ACCESS(broadcaster_ptr);
35416         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35417         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35418                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35419                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35420         }
35421         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35422         CHECK_ACCESS(fee_estimator_ptr);
35423         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35424         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35425                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35426                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35427         }
35428         void* logger_ptr = untag_ptr(logger);
35429         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35430         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35431         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
35432         uint64_tArray ret_arr = NULL;
35433         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35434         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35435         for (size_t x = 0; x < ret_var.datalen; x++) {
35436                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
35437                 *ret_conv_49_conv = ret_var.data[x];
35438                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
35439         }
35440         
35441         FREE(ret_var.data);
35442         return ret_arr;
35443 }
35444
35445 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) {
35446         LDKChannelMonitor this_arg_conv;
35447         this_arg_conv.inner = untag_ptr(this_arg);
35448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35450         this_arg_conv.is_owned = false;
35451         uint8_t header_arr[80];
35452         CHECK(header->arr_len == 80);
35453         memcpy(header_arr, header->elems, 80); FREE(header);
35454         uint8_t (*header_ref)[80] = &header_arr;
35455         void* broadcaster_ptr = untag_ptr(broadcaster);
35456         CHECK_ACCESS(broadcaster_ptr);
35457         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35458         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35459                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35460                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35461         }
35462         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35463         CHECK_ACCESS(fee_estimator_ptr);
35464         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35465         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35466                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35467                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35468         }
35469         void* logger_ptr = untag_ptr(logger);
35470         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35471         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35472         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
35473 }
35474
35475 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) {
35476         LDKChannelMonitor this_arg_conv;
35477         this_arg_conv.inner = untag_ptr(this_arg);
35478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35480         this_arg_conv.is_owned = false;
35481         uint8_t header_arr[80];
35482         CHECK(header->arr_len == 80);
35483         memcpy(header_arr, header->elems, 80); FREE(header);
35484         uint8_t (*header_ref)[80] = &header_arr;
35485         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
35486         txdata_constr.datalen = txdata->arr_len;
35487         if (txdata_constr.datalen > 0)
35488                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
35489         else
35490                 txdata_constr.data = NULL;
35491         uint64_t* txdata_vals = txdata->elems;
35492         for (size_t c = 0; c < txdata_constr.datalen; c++) {
35493                 uint64_t txdata_conv_28 = txdata_vals[c];
35494                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
35495                 CHECK_ACCESS(txdata_conv_28_ptr);
35496                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
35497                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
35498                 txdata_constr.data[c] = txdata_conv_28_conv;
35499         }
35500         FREE(txdata);
35501         void* broadcaster_ptr = untag_ptr(broadcaster);
35502         CHECK_ACCESS(broadcaster_ptr);
35503         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35504         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35505                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35506                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35507         }
35508         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35509         CHECK_ACCESS(fee_estimator_ptr);
35510         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35511         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35512                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35513                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35514         }
35515         void* logger_ptr = untag_ptr(logger);
35516         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35517         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35518         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_transactions_confirmed(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
35519         uint64_tArray ret_arr = NULL;
35520         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35521         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35522         for (size_t x = 0; x < ret_var.datalen; x++) {
35523                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
35524                 *ret_conv_49_conv = ret_var.data[x];
35525                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
35526         }
35527         
35528         FREE(ret_var.data);
35529         return ret_arr;
35530 }
35531
35532 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) {
35533         LDKChannelMonitor this_arg_conv;
35534         this_arg_conv.inner = untag_ptr(this_arg);
35535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35537         this_arg_conv.is_owned = false;
35538         uint8_t txid_arr[32];
35539         CHECK(txid->arr_len == 32);
35540         memcpy(txid_arr, txid->elems, 32); FREE(txid);
35541         uint8_t (*txid_ref)[32] = &txid_arr;
35542         void* broadcaster_ptr = untag_ptr(broadcaster);
35543         CHECK_ACCESS(broadcaster_ptr);
35544         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35545         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35546                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35547                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35548         }
35549         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35550         CHECK_ACCESS(fee_estimator_ptr);
35551         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35552         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35553                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35554                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35555         }
35556         void* logger_ptr = untag_ptr(logger);
35557         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35558         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35559         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
35560 }
35561
35562 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) {
35563         LDKChannelMonitor this_arg_conv;
35564         this_arg_conv.inner = untag_ptr(this_arg);
35565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35567         this_arg_conv.is_owned = false;
35568         uint8_t header_arr[80];
35569         CHECK(header->arr_len == 80);
35570         memcpy(header_arr, header->elems, 80); FREE(header);
35571         uint8_t (*header_ref)[80] = &header_arr;
35572         void* broadcaster_ptr = untag_ptr(broadcaster);
35573         CHECK_ACCESS(broadcaster_ptr);
35574         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35575         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35576                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35577                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35578         }
35579         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35580         CHECK_ACCESS(fee_estimator_ptr);
35581         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35582         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35583                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35584                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35585         }
35586         void* logger_ptr = untag_ptr(logger);
35587         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35588         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35589         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
35590         uint64_tArray ret_arr = NULL;
35591         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35592         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35593         for (size_t x = 0; x < ret_var.datalen; x++) {
35594                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
35595                 *ret_conv_49_conv = ret_var.data[x];
35596                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
35597         }
35598         
35599         FREE(ret_var.data);
35600         return ret_arr;
35601 }
35602
35603 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
35604         LDKChannelMonitor this_arg_conv;
35605         this_arg_conv.inner = untag_ptr(this_arg);
35606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35608         this_arg_conv.is_owned = false;
35609         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
35610         uint64_tArray ret_arr = NULL;
35611         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35612         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35613         for (size_t c = 0; c < ret_var.datalen; c++) {
35614                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
35615                 *ret_conv_54_conv = ret_var.data[c];
35616                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
35617         }
35618         
35619         FREE(ret_var.data);
35620         return ret_arr;
35621 }
35622
35623 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
35624         LDKChannelMonitor this_arg_conv;
35625         this_arg_conv.inner = untag_ptr(this_arg);
35626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35628         this_arg_conv.is_owned = false;
35629         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
35630         uint64_t ret_ref = 0;
35631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35633         return ret_ref;
35634 }
35635
35636 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) {
35637         LDKChannelMonitor this_arg_conv;
35638         this_arg_conv.inner = untag_ptr(this_arg);
35639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35641         this_arg_conv.is_owned = false;
35642         void* broadcaster_ptr = untag_ptr(broadcaster);
35643         CHECK_ACCESS(broadcaster_ptr);
35644         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35645         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35646                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35647                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35648         }
35649         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35650         CHECK_ACCESS(fee_estimator_ptr);
35651         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35652         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35653                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35654                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35655         }
35656         void* logger_ptr = untag_ptr(logger);
35657         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35658         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35659         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
35660 }
35661
35662 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_spendable_outputs"))) TS_ChannelMonitor_get_spendable_outputs(uint64_t this_arg, int8_tArray tx, int32_t confirmation_height) {
35663         LDKChannelMonitor this_arg_conv;
35664         this_arg_conv.inner = untag_ptr(this_arg);
35665         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35667         this_arg_conv.is_owned = false;
35668         LDKTransaction tx_ref;
35669         tx_ref.datalen = tx->arr_len;
35670         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
35671         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
35672         tx_ref.data_is_owned = true;
35673         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
35674         uint64_tArray ret_arr = NULL;
35675         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35676         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35677         for (size_t b = 0; b < ret_var.datalen; b++) {
35678                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
35679                 *ret_conv_27_copy = ret_var.data[b];
35680                 uint64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
35681                 ret_arr_ptr[b] = ret_conv_27_ref;
35682         }
35683         
35684         FREE(ret_var.data);
35685         return ret_arr;
35686 }
35687
35688 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
35689         LDKChannelMonitor this_arg_conv;
35690         this_arg_conv.inner = untag_ptr(this_arg);
35691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35693         this_arg_conv.is_owned = false;
35694         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
35695         uint64_tArray ret_arr = NULL;
35696         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35697         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35698         for (size_t j = 0; j < ret_var.datalen; j++) {
35699                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35700                 *ret_conv_9_copy = ret_var.data[j];
35701                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
35702                 ret_arr_ptr[j] = ret_conv_9_ref;
35703         }
35704         
35705         FREE(ret_var.data);
35706         return ret_arr;
35707 }
35708
35709 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b) {
35710         LDKu8slice ser_ref;
35711         ser_ref.datalen = ser->arr_len;
35712         ser_ref.data = ser->elems;
35713         void* arg_a_ptr = untag_ptr(arg_a);
35714         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
35715         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
35716         void* arg_b_ptr = untag_ptr(arg_b);
35717         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
35718         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
35719         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
35720         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
35721         FREE(ser);
35722         return tag_ptr(ret_conv, true);
35723 }
35724
35725 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
35726         LDKOutPoint this_obj_conv;
35727         this_obj_conv.inner = untag_ptr(this_obj);
35728         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35730         OutPoint_free(this_obj_conv);
35731 }
35732
35733 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
35734         LDKOutPoint this_ptr_conv;
35735         this_ptr_conv.inner = untag_ptr(this_ptr);
35736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35738         this_ptr_conv.is_owned = false;
35739         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35740         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
35741         return ret_arr;
35742 }
35743
35744 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
35745         LDKOutPoint 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         LDKThirtyTwoBytes val_ref;
35751         CHECK(val->arr_len == 32);
35752         memcpy(val_ref.data, val->elems, 32); FREE(val);
35753         OutPoint_set_txid(&this_ptr_conv, val_ref);
35754 }
35755
35756 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
35757         LDKOutPoint this_ptr_conv;
35758         this_ptr_conv.inner = untag_ptr(this_ptr);
35759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35761         this_ptr_conv.is_owned = false;
35762         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
35763         return ret_conv;
35764 }
35765
35766 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
35767         LDKOutPoint this_ptr_conv;
35768         this_ptr_conv.inner = untag_ptr(this_ptr);
35769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35771         this_ptr_conv.is_owned = false;
35772         OutPoint_set_index(&this_ptr_conv, val);
35773 }
35774
35775 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
35776         LDKThirtyTwoBytes txid_arg_ref;
35777         CHECK(txid_arg->arr_len == 32);
35778         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
35779         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
35780         uint64_t ret_ref = 0;
35781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35783         return ret_ref;
35784 }
35785
35786 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
35787         LDKOutPoint ret_var = OutPoint_clone(arg);
35788         uint64_t ret_ref = 0;
35789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35791         return ret_ref;
35792 }
35793 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
35794         LDKOutPoint arg_conv;
35795         arg_conv.inner = untag_ptr(arg);
35796         arg_conv.is_owned = ptr_is_owned(arg);
35797         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35798         arg_conv.is_owned = false;
35799         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
35800         return ret_conv;
35801 }
35802
35803 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
35804         LDKOutPoint orig_conv;
35805         orig_conv.inner = untag_ptr(orig);
35806         orig_conv.is_owned = ptr_is_owned(orig);
35807         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35808         orig_conv.is_owned = false;
35809         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
35810         uint64_t ret_ref = 0;
35811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35813         return ret_ref;
35814 }
35815
35816 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
35817         LDKOutPoint a_conv;
35818         a_conv.inner = untag_ptr(a);
35819         a_conv.is_owned = ptr_is_owned(a);
35820         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35821         a_conv.is_owned = false;
35822         LDKOutPoint b_conv;
35823         b_conv.inner = untag_ptr(b);
35824         b_conv.is_owned = ptr_is_owned(b);
35825         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35826         b_conv.is_owned = false;
35827         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
35828         return ret_conv;
35829 }
35830
35831 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
35832         LDKOutPoint o_conv;
35833         o_conv.inner = untag_ptr(o);
35834         o_conv.is_owned = ptr_is_owned(o);
35835         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35836         o_conv.is_owned = false;
35837         int64_t ret_conv = OutPoint_hash(&o_conv);
35838         return ret_conv;
35839 }
35840
35841 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
35842         LDKOutPoint this_arg_conv;
35843         this_arg_conv.inner = untag_ptr(this_arg);
35844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35846         this_arg_conv.is_owned = false;
35847         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35848         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
35849         return ret_arr;
35850 }
35851
35852 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
35853         LDKOutPoint obj_conv;
35854         obj_conv.inner = untag_ptr(obj);
35855         obj_conv.is_owned = ptr_is_owned(obj);
35856         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35857         obj_conv.is_owned = false;
35858         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
35859         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35860         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35861         CVec_u8Z_free(ret_var);
35862         return ret_arr;
35863 }
35864
35865 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
35866         LDKu8slice ser_ref;
35867         ser_ref.datalen = ser->arr_len;
35868         ser_ref.data = ser->elems;
35869         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
35870         *ret_conv = OutPoint_read(ser_ref);
35871         FREE(ser);
35872         return tag_ptr(ret_conv, true);
35873 }
35874
35875 void  __attribute__((export_name("TS_InboundHTLCErr_free"))) TS_InboundHTLCErr_free(uint64_t this_obj) {
35876         LDKInboundHTLCErr this_obj_conv;
35877         this_obj_conv.inner = untag_ptr(this_obj);
35878         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35880         InboundHTLCErr_free(this_obj_conv);
35881 }
35882
35883 int16_t  __attribute__((export_name("TS_InboundHTLCErr_get_err_code"))) TS_InboundHTLCErr_get_err_code(uint64_t this_ptr) {
35884         LDKInboundHTLCErr this_ptr_conv;
35885         this_ptr_conv.inner = untag_ptr(this_ptr);
35886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35888         this_ptr_conv.is_owned = false;
35889         int16_t ret_conv = InboundHTLCErr_get_err_code(&this_ptr_conv);
35890         return ret_conv;
35891 }
35892
35893 void  __attribute__((export_name("TS_InboundHTLCErr_set_err_code"))) TS_InboundHTLCErr_set_err_code(uint64_t this_ptr, int16_t val) {
35894         LDKInboundHTLCErr this_ptr_conv;
35895         this_ptr_conv.inner = untag_ptr(this_ptr);
35896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35898         this_ptr_conv.is_owned = false;
35899         InboundHTLCErr_set_err_code(&this_ptr_conv, val);
35900 }
35901
35902 int8_tArray  __attribute__((export_name("TS_InboundHTLCErr_get_err_data"))) TS_InboundHTLCErr_get_err_data(uint64_t this_ptr) {
35903         LDKInboundHTLCErr this_ptr_conv;
35904         this_ptr_conv.inner = untag_ptr(this_ptr);
35905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35907         this_ptr_conv.is_owned = false;
35908         LDKCVec_u8Z ret_var = InboundHTLCErr_get_err_data(&this_ptr_conv);
35909         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35910         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35911         CVec_u8Z_free(ret_var);
35912         return ret_arr;
35913 }
35914
35915 void  __attribute__((export_name("TS_InboundHTLCErr_set_err_data"))) TS_InboundHTLCErr_set_err_data(uint64_t this_ptr, int8_tArray val) {
35916         LDKInboundHTLCErr this_ptr_conv;
35917         this_ptr_conv.inner = untag_ptr(this_ptr);
35918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35920         this_ptr_conv.is_owned = false;
35921         LDKCVec_u8Z val_ref;
35922         val_ref.datalen = val->arr_len;
35923         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
35924         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
35925         InboundHTLCErr_set_err_data(&this_ptr_conv, val_ref);
35926 }
35927
35928 jstring  __attribute__((export_name("TS_InboundHTLCErr_get_msg"))) TS_InboundHTLCErr_get_msg(uint64_t this_ptr) {
35929         LDKInboundHTLCErr this_ptr_conv;
35930         this_ptr_conv.inner = untag_ptr(this_ptr);
35931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35933         this_ptr_conv.is_owned = false;
35934         LDKStr ret_str = InboundHTLCErr_get_msg(&this_ptr_conv);
35935         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
35936         Str_free(ret_str);
35937         return ret_conv;
35938 }
35939
35940 void  __attribute__((export_name("TS_InboundHTLCErr_set_msg"))) TS_InboundHTLCErr_set_msg(uint64_t this_ptr, jstring val) {
35941         LDKInboundHTLCErr this_ptr_conv;
35942         this_ptr_conv.inner = untag_ptr(this_ptr);
35943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35945         this_ptr_conv.is_owned = false;
35946         LDKStr val_conv = str_ref_to_owned_c(val);
35947         InboundHTLCErr_set_msg(&this_ptr_conv, val_conv);
35948 }
35949
35950 uint64_t  __attribute__((export_name("TS_InboundHTLCErr_new"))) TS_InboundHTLCErr_new(int16_t err_code_arg, int8_tArray err_data_arg, jstring msg_arg) {
35951         LDKCVec_u8Z err_data_arg_ref;
35952         err_data_arg_ref.datalen = err_data_arg->arr_len;
35953         err_data_arg_ref.data = MALLOC(err_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
35954         memcpy(err_data_arg_ref.data, err_data_arg->elems, err_data_arg_ref.datalen); FREE(err_data_arg);
35955         LDKStr msg_arg_conv = str_ref_to_owned_c(msg_arg);
35956         LDKInboundHTLCErr ret_var = InboundHTLCErr_new(err_code_arg, err_data_arg_ref, msg_arg_conv);
35957         uint64_t ret_ref = 0;
35958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35960         return ret_ref;
35961 }
35962
35963 uint64_t  __attribute__((export_name("TS_peel_payment_onion"))) TS_peel_payment_onion(uint64_t msg, uint64_t node_signer, uint64_t logger, int32_t cur_height, jboolean accept_mpp_keysend, jboolean allow_skimmed_fees) {
35964         LDKUpdateAddHTLC msg_conv;
35965         msg_conv.inner = untag_ptr(msg);
35966         msg_conv.is_owned = ptr_is_owned(msg);
35967         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35968         msg_conv.is_owned = false;
35969         void* node_signer_ptr = untag_ptr(node_signer);
35970         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
35971         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
35972         void* logger_ptr = untag_ptr(logger);
35973         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35974         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35975         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
35976         *ret_conv = peel_payment_onion(&msg_conv, node_signer_conv, logger_conv, cur_height, accept_mpp_keysend, allow_skimmed_fees);
35977         return tag_ptr(ret_conv, true);
35978 }
35979
35980 void  __attribute__((export_name("TS_PendingHTLCRouting_free"))) TS_PendingHTLCRouting_free(uint64_t this_ptr) {
35981         if (!ptr_is_owned(this_ptr)) return;
35982         void* this_ptr_ptr = untag_ptr(this_ptr);
35983         CHECK_ACCESS(this_ptr_ptr);
35984         LDKPendingHTLCRouting this_ptr_conv = *(LDKPendingHTLCRouting*)(this_ptr_ptr);
35985         FREE(untag_ptr(this_ptr));
35986         PendingHTLCRouting_free(this_ptr_conv);
35987 }
35988
35989 static inline uint64_t PendingHTLCRouting_clone_ptr(LDKPendingHTLCRouting *NONNULL_PTR arg) {
35990         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
35991         *ret_copy = PendingHTLCRouting_clone(arg);
35992         uint64_t ret_ref = tag_ptr(ret_copy, true);
35993         return ret_ref;
35994 }
35995 int64_t  __attribute__((export_name("TS_PendingHTLCRouting_clone_ptr"))) TS_PendingHTLCRouting_clone_ptr(uint64_t arg) {
35996         LDKPendingHTLCRouting* arg_conv = (LDKPendingHTLCRouting*)untag_ptr(arg);
35997         int64_t ret_conv = PendingHTLCRouting_clone_ptr(arg_conv);
35998         return ret_conv;
35999 }
36000
36001 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_clone"))) TS_PendingHTLCRouting_clone(uint64_t orig) {
36002         LDKPendingHTLCRouting* orig_conv = (LDKPendingHTLCRouting*)untag_ptr(orig);
36003         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36004         *ret_copy = PendingHTLCRouting_clone(orig_conv);
36005         uint64_t ret_ref = tag_ptr(ret_copy, true);
36006         return ret_ref;
36007 }
36008
36009 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_forward"))) TS_PendingHTLCRouting_forward(uint64_t onion_packet, int64_t short_channel_id, uint64_t blinded) {
36010         LDKOnionPacket onion_packet_conv;
36011         onion_packet_conv.inner = untag_ptr(onion_packet);
36012         onion_packet_conv.is_owned = ptr_is_owned(onion_packet);
36013         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_conv);
36014         onion_packet_conv = OnionPacket_clone(&onion_packet_conv);
36015         LDKBlindedForward blinded_conv;
36016         blinded_conv.inner = untag_ptr(blinded);
36017         blinded_conv.is_owned = ptr_is_owned(blinded);
36018         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_conv);
36019         blinded_conv = BlindedForward_clone(&blinded_conv);
36020         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36021         *ret_copy = PendingHTLCRouting_forward(onion_packet_conv, short_channel_id, blinded_conv);
36022         uint64_t ret_ref = tag_ptr(ret_copy, true);
36023         return ret_ref;
36024 }
36025
36026 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_receive"))) TS_PendingHTLCRouting_receive(uint64_t payment_data, uint64_t payment_metadata, int32_t incoming_cltv_expiry, int8_tArray phantom_shared_secret, uint64_tArray custom_tlvs, jboolean requires_blinded_error) {
36027         LDKFinalOnionHopData payment_data_conv;
36028         payment_data_conv.inner = untag_ptr(payment_data);
36029         payment_data_conv.is_owned = ptr_is_owned(payment_data);
36030         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
36031         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
36032         void* payment_metadata_ptr = untag_ptr(payment_metadata);
36033         CHECK_ACCESS(payment_metadata_ptr);
36034         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
36035         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
36036         LDKThirtyTwoBytes phantom_shared_secret_ref;
36037         CHECK(phantom_shared_secret->arr_len == 32);
36038         memcpy(phantom_shared_secret_ref.data, phantom_shared_secret->elems, 32); FREE(phantom_shared_secret);
36039         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
36040         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
36041         if (custom_tlvs_constr.datalen > 0)
36042                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
36043         else
36044                 custom_tlvs_constr.data = NULL;
36045         uint64_t* custom_tlvs_vals = custom_tlvs->elems;
36046         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
36047                 uint64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
36048                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
36049                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
36050                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
36051                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
36052                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
36053         }
36054         FREE(custom_tlvs);
36055         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36056         *ret_copy = PendingHTLCRouting_receive(payment_data_conv, payment_metadata_conv, incoming_cltv_expiry, phantom_shared_secret_ref, custom_tlvs_constr, requires_blinded_error);
36057         uint64_t ret_ref = tag_ptr(ret_copy, true);
36058         return ret_ref;
36059 }
36060
36061 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_receive_keysend"))) TS_PendingHTLCRouting_receive_keysend(uint64_t payment_data, int8_tArray payment_preimage, uint64_t payment_metadata, int32_t incoming_cltv_expiry, uint64_tArray custom_tlvs) {
36062         LDKFinalOnionHopData payment_data_conv;
36063         payment_data_conv.inner = untag_ptr(payment_data);
36064         payment_data_conv.is_owned = ptr_is_owned(payment_data);
36065         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
36066         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
36067         LDKThirtyTwoBytes payment_preimage_ref;
36068         CHECK(payment_preimage->arr_len == 32);
36069         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
36070         void* payment_metadata_ptr = untag_ptr(payment_metadata);
36071         CHECK_ACCESS(payment_metadata_ptr);
36072         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
36073         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
36074         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
36075         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
36076         if (custom_tlvs_constr.datalen > 0)
36077                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
36078         else
36079                 custom_tlvs_constr.data = NULL;
36080         uint64_t* custom_tlvs_vals = custom_tlvs->elems;
36081         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
36082                 uint64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
36083                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
36084                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
36085                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
36086                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
36087                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
36088         }
36089         FREE(custom_tlvs);
36090         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36091         *ret_copy = PendingHTLCRouting_receive_keysend(payment_data_conv, payment_preimage_ref, payment_metadata_conv, incoming_cltv_expiry, custom_tlvs_constr);
36092         uint64_t ret_ref = tag_ptr(ret_copy, true);
36093         return ret_ref;
36094 }
36095
36096 void  __attribute__((export_name("TS_BlindedForward_free"))) TS_BlindedForward_free(uint64_t this_obj) {
36097         LDKBlindedForward this_obj_conv;
36098         this_obj_conv.inner = untag_ptr(this_obj);
36099         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36101         BlindedForward_free(this_obj_conv);
36102 }
36103
36104 int8_tArray  __attribute__((export_name("TS_BlindedForward_get_inbound_blinding_point"))) TS_BlindedForward_get_inbound_blinding_point(uint64_t this_ptr) {
36105         LDKBlindedForward this_ptr_conv;
36106         this_ptr_conv.inner = untag_ptr(this_ptr);
36107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36109         this_ptr_conv.is_owned = false;
36110         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36111         memcpy(ret_arr->elems, BlindedForward_get_inbound_blinding_point(&this_ptr_conv).compressed_form, 33);
36112         return ret_arr;
36113 }
36114
36115 void  __attribute__((export_name("TS_BlindedForward_set_inbound_blinding_point"))) TS_BlindedForward_set_inbound_blinding_point(uint64_t this_ptr, int8_tArray val) {
36116         LDKBlindedForward this_ptr_conv;
36117         this_ptr_conv.inner = untag_ptr(this_ptr);
36118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36120         this_ptr_conv.is_owned = false;
36121         LDKPublicKey val_ref;
36122         CHECK(val->arr_len == 33);
36123         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36124         BlindedForward_set_inbound_blinding_point(&this_ptr_conv, val_ref);
36125 }
36126
36127 uint32_t  __attribute__((export_name("TS_BlindedForward_get_failure"))) TS_BlindedForward_get_failure(uint64_t this_ptr) {
36128         LDKBlindedForward this_ptr_conv;
36129         this_ptr_conv.inner = untag_ptr(this_ptr);
36130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36132         this_ptr_conv.is_owned = false;
36133         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedForward_get_failure(&this_ptr_conv));
36134         return ret_conv;
36135 }
36136
36137 void  __attribute__((export_name("TS_BlindedForward_set_failure"))) TS_BlindedForward_set_failure(uint64_t this_ptr, uint32_t val) {
36138         LDKBlindedForward 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         LDKBlindedFailure val_conv = LDKBlindedFailure_from_js(val);
36144         BlindedForward_set_failure(&this_ptr_conv, val_conv);
36145 }
36146
36147 uint64_t  __attribute__((export_name("TS_BlindedForward_new"))) TS_BlindedForward_new(int8_tArray inbound_blinding_point_arg, uint32_t failure_arg) {
36148         LDKPublicKey inbound_blinding_point_arg_ref;
36149         CHECK(inbound_blinding_point_arg->arr_len == 33);
36150         memcpy(inbound_blinding_point_arg_ref.compressed_form, inbound_blinding_point_arg->elems, 33); FREE(inbound_blinding_point_arg);
36151         LDKBlindedFailure failure_arg_conv = LDKBlindedFailure_from_js(failure_arg);
36152         LDKBlindedForward ret_var = BlindedForward_new(inbound_blinding_point_arg_ref, failure_arg_conv);
36153         uint64_t ret_ref = 0;
36154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36156         return ret_ref;
36157 }
36158
36159 static inline uint64_t BlindedForward_clone_ptr(LDKBlindedForward *NONNULL_PTR arg) {
36160         LDKBlindedForward ret_var = BlindedForward_clone(arg);
36161         uint64_t ret_ref = 0;
36162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36164         return ret_ref;
36165 }
36166 int64_t  __attribute__((export_name("TS_BlindedForward_clone_ptr"))) TS_BlindedForward_clone_ptr(uint64_t arg) {
36167         LDKBlindedForward arg_conv;
36168         arg_conv.inner = untag_ptr(arg);
36169         arg_conv.is_owned = ptr_is_owned(arg);
36170         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36171         arg_conv.is_owned = false;
36172         int64_t ret_conv = BlindedForward_clone_ptr(&arg_conv);
36173         return ret_conv;
36174 }
36175
36176 uint64_t  __attribute__((export_name("TS_BlindedForward_clone"))) TS_BlindedForward_clone(uint64_t orig) {
36177         LDKBlindedForward orig_conv;
36178         orig_conv.inner = untag_ptr(orig);
36179         orig_conv.is_owned = ptr_is_owned(orig);
36180         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36181         orig_conv.is_owned = false;
36182         LDKBlindedForward ret_var = BlindedForward_clone(&orig_conv);
36183         uint64_t ret_ref = 0;
36184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36186         return ret_ref;
36187 }
36188
36189 int64_t  __attribute__((export_name("TS_BlindedForward_hash"))) TS_BlindedForward_hash(uint64_t o) {
36190         LDKBlindedForward o_conv;
36191         o_conv.inner = untag_ptr(o);
36192         o_conv.is_owned = ptr_is_owned(o);
36193         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36194         o_conv.is_owned = false;
36195         int64_t ret_conv = BlindedForward_hash(&o_conv);
36196         return ret_conv;
36197 }
36198
36199 jboolean  __attribute__((export_name("TS_BlindedForward_eq"))) TS_BlindedForward_eq(uint64_t a, uint64_t b) {
36200         LDKBlindedForward a_conv;
36201         a_conv.inner = untag_ptr(a);
36202         a_conv.is_owned = ptr_is_owned(a);
36203         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36204         a_conv.is_owned = false;
36205         LDKBlindedForward b_conv;
36206         b_conv.inner = untag_ptr(b);
36207         b_conv.is_owned = ptr_is_owned(b);
36208         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36209         b_conv.is_owned = false;
36210         jboolean ret_conv = BlindedForward_eq(&a_conv, &b_conv);
36211         return ret_conv;
36212 }
36213
36214 void  __attribute__((export_name("TS_PendingHTLCInfo_free"))) TS_PendingHTLCInfo_free(uint64_t this_obj) {
36215         LDKPendingHTLCInfo this_obj_conv;
36216         this_obj_conv.inner = untag_ptr(this_obj);
36217         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36219         PendingHTLCInfo_free(this_obj_conv);
36220 }
36221
36222 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_routing"))) TS_PendingHTLCInfo_get_routing(uint64_t this_ptr) {
36223         LDKPendingHTLCInfo this_ptr_conv;
36224         this_ptr_conv.inner = untag_ptr(this_ptr);
36225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36227         this_ptr_conv.is_owned = false;
36228         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36229         *ret_copy = PendingHTLCInfo_get_routing(&this_ptr_conv);
36230         uint64_t ret_ref = tag_ptr(ret_copy, true);
36231         return ret_ref;
36232 }
36233
36234 void  __attribute__((export_name("TS_PendingHTLCInfo_set_routing"))) TS_PendingHTLCInfo_set_routing(uint64_t this_ptr, uint64_t val) {
36235         LDKPendingHTLCInfo this_ptr_conv;
36236         this_ptr_conv.inner = untag_ptr(this_ptr);
36237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36239         this_ptr_conv.is_owned = false;
36240         void* val_ptr = untag_ptr(val);
36241         CHECK_ACCESS(val_ptr);
36242         LDKPendingHTLCRouting val_conv = *(LDKPendingHTLCRouting*)(val_ptr);
36243         val_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(val));
36244         PendingHTLCInfo_set_routing(&this_ptr_conv, val_conv);
36245 }
36246
36247 int8_tArray  __attribute__((export_name("TS_PendingHTLCInfo_get_incoming_shared_secret"))) TS_PendingHTLCInfo_get_incoming_shared_secret(uint64_t this_ptr) {
36248         LDKPendingHTLCInfo this_ptr_conv;
36249         this_ptr_conv.inner = untag_ptr(this_ptr);
36250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36252         this_ptr_conv.is_owned = false;
36253         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36254         memcpy(ret_arr->elems, *PendingHTLCInfo_get_incoming_shared_secret(&this_ptr_conv), 32);
36255         return ret_arr;
36256 }
36257
36258 void  __attribute__((export_name("TS_PendingHTLCInfo_set_incoming_shared_secret"))) TS_PendingHTLCInfo_set_incoming_shared_secret(uint64_t this_ptr, int8_tArray val) {
36259         LDKPendingHTLCInfo this_ptr_conv;
36260         this_ptr_conv.inner = untag_ptr(this_ptr);
36261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36263         this_ptr_conv.is_owned = false;
36264         LDKThirtyTwoBytes val_ref;
36265         CHECK(val->arr_len == 32);
36266         memcpy(val_ref.data, val->elems, 32); FREE(val);
36267         PendingHTLCInfo_set_incoming_shared_secret(&this_ptr_conv, val_ref);
36268 }
36269
36270 int8_tArray  __attribute__((export_name("TS_PendingHTLCInfo_get_payment_hash"))) TS_PendingHTLCInfo_get_payment_hash(uint64_t this_ptr) {
36271         LDKPendingHTLCInfo this_ptr_conv;
36272         this_ptr_conv.inner = untag_ptr(this_ptr);
36273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36275         this_ptr_conv.is_owned = false;
36276         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36277         memcpy(ret_arr->elems, *PendingHTLCInfo_get_payment_hash(&this_ptr_conv), 32);
36278         return ret_arr;
36279 }
36280
36281 void  __attribute__((export_name("TS_PendingHTLCInfo_set_payment_hash"))) TS_PendingHTLCInfo_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
36282         LDKPendingHTLCInfo this_ptr_conv;
36283         this_ptr_conv.inner = untag_ptr(this_ptr);
36284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36286         this_ptr_conv.is_owned = false;
36287         LDKThirtyTwoBytes val_ref;
36288         CHECK(val->arr_len == 32);
36289         memcpy(val_ref.data, val->elems, 32); FREE(val);
36290         PendingHTLCInfo_set_payment_hash(&this_ptr_conv, val_ref);
36291 }
36292
36293 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_incoming_amt_msat"))) TS_PendingHTLCInfo_get_incoming_amt_msat(uint64_t this_ptr) {
36294         LDKPendingHTLCInfo this_ptr_conv;
36295         this_ptr_conv.inner = untag_ptr(this_ptr);
36296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36298         this_ptr_conv.is_owned = false;
36299         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36300         *ret_copy = PendingHTLCInfo_get_incoming_amt_msat(&this_ptr_conv);
36301         uint64_t ret_ref = tag_ptr(ret_copy, true);
36302         return ret_ref;
36303 }
36304
36305 void  __attribute__((export_name("TS_PendingHTLCInfo_set_incoming_amt_msat"))) TS_PendingHTLCInfo_set_incoming_amt_msat(uint64_t this_ptr, uint64_t val) {
36306         LDKPendingHTLCInfo this_ptr_conv;
36307         this_ptr_conv.inner = untag_ptr(this_ptr);
36308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36310         this_ptr_conv.is_owned = false;
36311         void* val_ptr = untag_ptr(val);
36312         CHECK_ACCESS(val_ptr);
36313         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36314         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36315         PendingHTLCInfo_set_incoming_amt_msat(&this_ptr_conv, val_conv);
36316 }
36317
36318 int64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_outgoing_amt_msat"))) TS_PendingHTLCInfo_get_outgoing_amt_msat(uint64_t this_ptr) {
36319         LDKPendingHTLCInfo this_ptr_conv;
36320         this_ptr_conv.inner = untag_ptr(this_ptr);
36321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36323         this_ptr_conv.is_owned = false;
36324         int64_t ret_conv = PendingHTLCInfo_get_outgoing_amt_msat(&this_ptr_conv);
36325         return ret_conv;
36326 }
36327
36328 void  __attribute__((export_name("TS_PendingHTLCInfo_set_outgoing_amt_msat"))) TS_PendingHTLCInfo_set_outgoing_amt_msat(uint64_t this_ptr, int64_t val) {
36329         LDKPendingHTLCInfo this_ptr_conv;
36330         this_ptr_conv.inner = untag_ptr(this_ptr);
36331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36333         this_ptr_conv.is_owned = false;
36334         PendingHTLCInfo_set_outgoing_amt_msat(&this_ptr_conv, val);
36335 }
36336
36337 int32_t  __attribute__((export_name("TS_PendingHTLCInfo_get_outgoing_cltv_value"))) TS_PendingHTLCInfo_get_outgoing_cltv_value(uint64_t this_ptr) {
36338         LDKPendingHTLCInfo 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         int32_t ret_conv = PendingHTLCInfo_get_outgoing_cltv_value(&this_ptr_conv);
36344         return ret_conv;
36345 }
36346
36347 void  __attribute__((export_name("TS_PendingHTLCInfo_set_outgoing_cltv_value"))) TS_PendingHTLCInfo_set_outgoing_cltv_value(uint64_t this_ptr, int32_t val) {
36348         LDKPendingHTLCInfo this_ptr_conv;
36349         this_ptr_conv.inner = untag_ptr(this_ptr);
36350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36352         this_ptr_conv.is_owned = false;
36353         PendingHTLCInfo_set_outgoing_cltv_value(&this_ptr_conv, val);
36354 }
36355
36356 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_skimmed_fee_msat"))) TS_PendingHTLCInfo_get_skimmed_fee_msat(uint64_t this_ptr) {
36357         LDKPendingHTLCInfo this_ptr_conv;
36358         this_ptr_conv.inner = untag_ptr(this_ptr);
36359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36361         this_ptr_conv.is_owned = false;
36362         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36363         *ret_copy = PendingHTLCInfo_get_skimmed_fee_msat(&this_ptr_conv);
36364         uint64_t ret_ref = tag_ptr(ret_copy, true);
36365         return ret_ref;
36366 }
36367
36368 void  __attribute__((export_name("TS_PendingHTLCInfo_set_skimmed_fee_msat"))) TS_PendingHTLCInfo_set_skimmed_fee_msat(uint64_t this_ptr, uint64_t val) {
36369         LDKPendingHTLCInfo 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         void* val_ptr = untag_ptr(val);
36375         CHECK_ACCESS(val_ptr);
36376         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36377         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36378         PendingHTLCInfo_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
36379 }
36380
36381 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_new"))) TS_PendingHTLCInfo_new(uint64_t routing_arg, int8_tArray incoming_shared_secret_arg, int8_tArray payment_hash_arg, uint64_t incoming_amt_msat_arg, int64_t outgoing_amt_msat_arg, int32_t outgoing_cltv_value_arg, uint64_t skimmed_fee_msat_arg) {
36382         void* routing_arg_ptr = untag_ptr(routing_arg);
36383         CHECK_ACCESS(routing_arg_ptr);
36384         LDKPendingHTLCRouting routing_arg_conv = *(LDKPendingHTLCRouting*)(routing_arg_ptr);
36385         routing_arg_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(routing_arg));
36386         LDKThirtyTwoBytes incoming_shared_secret_arg_ref;
36387         CHECK(incoming_shared_secret_arg->arr_len == 32);
36388         memcpy(incoming_shared_secret_arg_ref.data, incoming_shared_secret_arg->elems, 32); FREE(incoming_shared_secret_arg);
36389         LDKThirtyTwoBytes payment_hash_arg_ref;
36390         CHECK(payment_hash_arg->arr_len == 32);
36391         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
36392         void* incoming_amt_msat_arg_ptr = untag_ptr(incoming_amt_msat_arg);
36393         CHECK_ACCESS(incoming_amt_msat_arg_ptr);
36394         LDKCOption_u64Z incoming_amt_msat_arg_conv = *(LDKCOption_u64Z*)(incoming_amt_msat_arg_ptr);
36395         incoming_amt_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(incoming_amt_msat_arg));
36396         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
36397         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
36398         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
36399         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
36400         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_new(routing_arg_conv, incoming_shared_secret_arg_ref, payment_hash_arg_ref, incoming_amt_msat_arg_conv, outgoing_amt_msat_arg, outgoing_cltv_value_arg, skimmed_fee_msat_arg_conv);
36401         uint64_t ret_ref = 0;
36402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36404         return ret_ref;
36405 }
36406
36407 static inline uint64_t PendingHTLCInfo_clone_ptr(LDKPendingHTLCInfo *NONNULL_PTR arg) {
36408         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(arg);
36409         uint64_t ret_ref = 0;
36410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36412         return ret_ref;
36413 }
36414 int64_t  __attribute__((export_name("TS_PendingHTLCInfo_clone_ptr"))) TS_PendingHTLCInfo_clone_ptr(uint64_t arg) {
36415         LDKPendingHTLCInfo arg_conv;
36416         arg_conv.inner = untag_ptr(arg);
36417         arg_conv.is_owned = ptr_is_owned(arg);
36418         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36419         arg_conv.is_owned = false;
36420         int64_t ret_conv = PendingHTLCInfo_clone_ptr(&arg_conv);
36421         return ret_conv;
36422 }
36423
36424 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_clone"))) TS_PendingHTLCInfo_clone(uint64_t orig) {
36425         LDKPendingHTLCInfo orig_conv;
36426         orig_conv.inner = untag_ptr(orig);
36427         orig_conv.is_owned = ptr_is_owned(orig);
36428         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36429         orig_conv.is_owned = false;
36430         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(&orig_conv);
36431         uint64_t ret_ref = 0;
36432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36434         return ret_ref;
36435 }
36436
36437 uint32_t  __attribute__((export_name("TS_BlindedFailure_clone"))) TS_BlindedFailure_clone(uint64_t orig) {
36438         LDKBlindedFailure* orig_conv = (LDKBlindedFailure*)untag_ptr(orig);
36439         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedFailure_clone(orig_conv));
36440         return ret_conv;
36441 }
36442
36443 uint32_t  __attribute__((export_name("TS_BlindedFailure_from_introduction_node"))) TS_BlindedFailure_from_introduction_node() {
36444         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedFailure_from_introduction_node());
36445         return ret_conv;
36446 }
36447
36448 uint32_t  __attribute__((export_name("TS_BlindedFailure_from_blinded_node"))) TS_BlindedFailure_from_blinded_node() {
36449         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedFailure_from_blinded_node());
36450         return ret_conv;
36451 }
36452
36453 int64_t  __attribute__((export_name("TS_BlindedFailure_hash"))) TS_BlindedFailure_hash(uint64_t o) {
36454         LDKBlindedFailure* o_conv = (LDKBlindedFailure*)untag_ptr(o);
36455         int64_t ret_conv = BlindedFailure_hash(o_conv);
36456         return ret_conv;
36457 }
36458
36459 jboolean  __attribute__((export_name("TS_BlindedFailure_eq"))) TS_BlindedFailure_eq(uint64_t a, uint64_t b) {
36460         LDKBlindedFailure* a_conv = (LDKBlindedFailure*)untag_ptr(a);
36461         LDKBlindedFailure* b_conv = (LDKBlindedFailure*)untag_ptr(b);
36462         jboolean ret_conv = BlindedFailure_eq(a_conv, b_conv);
36463         return ret_conv;
36464 }
36465
36466 void  __attribute__((export_name("TS_FailureCode_free"))) TS_FailureCode_free(uint64_t this_ptr) {
36467         if (!ptr_is_owned(this_ptr)) return;
36468         void* this_ptr_ptr = untag_ptr(this_ptr);
36469         CHECK_ACCESS(this_ptr_ptr);
36470         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
36471         FREE(untag_ptr(this_ptr));
36472         FailureCode_free(this_ptr_conv);
36473 }
36474
36475 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
36476         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36477         *ret_copy = FailureCode_clone(arg);
36478         uint64_t ret_ref = tag_ptr(ret_copy, true);
36479         return ret_ref;
36480 }
36481 int64_t  __attribute__((export_name("TS_FailureCode_clone_ptr"))) TS_FailureCode_clone_ptr(uint64_t arg) {
36482         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
36483         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
36484         return ret_conv;
36485 }
36486
36487 uint64_t  __attribute__((export_name("TS_FailureCode_clone"))) TS_FailureCode_clone(uint64_t orig) {
36488         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
36489         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36490         *ret_copy = FailureCode_clone(orig_conv);
36491         uint64_t ret_ref = tag_ptr(ret_copy, true);
36492         return ret_ref;
36493 }
36494
36495 uint64_t  __attribute__((export_name("TS_FailureCode_temporary_node_failure"))) TS_FailureCode_temporary_node_failure() {
36496         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36497         *ret_copy = FailureCode_temporary_node_failure();
36498         uint64_t ret_ref = tag_ptr(ret_copy, true);
36499         return ret_ref;
36500 }
36501
36502 uint64_t  __attribute__((export_name("TS_FailureCode_required_node_feature_missing"))) TS_FailureCode_required_node_feature_missing() {
36503         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36504         *ret_copy = FailureCode_required_node_feature_missing();
36505         uint64_t ret_ref = tag_ptr(ret_copy, true);
36506         return ret_ref;
36507 }
36508
36509 uint64_t  __attribute__((export_name("TS_FailureCode_incorrect_or_unknown_payment_details"))) TS_FailureCode_incorrect_or_unknown_payment_details() {
36510         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36511         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
36512         uint64_t ret_ref = tag_ptr(ret_copy, true);
36513         return ret_ref;
36514 }
36515
36516 uint64_t  __attribute__((export_name("TS_FailureCode_invalid_onion_payload"))) TS_FailureCode_invalid_onion_payload(uint64_t a) {
36517         void* a_ptr = untag_ptr(a);
36518         CHECK_ACCESS(a_ptr);
36519         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
36520         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
36521         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36522         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
36523         uint64_t ret_ref = tag_ptr(ret_copy, true);
36524         return ret_ref;
36525 }
36526
36527 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
36528         LDKChannelManager this_obj_conv;
36529         this_obj_conv.inner = untag_ptr(this_obj);
36530         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36532         ChannelManager_free(this_obj_conv);
36533 }
36534
36535 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
36536         LDKChainParameters this_obj_conv;
36537         this_obj_conv.inner = untag_ptr(this_obj);
36538         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36540         ChainParameters_free(this_obj_conv);
36541 }
36542
36543 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
36544         LDKChainParameters this_ptr_conv;
36545         this_ptr_conv.inner = untag_ptr(this_ptr);
36546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36548         this_ptr_conv.is_owned = false;
36549         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
36550         return ret_conv;
36551 }
36552
36553 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
36554         LDKChainParameters this_ptr_conv;
36555         this_ptr_conv.inner = untag_ptr(this_ptr);
36556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36558         this_ptr_conv.is_owned = false;
36559         LDKNetwork val_conv = LDKNetwork_from_js(val);
36560         ChainParameters_set_network(&this_ptr_conv, val_conv);
36561 }
36562
36563 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
36564         LDKChainParameters this_ptr_conv;
36565         this_ptr_conv.inner = untag_ptr(this_ptr);
36566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36568         this_ptr_conv.is_owned = false;
36569         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
36570         uint64_t ret_ref = 0;
36571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36573         return ret_ref;
36574 }
36575
36576 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
36577         LDKChainParameters this_ptr_conv;
36578         this_ptr_conv.inner = untag_ptr(this_ptr);
36579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36581         this_ptr_conv.is_owned = false;
36582         LDKBestBlock val_conv;
36583         val_conv.inner = untag_ptr(val);
36584         val_conv.is_owned = ptr_is_owned(val);
36585         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36586         val_conv = BestBlock_clone(&val_conv);
36587         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
36588 }
36589
36590 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
36591         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
36592         LDKBestBlock best_block_arg_conv;
36593         best_block_arg_conv.inner = untag_ptr(best_block_arg);
36594         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
36595         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
36596         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
36597         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
36598         uint64_t ret_ref = 0;
36599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36601         return ret_ref;
36602 }
36603
36604 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
36605         LDKChainParameters ret_var = ChainParameters_clone(arg);
36606         uint64_t ret_ref = 0;
36607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36609         return ret_ref;
36610 }
36611 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
36612         LDKChainParameters arg_conv;
36613         arg_conv.inner = untag_ptr(arg);
36614         arg_conv.is_owned = ptr_is_owned(arg);
36615         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36616         arg_conv.is_owned = false;
36617         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
36618         return ret_conv;
36619 }
36620
36621 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
36622         LDKChainParameters orig_conv;
36623         orig_conv.inner = untag_ptr(orig);
36624         orig_conv.is_owned = ptr_is_owned(orig);
36625         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36626         orig_conv.is_owned = false;
36627         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
36628         uint64_t ret_ref = 0;
36629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36631         return ret_ref;
36632 }
36633
36634 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
36635         LDKCounterpartyForwardingInfo this_obj_conv;
36636         this_obj_conv.inner = untag_ptr(this_obj);
36637         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36639         CounterpartyForwardingInfo_free(this_obj_conv);
36640 }
36641
36642 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
36643         LDKCounterpartyForwardingInfo this_ptr_conv;
36644         this_ptr_conv.inner = untag_ptr(this_ptr);
36645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36647         this_ptr_conv.is_owned = false;
36648         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
36649         return ret_conv;
36650 }
36651
36652 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
36653         LDKCounterpartyForwardingInfo this_ptr_conv;
36654         this_ptr_conv.inner = untag_ptr(this_ptr);
36655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36657         this_ptr_conv.is_owned = false;
36658         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
36659 }
36660
36661 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
36662         LDKCounterpartyForwardingInfo this_ptr_conv;
36663         this_ptr_conv.inner = untag_ptr(this_ptr);
36664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36666         this_ptr_conv.is_owned = false;
36667         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
36668         return ret_conv;
36669 }
36670
36671 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
36672         LDKCounterpartyForwardingInfo this_ptr_conv;
36673         this_ptr_conv.inner = untag_ptr(this_ptr);
36674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36676         this_ptr_conv.is_owned = false;
36677         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
36678 }
36679
36680 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
36681         LDKCounterpartyForwardingInfo this_ptr_conv;
36682         this_ptr_conv.inner = untag_ptr(this_ptr);
36683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36685         this_ptr_conv.is_owned = false;
36686         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
36687         return ret_conv;
36688 }
36689
36690 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
36691         LDKCounterpartyForwardingInfo this_ptr_conv;
36692         this_ptr_conv.inner = untag_ptr(this_ptr);
36693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36695         this_ptr_conv.is_owned = false;
36696         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
36697 }
36698
36699 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) {
36700         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
36701         uint64_t ret_ref = 0;
36702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36704         return ret_ref;
36705 }
36706
36707 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
36708         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
36709         uint64_t ret_ref = 0;
36710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36712         return ret_ref;
36713 }
36714 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
36715         LDKCounterpartyForwardingInfo arg_conv;
36716         arg_conv.inner = untag_ptr(arg);
36717         arg_conv.is_owned = ptr_is_owned(arg);
36718         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36719         arg_conv.is_owned = false;
36720         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
36721         return ret_conv;
36722 }
36723
36724 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
36725         LDKCounterpartyForwardingInfo orig_conv;
36726         orig_conv.inner = untag_ptr(orig);
36727         orig_conv.is_owned = ptr_is_owned(orig);
36728         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36729         orig_conv.is_owned = false;
36730         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
36731         uint64_t ret_ref = 0;
36732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36734         return ret_ref;
36735 }
36736
36737 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
36738         LDKChannelCounterparty this_obj_conv;
36739         this_obj_conv.inner = untag_ptr(this_obj);
36740         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36742         ChannelCounterparty_free(this_obj_conv);
36743 }
36744
36745 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
36746         LDKChannelCounterparty this_ptr_conv;
36747         this_ptr_conv.inner = untag_ptr(this_ptr);
36748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36750         this_ptr_conv.is_owned = false;
36751         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36752         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
36753         return ret_arr;
36754 }
36755
36756 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
36757         LDKChannelCounterparty this_ptr_conv;
36758         this_ptr_conv.inner = untag_ptr(this_ptr);
36759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36761         this_ptr_conv.is_owned = false;
36762         LDKPublicKey val_ref;
36763         CHECK(val->arr_len == 33);
36764         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36765         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
36766 }
36767
36768 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
36769         LDKChannelCounterparty this_ptr_conv;
36770         this_ptr_conv.inner = untag_ptr(this_ptr);
36771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36773         this_ptr_conv.is_owned = false;
36774         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
36775         uint64_t ret_ref = 0;
36776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36778         return ret_ref;
36779 }
36780
36781 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
36782         LDKChannelCounterparty this_ptr_conv;
36783         this_ptr_conv.inner = untag_ptr(this_ptr);
36784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36786         this_ptr_conv.is_owned = false;
36787         LDKInitFeatures val_conv;
36788         val_conv.inner = untag_ptr(val);
36789         val_conv.is_owned = ptr_is_owned(val);
36790         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36791         val_conv = InitFeatures_clone(&val_conv);
36792         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
36793 }
36794
36795 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
36796         LDKChannelCounterparty this_ptr_conv;
36797         this_ptr_conv.inner = untag_ptr(this_ptr);
36798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36800         this_ptr_conv.is_owned = false;
36801         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
36802         return ret_conv;
36803 }
36804
36805 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
36806         LDKChannelCounterparty this_ptr_conv;
36807         this_ptr_conv.inner = untag_ptr(this_ptr);
36808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36810         this_ptr_conv.is_owned = false;
36811         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
36812 }
36813
36814 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
36815         LDKChannelCounterparty this_ptr_conv;
36816         this_ptr_conv.inner = untag_ptr(this_ptr);
36817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36819         this_ptr_conv.is_owned = false;
36820         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
36821         uint64_t ret_ref = 0;
36822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36824         return ret_ref;
36825 }
36826
36827 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
36828         LDKChannelCounterparty this_ptr_conv;
36829         this_ptr_conv.inner = untag_ptr(this_ptr);
36830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36832         this_ptr_conv.is_owned = false;
36833         LDKCounterpartyForwardingInfo val_conv;
36834         val_conv.inner = untag_ptr(val);
36835         val_conv.is_owned = ptr_is_owned(val);
36836         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36837         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
36838         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
36839 }
36840
36841 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
36842         LDKChannelCounterparty this_ptr_conv;
36843         this_ptr_conv.inner = untag_ptr(this_ptr);
36844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36846         this_ptr_conv.is_owned = false;
36847         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36848         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
36849         uint64_t ret_ref = tag_ptr(ret_copy, true);
36850         return ret_ref;
36851 }
36852
36853 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) {
36854         LDKChannelCounterparty this_ptr_conv;
36855         this_ptr_conv.inner = untag_ptr(this_ptr);
36856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36858         this_ptr_conv.is_owned = false;
36859         void* val_ptr = untag_ptr(val);
36860         CHECK_ACCESS(val_ptr);
36861         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36862         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36863         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
36864 }
36865
36866 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
36867         LDKChannelCounterparty 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         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36873         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
36874         uint64_t ret_ref = tag_ptr(ret_copy, true);
36875         return ret_ref;
36876 }
36877
36878 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) {
36879         LDKChannelCounterparty this_ptr_conv;
36880         this_ptr_conv.inner = untag_ptr(this_ptr);
36881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36883         this_ptr_conv.is_owned = false;
36884         void* val_ptr = untag_ptr(val);
36885         CHECK_ACCESS(val_ptr);
36886         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36887         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36888         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
36889 }
36890
36891 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) {
36892         LDKPublicKey node_id_arg_ref;
36893         CHECK(node_id_arg->arr_len == 33);
36894         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
36895         LDKInitFeatures features_arg_conv;
36896         features_arg_conv.inner = untag_ptr(features_arg);
36897         features_arg_conv.is_owned = ptr_is_owned(features_arg);
36898         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
36899         features_arg_conv = InitFeatures_clone(&features_arg_conv);
36900         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
36901         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
36902         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
36903         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
36904         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
36905         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
36906         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
36907         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
36908         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
36909         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
36910         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
36911         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
36912         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
36913         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);
36914         uint64_t ret_ref = 0;
36915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36917         return ret_ref;
36918 }
36919
36920 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
36921         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
36922         uint64_t ret_ref = 0;
36923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36925         return ret_ref;
36926 }
36927 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
36928         LDKChannelCounterparty arg_conv;
36929         arg_conv.inner = untag_ptr(arg);
36930         arg_conv.is_owned = ptr_is_owned(arg);
36931         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36932         arg_conv.is_owned = false;
36933         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
36934         return ret_conv;
36935 }
36936
36937 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
36938         LDKChannelCounterparty orig_conv;
36939         orig_conv.inner = untag_ptr(orig);
36940         orig_conv.is_owned = ptr_is_owned(orig);
36941         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36942         orig_conv.is_owned = false;
36943         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
36944         uint64_t ret_ref = 0;
36945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36947         return ret_ref;
36948 }
36949
36950 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
36951         LDKChannelDetails this_obj_conv;
36952         this_obj_conv.inner = untag_ptr(this_obj);
36953         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36955         ChannelDetails_free(this_obj_conv);
36956 }
36957
36958 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
36959         LDKChannelDetails this_ptr_conv;
36960         this_ptr_conv.inner = untag_ptr(this_ptr);
36961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36963         this_ptr_conv.is_owned = false;
36964         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36965         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
36966         return ret_arr;
36967 }
36968
36969 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
36970         LDKChannelDetails this_ptr_conv;
36971         this_ptr_conv.inner = untag_ptr(this_ptr);
36972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36974         this_ptr_conv.is_owned = false;
36975         LDKThirtyTwoBytes val_ref;
36976         CHECK(val->arr_len == 32);
36977         memcpy(val_ref.data, val->elems, 32); FREE(val);
36978         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
36979 }
36980
36981 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
36982         LDKChannelDetails this_ptr_conv;
36983         this_ptr_conv.inner = untag_ptr(this_ptr);
36984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36986         this_ptr_conv.is_owned = false;
36987         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
36988         uint64_t ret_ref = 0;
36989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36991         return ret_ref;
36992 }
36993
36994 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
36995         LDKChannelDetails this_ptr_conv;
36996         this_ptr_conv.inner = untag_ptr(this_ptr);
36997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36999         this_ptr_conv.is_owned = false;
37000         LDKChannelCounterparty val_conv;
37001         val_conv.inner = untag_ptr(val);
37002         val_conv.is_owned = ptr_is_owned(val);
37003         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37004         val_conv = ChannelCounterparty_clone(&val_conv);
37005         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
37006 }
37007
37008 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
37009         LDKChannelDetails this_ptr_conv;
37010         this_ptr_conv.inner = untag_ptr(this_ptr);
37011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37013         this_ptr_conv.is_owned = false;
37014         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
37015         uint64_t ret_ref = 0;
37016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37018         return ret_ref;
37019 }
37020
37021 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
37022         LDKChannelDetails this_ptr_conv;
37023         this_ptr_conv.inner = untag_ptr(this_ptr);
37024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37026         this_ptr_conv.is_owned = false;
37027         LDKOutPoint val_conv;
37028         val_conv.inner = untag_ptr(val);
37029         val_conv.is_owned = ptr_is_owned(val);
37030         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37031         val_conv = OutPoint_clone(&val_conv);
37032         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
37033 }
37034
37035 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
37036         LDKChannelDetails this_ptr_conv;
37037         this_ptr_conv.inner = untag_ptr(this_ptr);
37038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37040         this_ptr_conv.is_owned = false;
37041         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
37042         uint64_t ret_ref = 0;
37043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37045         return ret_ref;
37046 }
37047
37048 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
37049         LDKChannelDetails this_ptr_conv;
37050         this_ptr_conv.inner = untag_ptr(this_ptr);
37051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37053         this_ptr_conv.is_owned = false;
37054         LDKChannelTypeFeatures val_conv;
37055         val_conv.inner = untag_ptr(val);
37056         val_conv.is_owned = ptr_is_owned(val);
37057         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37058         val_conv = ChannelTypeFeatures_clone(&val_conv);
37059         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
37060 }
37061
37062 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
37063         LDKChannelDetails this_ptr_conv;
37064         this_ptr_conv.inner = untag_ptr(this_ptr);
37065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37067         this_ptr_conv.is_owned = false;
37068         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37069         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
37070         uint64_t ret_ref = tag_ptr(ret_copy, true);
37071         return ret_ref;
37072 }
37073
37074 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
37075         LDKChannelDetails this_ptr_conv;
37076         this_ptr_conv.inner = untag_ptr(this_ptr);
37077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37079         this_ptr_conv.is_owned = false;
37080         void* val_ptr = untag_ptr(val);
37081         CHECK_ACCESS(val_ptr);
37082         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37083         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37084         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
37085 }
37086
37087 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
37088         LDKChannelDetails this_ptr_conv;
37089         this_ptr_conv.inner = untag_ptr(this_ptr);
37090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37092         this_ptr_conv.is_owned = false;
37093         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37094         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
37095         uint64_t ret_ref = tag_ptr(ret_copy, true);
37096         return ret_ref;
37097 }
37098
37099 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
37100         LDKChannelDetails this_ptr_conv;
37101         this_ptr_conv.inner = untag_ptr(this_ptr);
37102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37104         this_ptr_conv.is_owned = false;
37105         void* val_ptr = untag_ptr(val);
37106         CHECK_ACCESS(val_ptr);
37107         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37108         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37109         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
37110 }
37111
37112 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
37113         LDKChannelDetails this_ptr_conv;
37114         this_ptr_conv.inner = untag_ptr(this_ptr);
37115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37117         this_ptr_conv.is_owned = false;
37118         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37119         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
37120         uint64_t ret_ref = tag_ptr(ret_copy, true);
37121         return ret_ref;
37122 }
37123
37124 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
37125         LDKChannelDetails this_ptr_conv;
37126         this_ptr_conv.inner = untag_ptr(this_ptr);
37127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37129         this_ptr_conv.is_owned = false;
37130         void* val_ptr = untag_ptr(val);
37131         CHECK_ACCESS(val_ptr);
37132         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37133         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37134         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
37135 }
37136
37137 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
37138         LDKChannelDetails this_ptr_conv;
37139         this_ptr_conv.inner = untag_ptr(this_ptr);
37140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37142         this_ptr_conv.is_owned = false;
37143         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
37144         return ret_conv;
37145 }
37146
37147 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
37148         LDKChannelDetails this_ptr_conv;
37149         this_ptr_conv.inner = untag_ptr(this_ptr);
37150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37152         this_ptr_conv.is_owned = false;
37153         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
37154 }
37155
37156 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
37157         LDKChannelDetails this_ptr_conv;
37158         this_ptr_conv.inner = untag_ptr(this_ptr);
37159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37161         this_ptr_conv.is_owned = false;
37162         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37163         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
37164         uint64_t ret_ref = tag_ptr(ret_copy, true);
37165         return ret_ref;
37166 }
37167
37168 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
37169         LDKChannelDetails this_ptr_conv;
37170         this_ptr_conv.inner = untag_ptr(this_ptr);
37171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37173         this_ptr_conv.is_owned = false;
37174         void* val_ptr = untag_ptr(val);
37175         CHECK_ACCESS(val_ptr);
37176         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37177         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37178         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
37179 }
37180
37181 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
37182         LDKChannelDetails this_ptr_conv;
37183         this_ptr_conv.inner = untag_ptr(this_ptr);
37184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37186         this_ptr_conv.is_owned = false;
37187         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
37188         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
37189         return ret_arr;
37190 }
37191
37192 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
37193         LDKChannelDetails this_ptr_conv;
37194         this_ptr_conv.inner = untag_ptr(this_ptr);
37195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37197         this_ptr_conv.is_owned = false;
37198         LDKU128 val_ref;
37199         CHECK(val->arr_len == 16);
37200         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
37201         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
37202 }
37203
37204 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) {
37205         LDKChannelDetails this_ptr_conv;
37206         this_ptr_conv.inner = untag_ptr(this_ptr);
37207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37209         this_ptr_conv.is_owned = false;
37210         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37211         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
37212         uint64_t ret_ref = tag_ptr(ret_copy, true);
37213         return ret_ref;
37214 }
37215
37216 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) {
37217         LDKChannelDetails this_ptr_conv;
37218         this_ptr_conv.inner = untag_ptr(this_ptr);
37219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37221         this_ptr_conv.is_owned = false;
37222         void* val_ptr = untag_ptr(val);
37223         CHECK_ACCESS(val_ptr);
37224         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37225         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37226         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
37227 }
37228
37229 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
37230         LDKChannelDetails this_ptr_conv;
37231         this_ptr_conv.inner = untag_ptr(this_ptr);
37232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37234         this_ptr_conv.is_owned = false;
37235         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
37236         return ret_conv;
37237 }
37238
37239 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
37240         LDKChannelDetails this_ptr_conv;
37241         this_ptr_conv.inner = untag_ptr(this_ptr);
37242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37244         this_ptr_conv.is_owned = false;
37245         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
37246 }
37247
37248 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
37249         LDKChannelDetails this_ptr_conv;
37250         this_ptr_conv.inner = untag_ptr(this_ptr);
37251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37253         this_ptr_conv.is_owned = false;
37254         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
37255         return ret_conv;
37256 }
37257
37258 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
37259         LDKChannelDetails this_ptr_conv;
37260         this_ptr_conv.inner = untag_ptr(this_ptr);
37261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37263         this_ptr_conv.is_owned = false;
37264         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
37265 }
37266
37267 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) {
37268         LDKChannelDetails this_ptr_conv;
37269         this_ptr_conv.inner = untag_ptr(this_ptr);
37270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37272         this_ptr_conv.is_owned = false;
37273         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
37274         return ret_conv;
37275 }
37276
37277 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) {
37278         LDKChannelDetails this_ptr_conv;
37279         this_ptr_conv.inner = untag_ptr(this_ptr);
37280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37282         this_ptr_conv.is_owned = false;
37283         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
37284 }
37285
37286 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) {
37287         LDKChannelDetails this_ptr_conv;
37288         this_ptr_conv.inner = untag_ptr(this_ptr);
37289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37291         this_ptr_conv.is_owned = false;
37292         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
37293         return ret_conv;
37294 }
37295
37296 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) {
37297         LDKChannelDetails this_ptr_conv;
37298         this_ptr_conv.inner = untag_ptr(this_ptr);
37299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37301         this_ptr_conv.is_owned = false;
37302         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
37303 }
37304
37305 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
37306         LDKChannelDetails this_ptr_conv;
37307         this_ptr_conv.inner = untag_ptr(this_ptr);
37308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37310         this_ptr_conv.is_owned = false;
37311         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
37312         return ret_conv;
37313 }
37314
37315 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
37316         LDKChannelDetails this_ptr_conv;
37317         this_ptr_conv.inner = untag_ptr(this_ptr);
37318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37320         this_ptr_conv.is_owned = false;
37321         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
37322 }
37323
37324 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
37325         LDKChannelDetails this_ptr_conv;
37326         this_ptr_conv.inner = untag_ptr(this_ptr);
37327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37329         this_ptr_conv.is_owned = false;
37330         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37331         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
37332         uint64_t ret_ref = tag_ptr(ret_copy, true);
37333         return ret_ref;
37334 }
37335
37336 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
37337         LDKChannelDetails this_ptr_conv;
37338         this_ptr_conv.inner = untag_ptr(this_ptr);
37339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37341         this_ptr_conv.is_owned = false;
37342         void* val_ptr = untag_ptr(val);
37343         CHECK_ACCESS(val_ptr);
37344         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37345         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37346         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
37347 }
37348
37349 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) {
37350         LDKChannelDetails this_ptr_conv;
37351         this_ptr_conv.inner = untag_ptr(this_ptr);
37352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37354         this_ptr_conv.is_owned = false;
37355         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37356         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
37357         uint64_t ret_ref = tag_ptr(ret_copy, true);
37358         return ret_ref;
37359 }
37360
37361 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) {
37362         LDKChannelDetails this_ptr_conv;
37363         this_ptr_conv.inner = untag_ptr(this_ptr);
37364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37366         this_ptr_conv.is_owned = false;
37367         void* val_ptr = untag_ptr(val);
37368         CHECK_ACCESS(val_ptr);
37369         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37370         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37371         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
37372 }
37373
37374 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
37375         LDKChannelDetails this_ptr_conv;
37376         this_ptr_conv.inner = untag_ptr(this_ptr);
37377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37379         this_ptr_conv.is_owned = false;
37380         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
37381         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
37382         uint64_t ret_ref = tag_ptr(ret_copy, true);
37383         return ret_ref;
37384 }
37385
37386 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) {
37387         LDKChannelDetails this_ptr_conv;
37388         this_ptr_conv.inner = untag_ptr(this_ptr);
37389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37391         this_ptr_conv.is_owned = false;
37392         void* val_ptr = untag_ptr(val);
37393         CHECK_ACCESS(val_ptr);
37394         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
37395         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
37396         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
37397 }
37398
37399 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
37400         LDKChannelDetails 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         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
37406         return ret_conv;
37407 }
37408
37409 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
37410         LDKChannelDetails this_ptr_conv;
37411         this_ptr_conv.inner = untag_ptr(this_ptr);
37412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37414         this_ptr_conv.is_owned = false;
37415         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
37416 }
37417
37418 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
37419         LDKChannelDetails this_ptr_conv;
37420         this_ptr_conv.inner = untag_ptr(this_ptr);
37421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37423         this_ptr_conv.is_owned = false;
37424         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
37425         return ret_conv;
37426 }
37427
37428 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
37429         LDKChannelDetails this_ptr_conv;
37430         this_ptr_conv.inner = untag_ptr(this_ptr);
37431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37433         this_ptr_conv.is_owned = false;
37434         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
37435 }
37436
37437 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_shutdown_state"))) TS_ChannelDetails_get_channel_shutdown_state(uint64_t this_ptr) {
37438         LDKChannelDetails this_ptr_conv;
37439         this_ptr_conv.inner = untag_ptr(this_ptr);
37440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37442         this_ptr_conv.is_owned = false;
37443         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
37444         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
37445         uint64_t ret_ref = tag_ptr(ret_copy, true);
37446         return ret_ref;
37447 }
37448
37449 void  __attribute__((export_name("TS_ChannelDetails_set_channel_shutdown_state"))) TS_ChannelDetails_set_channel_shutdown_state(uint64_t this_ptr, uint64_t val) {
37450         LDKChannelDetails this_ptr_conv;
37451         this_ptr_conv.inner = untag_ptr(this_ptr);
37452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37454         this_ptr_conv.is_owned = false;
37455         void* val_ptr = untag_ptr(val);
37456         CHECK_ACCESS(val_ptr);
37457         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
37458         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
37459         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
37460 }
37461
37462 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
37463         LDKChannelDetails this_ptr_conv;
37464         this_ptr_conv.inner = untag_ptr(this_ptr);
37465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37467         this_ptr_conv.is_owned = false;
37468         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
37469         return ret_conv;
37470 }
37471
37472 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
37473         LDKChannelDetails 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         ChannelDetails_set_is_usable(&this_ptr_conv, val);
37479 }
37480
37481 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
37482         LDKChannelDetails this_ptr_conv;
37483         this_ptr_conv.inner = untag_ptr(this_ptr);
37484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37486         this_ptr_conv.is_owned = false;
37487         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
37488         return ret_conv;
37489 }
37490
37491 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
37492         LDKChannelDetails this_ptr_conv;
37493         this_ptr_conv.inner = untag_ptr(this_ptr);
37494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37496         this_ptr_conv.is_owned = false;
37497         ChannelDetails_set_is_public(&this_ptr_conv, val);
37498 }
37499
37500 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
37501         LDKChannelDetails this_ptr_conv;
37502         this_ptr_conv.inner = untag_ptr(this_ptr);
37503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37505         this_ptr_conv.is_owned = false;
37506         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37507         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
37508         uint64_t ret_ref = tag_ptr(ret_copy, true);
37509         return ret_ref;
37510 }
37511
37512 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) {
37513         LDKChannelDetails this_ptr_conv;
37514         this_ptr_conv.inner = untag_ptr(this_ptr);
37515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37517         this_ptr_conv.is_owned = false;
37518         void* val_ptr = untag_ptr(val);
37519         CHECK_ACCESS(val_ptr);
37520         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37521         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37522         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
37523 }
37524
37525 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
37526         LDKChannelDetails this_ptr_conv;
37527         this_ptr_conv.inner = untag_ptr(this_ptr);
37528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37530         this_ptr_conv.is_owned = false;
37531         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37532         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
37533         uint64_t ret_ref = tag_ptr(ret_copy, true);
37534         return ret_ref;
37535 }
37536
37537 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) {
37538         LDKChannelDetails this_ptr_conv;
37539         this_ptr_conv.inner = untag_ptr(this_ptr);
37540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37542         this_ptr_conv.is_owned = false;
37543         void* val_ptr = untag_ptr(val);
37544         CHECK_ACCESS(val_ptr);
37545         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37546         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37547         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
37548 }
37549
37550 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
37551         LDKChannelDetails this_ptr_conv;
37552         this_ptr_conv.inner = untag_ptr(this_ptr);
37553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37555         this_ptr_conv.is_owned = false;
37556         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
37557         uint64_t ret_ref = 0;
37558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37560         return ret_ref;
37561 }
37562
37563 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
37564         LDKChannelDetails this_ptr_conv;
37565         this_ptr_conv.inner = untag_ptr(this_ptr);
37566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37568         this_ptr_conv.is_owned = false;
37569         LDKChannelConfig val_conv;
37570         val_conv.inner = untag_ptr(val);
37571         val_conv.is_owned = ptr_is_owned(val);
37572         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37573         val_conv = ChannelConfig_clone(&val_conv);
37574         ChannelDetails_set_config(&this_ptr_conv, val_conv);
37575 }
37576
37577 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) {
37578         LDKThirtyTwoBytes channel_id_arg_ref;
37579         CHECK(channel_id_arg->arr_len == 32);
37580         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37581         LDKChannelCounterparty counterparty_arg_conv;
37582         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
37583         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
37584         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
37585         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
37586         LDKOutPoint funding_txo_arg_conv;
37587         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
37588         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
37589         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
37590         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
37591         LDKChannelTypeFeatures channel_type_arg_conv;
37592         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
37593         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
37594         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
37595         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
37596         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
37597         CHECK_ACCESS(short_channel_id_arg_ptr);
37598         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
37599         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
37600         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
37601         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
37602         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
37603         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
37604         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
37605         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
37606         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
37607         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
37608         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
37609         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
37610         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
37611         LDKU128 user_channel_id_arg_ref;
37612         CHECK(user_channel_id_arg->arr_len == 16);
37613         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
37614         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
37615         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
37616         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
37617         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
37618         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
37619         CHECK_ACCESS(confirmations_required_arg_ptr);
37620         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
37621         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
37622         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
37623         CHECK_ACCESS(confirmations_arg_ptr);
37624         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
37625         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
37626         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
37627         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
37628         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
37629         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
37630         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
37631         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
37632         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
37633         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
37634         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
37635         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
37636         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
37637         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
37638         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
37639         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
37640         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
37641         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
37642         LDKChannelConfig config_arg_conv;
37643         config_arg_conv.inner = untag_ptr(config_arg);
37644         config_arg_conv.is_owned = ptr_is_owned(config_arg);
37645         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
37646         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
37647         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);
37648         uint64_t ret_ref = 0;
37649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37651         return ret_ref;
37652 }
37653
37654 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
37655         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
37656         uint64_t ret_ref = 0;
37657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37659         return ret_ref;
37660 }
37661 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
37662         LDKChannelDetails arg_conv;
37663         arg_conv.inner = untag_ptr(arg);
37664         arg_conv.is_owned = ptr_is_owned(arg);
37665         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37666         arg_conv.is_owned = false;
37667         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
37668         return ret_conv;
37669 }
37670
37671 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
37672         LDKChannelDetails orig_conv;
37673         orig_conv.inner = untag_ptr(orig);
37674         orig_conv.is_owned = ptr_is_owned(orig);
37675         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37676         orig_conv.is_owned = false;
37677         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
37678         uint64_t ret_ref = 0;
37679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37681         return ret_ref;
37682 }
37683
37684 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
37685         LDKChannelDetails this_arg_conv;
37686         this_arg_conv.inner = untag_ptr(this_arg);
37687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37689         this_arg_conv.is_owned = false;
37690         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37691         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
37692         uint64_t ret_ref = tag_ptr(ret_copy, true);
37693         return ret_ref;
37694 }
37695
37696 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
37697         LDKChannelDetails this_arg_conv;
37698         this_arg_conv.inner = untag_ptr(this_arg);
37699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37701         this_arg_conv.is_owned = false;
37702         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37703         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
37704         uint64_t ret_ref = tag_ptr(ret_copy, true);
37705         return ret_ref;
37706 }
37707
37708 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_clone"))) TS_ChannelShutdownState_clone(uint64_t orig) {
37709         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
37710         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_clone(orig_conv));
37711         return ret_conv;
37712 }
37713
37714 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_not_shutting_down"))) TS_ChannelShutdownState_not_shutting_down() {
37715         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_not_shutting_down());
37716         return ret_conv;
37717 }
37718
37719 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_initiated"))) TS_ChannelShutdownState_shutdown_initiated() {
37720         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_initiated());
37721         return ret_conv;
37722 }
37723
37724 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_resolving_htlcs"))) TS_ChannelShutdownState_resolving_htlcs() {
37725         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_resolving_htlcs());
37726         return ret_conv;
37727 }
37728
37729 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_negotiating_closing_fee"))) TS_ChannelShutdownState_negotiating_closing_fee() {
37730         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_negotiating_closing_fee());
37731         return ret_conv;
37732 }
37733
37734 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_complete"))) TS_ChannelShutdownState_shutdown_complete() {
37735         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_complete());
37736         return ret_conv;
37737 }
37738
37739 jboolean  __attribute__((export_name("TS_ChannelShutdownState_eq"))) TS_ChannelShutdownState_eq(uint64_t a, uint64_t b) {
37740         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
37741         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
37742         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
37743         return ret_conv;
37744 }
37745
37746 void  __attribute__((export_name("TS_RecentPaymentDetails_free"))) TS_RecentPaymentDetails_free(uint64_t this_ptr) {
37747         if (!ptr_is_owned(this_ptr)) return;
37748         void* this_ptr_ptr = untag_ptr(this_ptr);
37749         CHECK_ACCESS(this_ptr_ptr);
37750         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
37751         FREE(untag_ptr(this_ptr));
37752         RecentPaymentDetails_free(this_ptr_conv);
37753 }
37754
37755 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
37756         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37757         *ret_copy = RecentPaymentDetails_clone(arg);
37758         uint64_t ret_ref = tag_ptr(ret_copy, true);
37759         return ret_ref;
37760 }
37761 int64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone_ptr"))) TS_RecentPaymentDetails_clone_ptr(uint64_t arg) {
37762         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
37763         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
37764         return ret_conv;
37765 }
37766
37767 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone"))) TS_RecentPaymentDetails_clone(uint64_t orig) {
37768         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
37769         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37770         *ret_copy = RecentPaymentDetails_clone(orig_conv);
37771         uint64_t ret_ref = tag_ptr(ret_copy, true);
37772         return ret_ref;
37773 }
37774
37775 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_awaiting_invoice"))) TS_RecentPaymentDetails_awaiting_invoice(int8_tArray payment_id) {
37776         LDKThirtyTwoBytes payment_id_ref;
37777         CHECK(payment_id->arr_len == 32);
37778         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
37779         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37780         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
37781         uint64_t ret_ref = tag_ptr(ret_copy, true);
37782         return ret_ref;
37783 }
37784
37785 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_pending"))) TS_RecentPaymentDetails_pending(int8_tArray payment_id, int8_tArray payment_hash, int64_t total_msat) {
37786         LDKThirtyTwoBytes payment_id_ref;
37787         CHECK(payment_id->arr_len == 32);
37788         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
37789         LDKThirtyTwoBytes payment_hash_ref;
37790         CHECK(payment_hash->arr_len == 32);
37791         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
37792         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37793         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
37794         uint64_t ret_ref = tag_ptr(ret_copy, true);
37795         return ret_ref;
37796 }
37797
37798 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_fulfilled"))) TS_RecentPaymentDetails_fulfilled(int8_tArray payment_id, uint64_t payment_hash) {
37799         LDKThirtyTwoBytes payment_id_ref;
37800         CHECK(payment_id->arr_len == 32);
37801         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
37802         void* payment_hash_ptr = untag_ptr(payment_hash);
37803         CHECK_ACCESS(payment_hash_ptr);
37804         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
37805         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
37806         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37807         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
37808         uint64_t ret_ref = tag_ptr(ret_copy, true);
37809         return ret_ref;
37810 }
37811
37812 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_abandoned"))) TS_RecentPaymentDetails_abandoned(int8_tArray payment_id, int8_tArray payment_hash) {
37813         LDKThirtyTwoBytes payment_id_ref;
37814         CHECK(payment_id->arr_len == 32);
37815         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
37816         LDKThirtyTwoBytes payment_hash_ref;
37817         CHECK(payment_hash->arr_len == 32);
37818         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
37819         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37820         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
37821         uint64_t ret_ref = tag_ptr(ret_copy, true);
37822         return ret_ref;
37823 }
37824
37825 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
37826         LDKPhantomRouteHints this_obj_conv;
37827         this_obj_conv.inner = untag_ptr(this_obj);
37828         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37830         PhantomRouteHints_free(this_obj_conv);
37831 }
37832
37833 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
37834         LDKPhantomRouteHints this_ptr_conv;
37835         this_ptr_conv.inner = untag_ptr(this_ptr);
37836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37838         this_ptr_conv.is_owned = false;
37839         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
37840         uint64_tArray ret_arr = NULL;
37841         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
37842         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
37843         for (size_t q = 0; q < ret_var.datalen; q++) {
37844                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
37845                 uint64_t ret_conv_16_ref = 0;
37846                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
37847                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
37848                 ret_arr_ptr[q] = ret_conv_16_ref;
37849         }
37850         
37851         FREE(ret_var.data);
37852         return ret_arr;
37853 }
37854
37855 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
37856         LDKPhantomRouteHints this_ptr_conv;
37857         this_ptr_conv.inner = untag_ptr(this_ptr);
37858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37860         this_ptr_conv.is_owned = false;
37861         LDKCVec_ChannelDetailsZ val_constr;
37862         val_constr.datalen = val->arr_len;
37863         if (val_constr.datalen > 0)
37864                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
37865         else
37866                 val_constr.data = NULL;
37867         uint64_t* val_vals = val->elems;
37868         for (size_t q = 0; q < val_constr.datalen; q++) {
37869                 uint64_t val_conv_16 = val_vals[q];
37870                 LDKChannelDetails val_conv_16_conv;
37871                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
37872                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
37873                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
37874                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
37875                 val_constr.data[q] = val_conv_16_conv;
37876         }
37877         FREE(val);
37878         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
37879 }
37880
37881 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
37882         LDKPhantomRouteHints this_ptr_conv;
37883         this_ptr_conv.inner = untag_ptr(this_ptr);
37884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37886         this_ptr_conv.is_owned = false;
37887         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
37888         return ret_conv;
37889 }
37890
37891 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
37892         LDKPhantomRouteHints this_ptr_conv;
37893         this_ptr_conv.inner = untag_ptr(this_ptr);
37894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37896         this_ptr_conv.is_owned = false;
37897         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
37898 }
37899
37900 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
37901         LDKPhantomRouteHints this_ptr_conv;
37902         this_ptr_conv.inner = untag_ptr(this_ptr);
37903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37905         this_ptr_conv.is_owned = false;
37906         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37907         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
37908         return ret_arr;
37909 }
37910
37911 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
37912         LDKPhantomRouteHints this_ptr_conv;
37913         this_ptr_conv.inner = untag_ptr(this_ptr);
37914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37916         this_ptr_conv.is_owned = false;
37917         LDKPublicKey val_ref;
37918         CHECK(val->arr_len == 33);
37919         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37920         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
37921 }
37922
37923 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) {
37924         LDKCVec_ChannelDetailsZ channels_arg_constr;
37925         channels_arg_constr.datalen = channels_arg->arr_len;
37926         if (channels_arg_constr.datalen > 0)
37927                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
37928         else
37929                 channels_arg_constr.data = NULL;
37930         uint64_t* channels_arg_vals = channels_arg->elems;
37931         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
37932                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
37933                 LDKChannelDetails channels_arg_conv_16_conv;
37934                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
37935                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
37936                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
37937                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
37938                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
37939         }
37940         FREE(channels_arg);
37941         LDKPublicKey real_node_pubkey_arg_ref;
37942         CHECK(real_node_pubkey_arg->arr_len == 33);
37943         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
37944         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
37945         uint64_t ret_ref = 0;
37946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37948         return ret_ref;
37949 }
37950
37951 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
37952         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
37953         uint64_t ret_ref = 0;
37954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37956         return ret_ref;
37957 }
37958 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
37959         LDKPhantomRouteHints arg_conv;
37960         arg_conv.inner = untag_ptr(arg);
37961         arg_conv.is_owned = ptr_is_owned(arg);
37962         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37963         arg_conv.is_owned = false;
37964         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
37965         return ret_conv;
37966 }
37967
37968 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
37969         LDKPhantomRouteHints orig_conv;
37970         orig_conv.inner = untag_ptr(orig);
37971         orig_conv.is_owned = ptr_is_owned(orig);
37972         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37973         orig_conv.is_owned = false;
37974         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
37975         uint64_t ret_ref = 0;
37976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37978         return ret_ref;
37979 }
37980
37981 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) {
37982         void* fee_est_ptr = untag_ptr(fee_est);
37983         CHECK_ACCESS(fee_est_ptr);
37984         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
37985         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
37986                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37987                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
37988         }
37989         void* chain_monitor_ptr = untag_ptr(chain_monitor);
37990         CHECK_ACCESS(chain_monitor_ptr);
37991         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
37992         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
37993                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37994                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
37995         }
37996         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
37997         CHECK_ACCESS(tx_broadcaster_ptr);
37998         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
37999         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38000                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38001                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
38002         }
38003         void* router_ptr = untag_ptr(router);
38004         CHECK_ACCESS(router_ptr);
38005         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
38006         if (router_conv.free == LDKRouter_JCalls_free) {
38007                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38008                 LDKRouter_JCalls_cloned(&router_conv);
38009         }
38010         void* logger_ptr = untag_ptr(logger);
38011         CHECK_ACCESS(logger_ptr);
38012         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38013         if (logger_conv.free == LDKLogger_JCalls_free) {
38014                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38015                 LDKLogger_JCalls_cloned(&logger_conv);
38016         }
38017         void* entropy_source_ptr = untag_ptr(entropy_source);
38018         CHECK_ACCESS(entropy_source_ptr);
38019         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
38020         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
38021                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38022                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
38023         }
38024         void* node_signer_ptr = untag_ptr(node_signer);
38025         CHECK_ACCESS(node_signer_ptr);
38026         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
38027         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
38028                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38029                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
38030         }
38031         void* signer_provider_ptr = untag_ptr(signer_provider);
38032         CHECK_ACCESS(signer_provider_ptr);
38033         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
38034         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
38035                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38036                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
38037         }
38038         LDKUserConfig config_conv;
38039         config_conv.inner = untag_ptr(config);
38040         config_conv.is_owned = ptr_is_owned(config);
38041         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
38042         config_conv = UserConfig_clone(&config_conv);
38043         LDKChainParameters params_conv;
38044         params_conv.inner = untag_ptr(params);
38045         params_conv.is_owned = ptr_is_owned(params);
38046         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
38047         params_conv = ChainParameters_clone(&params_conv);
38048         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);
38049         uint64_t ret_ref = 0;
38050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38052         return ret_ref;
38053 }
38054
38055 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
38056         LDKChannelManager this_arg_conv;
38057         this_arg_conv.inner = untag_ptr(this_arg);
38058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38060         this_arg_conv.is_owned = false;
38061         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
38062         uint64_t ret_ref = 0;
38063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38065         return ret_ref;
38066 }
38067
38068 uint64_t  __attribute__((export_name("TS_ChannelManager_create_channel"))) TS_ChannelManager_create_channel(uint64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int8_tArray user_channel_id, uint64_t temporary_channel_id, uint64_t override_config) {
38069         LDKChannelManager this_arg_conv;
38070         this_arg_conv.inner = untag_ptr(this_arg);
38071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38073         this_arg_conv.is_owned = false;
38074         LDKPublicKey their_network_key_ref;
38075         CHECK(their_network_key->arr_len == 33);
38076         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
38077         LDKU128 user_channel_id_ref;
38078         CHECK(user_channel_id->arr_len == 16);
38079         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
38080         void* temporary_channel_id_ptr = untag_ptr(temporary_channel_id);
38081         CHECK_ACCESS(temporary_channel_id_ptr);
38082         LDKCOption_ThirtyTwoBytesZ temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(temporary_channel_id_ptr);
38083         temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(temporary_channel_id));
38084         LDKUserConfig override_config_conv;
38085         override_config_conv.inner = untag_ptr(override_config);
38086         override_config_conv.is_owned = ptr_is_owned(override_config);
38087         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
38088         override_config_conv = UserConfig_clone(&override_config_conv);
38089         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
38090         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, temporary_channel_id_conv, override_config_conv);
38091         return tag_ptr(ret_conv, true);
38092 }
38093
38094 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
38095         LDKChannelManager this_arg_conv;
38096         this_arg_conv.inner = untag_ptr(this_arg);
38097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38099         this_arg_conv.is_owned = false;
38100         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
38101         uint64_tArray ret_arr = NULL;
38102         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
38103         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
38104         for (size_t q = 0; q < ret_var.datalen; q++) {
38105                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38106                 uint64_t ret_conv_16_ref = 0;
38107                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38108                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38109                 ret_arr_ptr[q] = ret_conv_16_ref;
38110         }
38111         
38112         FREE(ret_var.data);
38113         return ret_arr;
38114 }
38115
38116 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
38117         LDKChannelManager this_arg_conv;
38118         this_arg_conv.inner = untag_ptr(this_arg);
38119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38121         this_arg_conv.is_owned = false;
38122         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
38123         uint64_tArray ret_arr = NULL;
38124         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
38125         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
38126         for (size_t q = 0; q < ret_var.datalen; q++) {
38127                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38128                 uint64_t ret_conv_16_ref = 0;
38129                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38130                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38131                 ret_arr_ptr[q] = ret_conv_16_ref;
38132         }
38133         
38134         FREE(ret_var.data);
38135         return ret_arr;
38136 }
38137
38138 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) {
38139         LDKChannelManager this_arg_conv;
38140         this_arg_conv.inner = untag_ptr(this_arg);
38141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38143         this_arg_conv.is_owned = false;
38144         LDKPublicKey counterparty_node_id_ref;
38145         CHECK(counterparty_node_id->arr_len == 33);
38146         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38147         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
38148         uint64_tArray ret_arr = NULL;
38149         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
38150         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
38151         for (size_t q = 0; q < ret_var.datalen; q++) {
38152                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38153                 uint64_t ret_conv_16_ref = 0;
38154                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38155                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38156                 ret_arr_ptr[q] = ret_conv_16_ref;
38157         }
38158         
38159         FREE(ret_var.data);
38160         return ret_arr;
38161 }
38162
38163 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_recent_payments"))) TS_ChannelManager_list_recent_payments(uint64_t this_arg) {
38164         LDKChannelManager this_arg_conv;
38165         this_arg_conv.inner = untag_ptr(this_arg);
38166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38168         this_arg_conv.is_owned = false;
38169         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
38170         uint64_tArray ret_arr = NULL;
38171         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
38172         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
38173         for (size_t w = 0; w < ret_var.datalen; w++) {
38174                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
38175                 *ret_conv_22_copy = ret_var.data[w];
38176                 uint64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
38177                 ret_arr_ptr[w] = ret_conv_22_ref;
38178         }
38179         
38180         FREE(ret_var.data);
38181         return ret_arr;
38182 }
38183
38184 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) {
38185         LDKChannelManager this_arg_conv;
38186         this_arg_conv.inner = untag_ptr(this_arg);
38187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38189         this_arg_conv.is_owned = false;
38190         uint8_t channel_id_arr[32];
38191         CHECK(channel_id->arr_len == 32);
38192         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
38193         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38194         LDKPublicKey counterparty_node_id_ref;
38195         CHECK(counterparty_node_id->arr_len == 33);
38196         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38197         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38198         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
38199         return tag_ptr(ret_conv, true);
38200 }
38201
38202 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) {
38203         LDKChannelManager this_arg_conv;
38204         this_arg_conv.inner = untag_ptr(this_arg);
38205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38207         this_arg_conv.is_owned = false;
38208         uint8_t channel_id_arr[32];
38209         CHECK(channel_id->arr_len == 32);
38210         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
38211         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38212         LDKPublicKey counterparty_node_id_ref;
38213         CHECK(counterparty_node_id->arr_len == 33);
38214         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38215         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
38216         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
38217         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
38218         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
38219         LDKShutdownScript shutdown_script_conv;
38220         shutdown_script_conv.inner = untag_ptr(shutdown_script);
38221         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
38222         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
38223         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
38224         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38225         *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);
38226         return tag_ptr(ret_conv, true);
38227 }
38228
38229 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) {
38230         LDKChannelManager this_arg_conv;
38231         this_arg_conv.inner = untag_ptr(this_arg);
38232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38234         this_arg_conv.is_owned = false;
38235         uint8_t channel_id_arr[32];
38236         CHECK(channel_id->arr_len == 32);
38237         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
38238         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38239         LDKPublicKey counterparty_node_id_ref;
38240         CHECK(counterparty_node_id->arr_len == 33);
38241         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38242         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38243         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
38244         return tag_ptr(ret_conv, true);
38245 }
38246
38247 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) {
38248         LDKChannelManager this_arg_conv;
38249         this_arg_conv.inner = untag_ptr(this_arg);
38250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38252         this_arg_conv.is_owned = false;
38253         uint8_t channel_id_arr[32];
38254         CHECK(channel_id->arr_len == 32);
38255         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
38256         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38257         LDKPublicKey counterparty_node_id_ref;
38258         CHECK(counterparty_node_id->arr_len == 33);
38259         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38260         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38261         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
38262         return tag_ptr(ret_conv, true);
38263 }
38264
38265 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) {
38266         LDKChannelManager this_arg_conv;
38267         this_arg_conv.inner = untag_ptr(this_arg);
38268         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38270         this_arg_conv.is_owned = false;
38271         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
38272 }
38273
38274 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) {
38275         LDKChannelManager this_arg_conv;
38276         this_arg_conv.inner = untag_ptr(this_arg);
38277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38279         this_arg_conv.is_owned = false;
38280         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
38281 }
38282
38283 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) {
38284         LDKChannelManager this_arg_conv;
38285         this_arg_conv.inner = untag_ptr(this_arg);
38286         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38288         this_arg_conv.is_owned = false;
38289         LDKRoute route_conv;
38290         route_conv.inner = untag_ptr(route);
38291         route_conv.is_owned = ptr_is_owned(route);
38292         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
38293         route_conv.is_owned = false;
38294         LDKThirtyTwoBytes payment_hash_ref;
38295         CHECK(payment_hash->arr_len == 32);
38296         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38297         LDKRecipientOnionFields recipient_onion_conv;
38298         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38299         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38300         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38301         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38302         LDKThirtyTwoBytes payment_id_ref;
38303         CHECK(payment_id->arr_len == 32);
38304         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38305         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
38306         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
38307         return tag_ptr(ret_conv, true);
38308 }
38309
38310 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) {
38311         LDKChannelManager this_arg_conv;
38312         this_arg_conv.inner = untag_ptr(this_arg);
38313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38315         this_arg_conv.is_owned = false;
38316         LDKThirtyTwoBytes payment_hash_ref;
38317         CHECK(payment_hash->arr_len == 32);
38318         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38319         LDKRecipientOnionFields recipient_onion_conv;
38320         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38321         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38322         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38323         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38324         LDKThirtyTwoBytes payment_id_ref;
38325         CHECK(payment_id->arr_len == 32);
38326         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38327         LDKRouteParameters route_params_conv;
38328         route_params_conv.inner = untag_ptr(route_params);
38329         route_params_conv.is_owned = ptr_is_owned(route_params);
38330         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
38331         route_params_conv = RouteParameters_clone(&route_params_conv);
38332         void* retry_strategy_ptr = untag_ptr(retry_strategy);
38333         CHECK_ACCESS(retry_strategy_ptr);
38334         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
38335         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
38336         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
38337         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
38338         return tag_ptr(ret_conv, true);
38339 }
38340
38341 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
38342         LDKChannelManager this_arg_conv;
38343         this_arg_conv.inner = untag_ptr(this_arg);
38344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38346         this_arg_conv.is_owned = false;
38347         LDKThirtyTwoBytes payment_id_ref;
38348         CHECK(payment_id->arr_len == 32);
38349         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38350         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
38351 }
38352
38353 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) {
38354         LDKChannelManager this_arg_conv;
38355         this_arg_conv.inner = untag_ptr(this_arg);
38356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38358         this_arg_conv.is_owned = false;
38359         LDKRoute route_conv;
38360         route_conv.inner = untag_ptr(route);
38361         route_conv.is_owned = ptr_is_owned(route);
38362         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
38363         route_conv.is_owned = false;
38364         void* payment_preimage_ptr = untag_ptr(payment_preimage);
38365         CHECK_ACCESS(payment_preimage_ptr);
38366         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
38367         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
38368         LDKRecipientOnionFields recipient_onion_conv;
38369         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38370         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38371         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38372         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38373         LDKThirtyTwoBytes payment_id_ref;
38374         CHECK(payment_id->arr_len == 32);
38375         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38376         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
38377         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
38378         return tag_ptr(ret_conv, true);
38379 }
38380
38381 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) {
38382         LDKChannelManager this_arg_conv;
38383         this_arg_conv.inner = untag_ptr(this_arg);
38384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38386         this_arg_conv.is_owned = false;
38387         void* payment_preimage_ptr = untag_ptr(payment_preimage);
38388         CHECK_ACCESS(payment_preimage_ptr);
38389         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
38390         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
38391         LDKRecipientOnionFields recipient_onion_conv;
38392         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38393         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38394         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38395         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38396         LDKThirtyTwoBytes payment_id_ref;
38397         CHECK(payment_id->arr_len == 32);
38398         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38399         LDKRouteParameters route_params_conv;
38400         route_params_conv.inner = untag_ptr(route_params);
38401         route_params_conv.is_owned = ptr_is_owned(route_params);
38402         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
38403         route_params_conv = RouteParameters_clone(&route_params_conv);
38404         void* retry_strategy_ptr = untag_ptr(retry_strategy);
38405         CHECK_ACCESS(retry_strategy_ptr);
38406         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
38407         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
38408         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
38409         *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);
38410         return tag_ptr(ret_conv, true);
38411 }
38412
38413 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_t path) {
38414         LDKChannelManager this_arg_conv;
38415         this_arg_conv.inner = untag_ptr(this_arg);
38416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38418         this_arg_conv.is_owned = false;
38419         LDKPath path_conv;
38420         path_conv.inner = untag_ptr(path);
38421         path_conv.is_owned = ptr_is_owned(path);
38422         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
38423         path_conv = Path_clone(&path_conv);
38424         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
38425         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
38426         return tag_ptr(ret_conv, true);
38427 }
38428
38429 uint64_t  __attribute__((export_name("TS_ChannelManager_send_spontaneous_preflight_probes"))) TS_ChannelManager_send_spontaneous_preflight_probes(uint64_t this_arg, int8_tArray node_id, int64_t amount_msat, int32_t final_cltv_expiry_delta, uint64_t liquidity_limit_multiplier) {
38430         LDKChannelManager this_arg_conv;
38431         this_arg_conv.inner = untag_ptr(this_arg);
38432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38434         this_arg_conv.is_owned = false;
38435         LDKPublicKey node_id_ref;
38436         CHECK(node_id->arr_len == 33);
38437         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
38438         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
38439         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
38440         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
38441         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
38442         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
38443         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
38444         return tag_ptr(ret_conv, true);
38445 }
38446
38447 uint64_t  __attribute__((export_name("TS_ChannelManager_send_preflight_probes"))) TS_ChannelManager_send_preflight_probes(uint64_t this_arg, uint64_t route_params, uint64_t liquidity_limit_multiplier) {
38448         LDKChannelManager this_arg_conv;
38449         this_arg_conv.inner = untag_ptr(this_arg);
38450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38452         this_arg_conv.is_owned = false;
38453         LDKRouteParameters route_params_conv;
38454         route_params_conv.inner = untag_ptr(route_params);
38455         route_params_conv.is_owned = ptr_is_owned(route_params);
38456         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
38457         route_params_conv = RouteParameters_clone(&route_params_conv);
38458         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
38459         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
38460         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
38461         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
38462         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
38463         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
38464         return tag_ptr(ret_conv, true);
38465 }
38466
38467 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) {
38468         LDKChannelManager this_arg_conv;
38469         this_arg_conv.inner = untag_ptr(this_arg);
38470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38472         this_arg_conv.is_owned = false;
38473         uint8_t temporary_channel_id_arr[32];
38474         CHECK(temporary_channel_id->arr_len == 32);
38475         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
38476         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
38477         LDKPublicKey counterparty_node_id_ref;
38478         CHECK(counterparty_node_id->arr_len == 33);
38479         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38480         LDKTransaction funding_transaction_ref;
38481         funding_transaction_ref.datalen = funding_transaction->arr_len;
38482         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
38483         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
38484         funding_transaction_ref.data_is_owned = true;
38485         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38486         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
38487         return tag_ptr(ret_conv, true);
38488 }
38489
38490 uint64_t  __attribute__((export_name("TS_ChannelManager_batch_funding_transaction_generated"))) TS_ChannelManager_batch_funding_transaction_generated(uint64_t this_arg, uint64_tArray temporary_channels, int8_tArray funding_transaction) {
38491         LDKChannelManager this_arg_conv;
38492         this_arg_conv.inner = untag_ptr(this_arg);
38493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38495         this_arg_conv.is_owned = false;
38496         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ temporary_channels_constr;
38497         temporary_channels_constr.datalen = temporary_channels->arr_len;
38498         if (temporary_channels_constr.datalen > 0)
38499                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
38500         else
38501                 temporary_channels_constr.data = NULL;
38502         uint64_t* temporary_channels_vals = temporary_channels->elems;
38503         for (size_t j = 0; j < temporary_channels_constr.datalen; j++) {
38504                 uint64_t temporary_channels_conv_35 = temporary_channels_vals[j];
38505                 void* temporary_channels_conv_35_ptr = untag_ptr(temporary_channels_conv_35);
38506                 CHECK_ACCESS(temporary_channels_conv_35_ptr);
38507                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ temporary_channels_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(temporary_channels_conv_35_ptr);
38508                 temporary_channels_conv_35_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone((LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(temporary_channels_conv_35));
38509                 temporary_channels_constr.data[j] = temporary_channels_conv_35_conv;
38510         }
38511         FREE(temporary_channels);
38512         LDKTransaction funding_transaction_ref;
38513         funding_transaction_ref.datalen = funding_transaction->arr_len;
38514         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
38515         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
38516         funding_transaction_ref.data_is_owned = true;
38517         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38518         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
38519         return tag_ptr(ret_conv, true);
38520 }
38521
38522 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) {
38523         LDKChannelManager this_arg_conv;
38524         this_arg_conv.inner = untag_ptr(this_arg);
38525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38527         this_arg_conv.is_owned = false;
38528         LDKPublicKey counterparty_node_id_ref;
38529         CHECK(counterparty_node_id->arr_len == 33);
38530         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38531         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
38532         channel_ids_constr.datalen = channel_ids->arr_len;
38533         if (channel_ids_constr.datalen > 0)
38534                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
38535         else
38536                 channel_ids_constr.data = NULL;
38537         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
38538         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
38539                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
38540                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
38541                 CHECK(channel_ids_conv_12->arr_len == 32);
38542                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
38543                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
38544         }
38545         FREE(channel_ids);
38546         LDKChannelConfigUpdate config_update_conv;
38547         config_update_conv.inner = untag_ptr(config_update);
38548         config_update_conv.is_owned = ptr_is_owned(config_update);
38549         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
38550         config_update_conv.is_owned = false;
38551         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38552         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
38553         return tag_ptr(ret_conv, true);
38554 }
38555
38556 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) {
38557         LDKChannelManager this_arg_conv;
38558         this_arg_conv.inner = untag_ptr(this_arg);
38559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38561         this_arg_conv.is_owned = false;
38562         LDKPublicKey counterparty_node_id_ref;
38563         CHECK(counterparty_node_id->arr_len == 33);
38564         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38565         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
38566         channel_ids_constr.datalen = channel_ids->arr_len;
38567         if (channel_ids_constr.datalen > 0)
38568                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
38569         else
38570                 channel_ids_constr.data = NULL;
38571         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
38572         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
38573                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
38574                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
38575                 CHECK(channel_ids_conv_12->arr_len == 32);
38576                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
38577                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
38578         }
38579         FREE(channel_ids);
38580         LDKChannelConfig config_conv;
38581         config_conv.inner = untag_ptr(config);
38582         config_conv.is_owned = ptr_is_owned(config);
38583         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
38584         config_conv.is_owned = false;
38585         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38586         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
38587         return tag_ptr(ret_conv, true);
38588 }
38589
38590 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) {
38591         LDKChannelManager this_arg_conv;
38592         this_arg_conv.inner = untag_ptr(this_arg);
38593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38595         this_arg_conv.is_owned = false;
38596         LDKThirtyTwoBytes intercept_id_ref;
38597         CHECK(intercept_id->arr_len == 32);
38598         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
38599         uint8_t next_hop_channel_id_arr[32];
38600         CHECK(next_hop_channel_id->arr_len == 32);
38601         memcpy(next_hop_channel_id_arr, next_hop_channel_id->elems, 32); FREE(next_hop_channel_id);
38602         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
38603         LDKPublicKey next_node_id_ref;
38604         CHECK(next_node_id->arr_len == 33);
38605         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
38606         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38607         *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);
38608         return tag_ptr(ret_conv, true);
38609 }
38610
38611 uint64_t  __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) {
38612         LDKChannelManager this_arg_conv;
38613         this_arg_conv.inner = untag_ptr(this_arg);
38614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38616         this_arg_conv.is_owned = false;
38617         LDKThirtyTwoBytes intercept_id_ref;
38618         CHECK(intercept_id->arr_len == 32);
38619         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
38620         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38621         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
38622         return tag_ptr(ret_conv, true);
38623 }
38624
38625 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
38626         LDKChannelManager this_arg_conv;
38627         this_arg_conv.inner = untag_ptr(this_arg);
38628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38630         this_arg_conv.is_owned = false;
38631         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
38632 }
38633
38634 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
38635         LDKChannelManager this_arg_conv;
38636         this_arg_conv.inner = untag_ptr(this_arg);
38637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38639         this_arg_conv.is_owned = false;
38640         ChannelManager_timer_tick_occurred(&this_arg_conv);
38641 }
38642
38643 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
38644         LDKChannelManager this_arg_conv;
38645         this_arg_conv.inner = untag_ptr(this_arg);
38646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38648         this_arg_conv.is_owned = false;
38649         uint8_t payment_hash_arr[32];
38650         CHECK(payment_hash->arr_len == 32);
38651         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
38652         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
38653         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
38654 }
38655
38656 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards_with_reason"))) TS_ChannelManager_fail_htlc_backwards_with_reason(uint64_t this_arg, int8_tArray payment_hash, uint64_t failure_code) {
38657         LDKChannelManager this_arg_conv;
38658         this_arg_conv.inner = untag_ptr(this_arg);
38659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38661         this_arg_conv.is_owned = false;
38662         uint8_t payment_hash_arr[32];
38663         CHECK(payment_hash->arr_len == 32);
38664         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
38665         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
38666         void* failure_code_ptr = untag_ptr(failure_code);
38667         CHECK_ACCESS(failure_code_ptr);
38668         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
38669         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
38670         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
38671 }
38672
38673 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
38674         LDKChannelManager this_arg_conv;
38675         this_arg_conv.inner = untag_ptr(this_arg);
38676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38678         this_arg_conv.is_owned = false;
38679         LDKThirtyTwoBytes payment_preimage_ref;
38680         CHECK(payment_preimage->arr_len == 32);
38681         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
38682         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
38683 }
38684
38685 void  __attribute__((export_name("TS_ChannelManager_claim_funds_with_known_custom_tlvs"))) TS_ChannelManager_claim_funds_with_known_custom_tlvs(uint64_t this_arg, int8_tArray payment_preimage) {
38686         LDKChannelManager this_arg_conv;
38687         this_arg_conv.inner = untag_ptr(this_arg);
38688         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38690         this_arg_conv.is_owned = false;
38691         LDKThirtyTwoBytes payment_preimage_ref;
38692         CHECK(payment_preimage->arr_len == 32);
38693         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
38694         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
38695 }
38696
38697 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
38698         LDKChannelManager this_arg_conv;
38699         this_arg_conv.inner = untag_ptr(this_arg);
38700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38702         this_arg_conv.is_owned = false;
38703         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38704         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
38705         return ret_arr;
38706 }
38707
38708 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) {
38709         LDKChannelManager this_arg_conv;
38710         this_arg_conv.inner = untag_ptr(this_arg);
38711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38713         this_arg_conv.is_owned = false;
38714         uint8_t temporary_channel_id_arr[32];
38715         CHECK(temporary_channel_id->arr_len == 32);
38716         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
38717         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
38718         LDKPublicKey counterparty_node_id_ref;
38719         CHECK(counterparty_node_id->arr_len == 33);
38720         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38721         LDKU128 user_channel_id_ref;
38722         CHECK(user_channel_id->arr_len == 16);
38723         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
38724         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38725         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
38726         return tag_ptr(ret_conv, true);
38727 }
38728
38729 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) {
38730         LDKChannelManager this_arg_conv;
38731         this_arg_conv.inner = untag_ptr(this_arg);
38732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38734         this_arg_conv.is_owned = false;
38735         uint8_t temporary_channel_id_arr[32];
38736         CHECK(temporary_channel_id->arr_len == 32);
38737         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
38738         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
38739         LDKPublicKey counterparty_node_id_ref;
38740         CHECK(counterparty_node_id->arr_len == 33);
38741         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38742         LDKU128 user_channel_id_ref;
38743         CHECK(user_channel_id->arr_len == 16);
38744         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
38745         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38746         *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);
38747         return tag_ptr(ret_conv, true);
38748 }
38749
38750 uint64_t  __attribute__((export_name("TS_ChannelManager_pay_for_offer"))) TS_ChannelManager_pay_for_offer(uint64_t this_arg, uint64_t offer, uint64_t quantity, uint64_t amount_msats, uint64_t payer_note, int8_tArray payment_id, uint64_t retry_strategy, uint64_t max_total_routing_fee_msat) {
38751         LDKChannelManager this_arg_conv;
38752         this_arg_conv.inner = untag_ptr(this_arg);
38753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38755         this_arg_conv.is_owned = false;
38756         LDKOffer offer_conv;
38757         offer_conv.inner = untag_ptr(offer);
38758         offer_conv.is_owned = ptr_is_owned(offer);
38759         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_conv);
38760         offer_conv.is_owned = false;
38761         void* quantity_ptr = untag_ptr(quantity);
38762         CHECK_ACCESS(quantity_ptr);
38763         LDKCOption_u64Z quantity_conv = *(LDKCOption_u64Z*)(quantity_ptr);
38764         quantity_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity));
38765         void* amount_msats_ptr = untag_ptr(amount_msats);
38766         CHECK_ACCESS(amount_msats_ptr);
38767         LDKCOption_u64Z amount_msats_conv = *(LDKCOption_u64Z*)(amount_msats_ptr);
38768         amount_msats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amount_msats));
38769         void* payer_note_ptr = untag_ptr(payer_note);
38770         CHECK_ACCESS(payer_note_ptr);
38771         LDKCOption_StrZ payer_note_conv = *(LDKCOption_StrZ*)(payer_note_ptr);
38772         payer_note_conv = COption_StrZ_clone((LDKCOption_StrZ*)untag_ptr(payer_note));
38773         LDKThirtyTwoBytes payment_id_ref;
38774         CHECK(payment_id->arr_len == 32);
38775         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38776         void* retry_strategy_ptr = untag_ptr(retry_strategy);
38777         CHECK_ACCESS(retry_strategy_ptr);
38778         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
38779         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
38780         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
38781         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
38782         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
38783         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
38784         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
38785         *ret_conv = ChannelManager_pay_for_offer(&this_arg_conv, &offer_conv, quantity_conv, amount_msats_conv, payer_note_conv, payment_id_ref, retry_strategy_conv, max_total_routing_fee_msat_conv);
38786         return tag_ptr(ret_conv, true);
38787 }
38788
38789 uint64_t  __attribute__((export_name("TS_ChannelManager_request_refund_payment"))) TS_ChannelManager_request_refund_payment(uint64_t this_arg, uint64_t refund) {
38790         LDKChannelManager this_arg_conv;
38791         this_arg_conv.inner = untag_ptr(this_arg);
38792         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38794         this_arg_conv.is_owned = false;
38795         LDKRefund refund_conv;
38796         refund_conv.inner = untag_ptr(refund);
38797         refund_conv.is_owned = ptr_is_owned(refund);
38798         CHECK_INNER_FIELD_ACCESS_OR_NULL(refund_conv);
38799         refund_conv.is_owned = false;
38800         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
38801         *ret_conv = ChannelManager_request_refund_payment(&this_arg_conv, &refund_conv);
38802         return tag_ptr(ret_conv, true);
38803 }
38804
38805 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) {
38806         LDKChannelManager this_arg_conv;
38807         this_arg_conv.inner = untag_ptr(this_arg);
38808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38810         this_arg_conv.is_owned = false;
38811         void* min_value_msat_ptr = untag_ptr(min_value_msat);
38812         CHECK_ACCESS(min_value_msat_ptr);
38813         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
38814         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
38815         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
38816         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
38817         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
38818         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
38819         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
38820         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
38821         return tag_ptr(ret_conv, true);
38822 }
38823
38824 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) {
38825         LDKChannelManager this_arg_conv;
38826         this_arg_conv.inner = untag_ptr(this_arg);
38827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38829         this_arg_conv.is_owned = false;
38830         LDKThirtyTwoBytes payment_hash_ref;
38831         CHECK(payment_hash->arr_len == 32);
38832         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38833         void* min_value_msat_ptr = untag_ptr(min_value_msat);
38834         CHECK_ACCESS(min_value_msat_ptr);
38835         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
38836         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
38837         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
38838         CHECK_ACCESS(min_final_cltv_expiry_ptr);
38839         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
38840         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
38841         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
38842         *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);
38843         return tag_ptr(ret_conv, true);
38844 }
38845
38846 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) {
38847         LDKChannelManager this_arg_conv;
38848         this_arg_conv.inner = untag_ptr(this_arg);
38849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38851         this_arg_conv.is_owned = false;
38852         LDKThirtyTwoBytes payment_hash_ref;
38853         CHECK(payment_hash->arr_len == 32);
38854         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38855         LDKThirtyTwoBytes payment_secret_ref;
38856         CHECK(payment_secret->arr_len == 32);
38857         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
38858         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
38859         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
38860         return tag_ptr(ret_conv, true);
38861 }
38862
38863 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
38864         LDKChannelManager this_arg_conv;
38865         this_arg_conv.inner = untag_ptr(this_arg);
38866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38868         this_arg_conv.is_owned = false;
38869         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
38870         return ret_conv;
38871 }
38872
38873 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
38874         LDKChannelManager this_arg_conv;
38875         this_arg_conv.inner = untag_ptr(this_arg);
38876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38878         this_arg_conv.is_owned = false;
38879         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
38880         uint64_t ret_ref = 0;
38881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38883         return ret_ref;
38884 }
38885
38886 int64_t  __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) {
38887         LDKChannelManager this_arg_conv;
38888         this_arg_conv.inner = untag_ptr(this_arg);
38889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38891         this_arg_conv.is_owned = false;
38892         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
38893         return ret_conv;
38894 }
38895
38896 uint64_t  __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) {
38897         LDKChannelManager this_arg_conv;
38898         this_arg_conv.inner = untag_ptr(this_arg);
38899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38901         this_arg_conv.is_owned = false;
38902         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
38903         uint64_t ret_ref = 0;
38904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38906         return ret_ref;
38907 }
38908
38909 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
38910         LDKChannelManager this_arg_conv;
38911         this_arg_conv.inner = untag_ptr(this_arg);
38912         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38914         this_arg_conv.is_owned = false;
38915         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
38916         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
38917         return tag_ptr(ret_ret, true);
38918 }
38919
38920 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
38921         LDKChannelManager this_arg_conv;
38922         this_arg_conv.inner = untag_ptr(this_arg);
38923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38925         this_arg_conv.is_owned = false;
38926         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
38927         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
38928         return tag_ptr(ret_ret, true);
38929 }
38930
38931 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
38932         LDKChannelManager this_arg_conv;
38933         this_arg_conv.inner = untag_ptr(this_arg);
38934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38936         this_arg_conv.is_owned = false;
38937         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
38938         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
38939         return tag_ptr(ret_ret, true);
38940 }
38941
38942 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
38943         LDKChannelManager this_arg_conv;
38944         this_arg_conv.inner = untag_ptr(this_arg);
38945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38947         this_arg_conv.is_owned = false;
38948         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
38949         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
38950         return tag_ptr(ret_ret, true);
38951 }
38952
38953 uint64_t  __attribute__((export_name("TS_ChannelManager_get_event_or_persistence_needed_future"))) TS_ChannelManager_get_event_or_persistence_needed_future(uint64_t this_arg) {
38954         LDKChannelManager this_arg_conv;
38955         this_arg_conv.inner = untag_ptr(this_arg);
38956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38958         this_arg_conv.is_owned = false;
38959         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
38960         uint64_t ret_ref = 0;
38961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38963         return ret_ref;
38964 }
38965
38966 jboolean  __attribute__((export_name("TS_ChannelManager_get_and_clear_needs_persistence"))) TS_ChannelManager_get_and_clear_needs_persistence(uint64_t this_arg) {
38967         LDKChannelManager this_arg_conv;
38968         this_arg_conv.inner = untag_ptr(this_arg);
38969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38971         this_arg_conv.is_owned = false;
38972         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
38973         return ret_conv;
38974 }
38975
38976 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
38977         LDKChannelManager this_arg_conv;
38978         this_arg_conv.inner = untag_ptr(this_arg);
38979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38981         this_arg_conv.is_owned = false;
38982         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
38983         uint64_t ret_ref = 0;
38984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38986         return ret_ref;
38987 }
38988
38989 uint64_t  __attribute__((export_name("TS_ChannelManager_node_features"))) TS_ChannelManager_node_features(uint64_t this_arg) {
38990         LDKChannelManager this_arg_conv;
38991         this_arg_conv.inner = untag_ptr(this_arg);
38992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38994         this_arg_conv.is_owned = false;
38995         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
38996         uint64_t ret_ref = 0;
38997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38999         return ret_ref;
39000 }
39001
39002 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_features"))) TS_ChannelManager_channel_features(uint64_t this_arg) {
39003         LDKChannelManager this_arg_conv;
39004         this_arg_conv.inner = untag_ptr(this_arg);
39005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39007         this_arg_conv.is_owned = false;
39008         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
39009         uint64_t ret_ref = 0;
39010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39012         return ret_ref;
39013 }
39014
39015 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_type_features"))) TS_ChannelManager_channel_type_features(uint64_t this_arg) {
39016         LDKChannelManager this_arg_conv;
39017         this_arg_conv.inner = untag_ptr(this_arg);
39018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39020         this_arg_conv.is_owned = false;
39021         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
39022         uint64_t ret_ref = 0;
39023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39025         return ret_ref;
39026 }
39027
39028 uint64_t  __attribute__((export_name("TS_ChannelManager_init_features"))) TS_ChannelManager_init_features(uint64_t this_arg) {
39029         LDKChannelManager this_arg_conv;
39030         this_arg_conv.inner = untag_ptr(this_arg);
39031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39033         this_arg_conv.is_owned = false;
39034         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
39035         uint64_t ret_ref = 0;
39036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39038         return ret_ref;
39039 }
39040
39041 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
39042         LDKChannelManager this_arg_conv;
39043         this_arg_conv.inner = untag_ptr(this_arg);
39044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39046         this_arg_conv.is_owned = false;
39047         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
39048         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
39049         return tag_ptr(ret_ret, true);
39050 }
39051
39052 uint64_t  __attribute__((export_name("TS_ChannelManager_as_OffersMessageHandler"))) TS_ChannelManager_as_OffersMessageHandler(uint64_t this_arg) {
39053         LDKChannelManager this_arg_conv;
39054         this_arg_conv.inner = untag_ptr(this_arg);
39055         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39057         this_arg_conv.is_owned = false;
39058         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
39059         *ret_ret = ChannelManager_as_OffersMessageHandler(&this_arg_conv);
39060         return tag_ptr(ret_ret, true);
39061 }
39062
39063 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features(uint64_t config) {
39064         LDKUserConfig config_conv;
39065         config_conv.inner = untag_ptr(config);
39066         config_conv.is_owned = ptr_is_owned(config);
39067         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
39068         config_conv.is_owned = false;
39069         LDKInitFeatures ret_var = provided_init_features(&config_conv);
39070         uint64_t ret_ref = 0;
39071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39073         return ret_ref;
39074 }
39075
39076 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
39077         LDKCounterpartyForwardingInfo obj_conv;
39078         obj_conv.inner = untag_ptr(obj);
39079         obj_conv.is_owned = ptr_is_owned(obj);
39080         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39081         obj_conv.is_owned = false;
39082         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
39083         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39084         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39085         CVec_u8Z_free(ret_var);
39086         return ret_arr;
39087 }
39088
39089 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
39090         LDKu8slice ser_ref;
39091         ser_ref.datalen = ser->arr_len;
39092         ser_ref.data = ser->elems;
39093         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
39094         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
39095         FREE(ser);
39096         return tag_ptr(ret_conv, true);
39097 }
39098
39099 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
39100         LDKChannelCounterparty obj_conv;
39101         obj_conv.inner = untag_ptr(obj);
39102         obj_conv.is_owned = ptr_is_owned(obj);
39103         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39104         obj_conv.is_owned = false;
39105         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
39106         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39107         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39108         CVec_u8Z_free(ret_var);
39109         return ret_arr;
39110 }
39111
39112 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
39113         LDKu8slice ser_ref;
39114         ser_ref.datalen = ser->arr_len;
39115         ser_ref.data = ser->elems;
39116         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
39117         *ret_conv = ChannelCounterparty_read(ser_ref);
39118         FREE(ser);
39119         return tag_ptr(ret_conv, true);
39120 }
39121
39122 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
39123         LDKChannelDetails obj_conv;
39124         obj_conv.inner = untag_ptr(obj);
39125         obj_conv.is_owned = ptr_is_owned(obj);
39126         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39127         obj_conv.is_owned = false;
39128         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
39129         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39130         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39131         CVec_u8Z_free(ret_var);
39132         return ret_arr;
39133 }
39134
39135 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
39136         LDKu8slice ser_ref;
39137         ser_ref.datalen = ser->arr_len;
39138         ser_ref.data = ser->elems;
39139         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
39140         *ret_conv = ChannelDetails_read(ser_ref);
39141         FREE(ser);
39142         return tag_ptr(ret_conv, true);
39143 }
39144
39145 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
39146         LDKPhantomRouteHints obj_conv;
39147         obj_conv.inner = untag_ptr(obj);
39148         obj_conv.is_owned = ptr_is_owned(obj);
39149         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39150         obj_conv.is_owned = false;
39151         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
39152         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39153         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39154         CVec_u8Z_free(ret_var);
39155         return ret_arr;
39156 }
39157
39158 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
39159         LDKu8slice ser_ref;
39160         ser_ref.datalen = ser->arr_len;
39161         ser_ref.data = ser->elems;
39162         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
39163         *ret_conv = PhantomRouteHints_read(ser_ref);
39164         FREE(ser);
39165         return tag_ptr(ret_conv, true);
39166 }
39167
39168 int8_tArray  __attribute__((export_name("TS_BlindedForward_write"))) TS_BlindedForward_write(uint64_t obj) {
39169         LDKBlindedForward obj_conv;
39170         obj_conv.inner = untag_ptr(obj);
39171         obj_conv.is_owned = ptr_is_owned(obj);
39172         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39173         obj_conv.is_owned = false;
39174         LDKCVec_u8Z ret_var = BlindedForward_write(&obj_conv);
39175         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39176         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39177         CVec_u8Z_free(ret_var);
39178         return ret_arr;
39179 }
39180
39181 uint64_t  __attribute__((export_name("TS_BlindedForward_read"))) TS_BlindedForward_read(int8_tArray ser) {
39182         LDKu8slice ser_ref;
39183         ser_ref.datalen = ser->arr_len;
39184         ser_ref.data = ser->elems;
39185         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
39186         *ret_conv = BlindedForward_read(ser_ref);
39187         FREE(ser);
39188         return tag_ptr(ret_conv, true);
39189 }
39190
39191 int8_tArray  __attribute__((export_name("TS_PendingHTLCRouting_write"))) TS_PendingHTLCRouting_write(uint64_t obj) {
39192         LDKPendingHTLCRouting* obj_conv = (LDKPendingHTLCRouting*)untag_ptr(obj);
39193         LDKCVec_u8Z ret_var = PendingHTLCRouting_write(obj_conv);
39194         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39195         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39196         CVec_u8Z_free(ret_var);
39197         return ret_arr;
39198 }
39199
39200 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_read"))) TS_PendingHTLCRouting_read(int8_tArray ser) {
39201         LDKu8slice ser_ref;
39202         ser_ref.datalen = ser->arr_len;
39203         ser_ref.data = ser->elems;
39204         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
39205         *ret_conv = PendingHTLCRouting_read(ser_ref);
39206         FREE(ser);
39207         return tag_ptr(ret_conv, true);
39208 }
39209
39210 int8_tArray  __attribute__((export_name("TS_PendingHTLCInfo_write"))) TS_PendingHTLCInfo_write(uint64_t obj) {
39211         LDKPendingHTLCInfo obj_conv;
39212         obj_conv.inner = untag_ptr(obj);
39213         obj_conv.is_owned = ptr_is_owned(obj);
39214         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39215         obj_conv.is_owned = false;
39216         LDKCVec_u8Z ret_var = PendingHTLCInfo_write(&obj_conv);
39217         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39218         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39219         CVec_u8Z_free(ret_var);
39220         return ret_arr;
39221 }
39222
39223 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_read"))) TS_PendingHTLCInfo_read(int8_tArray ser) {
39224         LDKu8slice ser_ref;
39225         ser_ref.datalen = ser->arr_len;
39226         ser_ref.data = ser->elems;
39227         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
39228         *ret_conv = PendingHTLCInfo_read(ser_ref);
39229         FREE(ser);
39230         return tag_ptr(ret_conv, true);
39231 }
39232
39233 int8_tArray  __attribute__((export_name("TS_BlindedFailure_write"))) TS_BlindedFailure_write(uint64_t obj) {
39234         LDKBlindedFailure* obj_conv = (LDKBlindedFailure*)untag_ptr(obj);
39235         LDKCVec_u8Z ret_var = BlindedFailure_write(obj_conv);
39236         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39237         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39238         CVec_u8Z_free(ret_var);
39239         return ret_arr;
39240 }
39241
39242 uint64_t  __attribute__((export_name("TS_BlindedFailure_read"))) TS_BlindedFailure_read(int8_tArray ser) {
39243         LDKu8slice ser_ref;
39244         ser_ref.datalen = ser->arr_len;
39245         ser_ref.data = ser->elems;
39246         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
39247         *ret_conv = BlindedFailure_read(ser_ref);
39248         FREE(ser);
39249         return tag_ptr(ret_conv, true);
39250 }
39251
39252 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
39253         LDKChannelManager obj_conv;
39254         obj_conv.inner = untag_ptr(obj);
39255         obj_conv.is_owned = ptr_is_owned(obj);
39256         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39257         obj_conv.is_owned = false;
39258         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
39259         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39260         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39261         CVec_u8Z_free(ret_var);
39262         return ret_arr;
39263 }
39264
39265 int8_tArray  __attribute__((export_name("TS_ChannelShutdownState_write"))) TS_ChannelShutdownState_write(uint64_t obj) {
39266         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
39267         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
39268         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39269         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39270         CVec_u8Z_free(ret_var);
39271         return ret_arr;
39272 }
39273
39274 uint64_t  __attribute__((export_name("TS_ChannelShutdownState_read"))) TS_ChannelShutdownState_read(int8_tArray ser) {
39275         LDKu8slice ser_ref;
39276         ser_ref.datalen = ser->arr_len;
39277         ser_ref.data = ser->elems;
39278         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
39279         *ret_conv = ChannelShutdownState_read(ser_ref);
39280         FREE(ser);
39281         return tag_ptr(ret_conv, true);
39282 }
39283
39284 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
39285         LDKChannelManagerReadArgs this_obj_conv;
39286         this_obj_conv.inner = untag_ptr(this_obj);
39287         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39289         ChannelManagerReadArgs_free(this_obj_conv);
39290 }
39291
39292 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_entropy_source"))) TS_ChannelManagerReadArgs_get_entropy_source(uint64_t this_ptr) {
39293         LDKChannelManagerReadArgs this_ptr_conv;
39294         this_ptr_conv.inner = untag_ptr(this_ptr);
39295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39297         this_ptr_conv.is_owned = false;
39298         // WARNING: This object doesn't live past this scope, needs clone!
39299         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
39300         return ret_ret;
39301 }
39302
39303 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_entropy_source"))) TS_ChannelManagerReadArgs_set_entropy_source(uint64_t this_ptr, uint64_t val) {
39304         LDKChannelManagerReadArgs 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         void* val_ptr = untag_ptr(val);
39310         CHECK_ACCESS(val_ptr);
39311         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
39312         if (val_conv.free == LDKEntropySource_JCalls_free) {
39313                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39314                 LDKEntropySource_JCalls_cloned(&val_conv);
39315         }
39316         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
39317 }
39318
39319 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_node_signer"))) TS_ChannelManagerReadArgs_get_node_signer(uint64_t this_ptr) {
39320         LDKChannelManagerReadArgs this_ptr_conv;
39321         this_ptr_conv.inner = untag_ptr(this_ptr);
39322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39324         this_ptr_conv.is_owned = false;
39325         // WARNING: This object doesn't live past this scope, needs clone!
39326         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
39327         return ret_ret;
39328 }
39329
39330 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_node_signer"))) TS_ChannelManagerReadArgs_set_node_signer(uint64_t this_ptr, uint64_t val) {
39331         LDKChannelManagerReadArgs this_ptr_conv;
39332         this_ptr_conv.inner = untag_ptr(this_ptr);
39333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39335         this_ptr_conv.is_owned = false;
39336         void* val_ptr = untag_ptr(val);
39337         CHECK_ACCESS(val_ptr);
39338         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
39339         if (val_conv.free == LDKNodeSigner_JCalls_free) {
39340                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39341                 LDKNodeSigner_JCalls_cloned(&val_conv);
39342         }
39343         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
39344 }
39345
39346 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_signer_provider"))) TS_ChannelManagerReadArgs_get_signer_provider(uint64_t this_ptr) {
39347         LDKChannelManagerReadArgs this_ptr_conv;
39348         this_ptr_conv.inner = untag_ptr(this_ptr);
39349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39351         this_ptr_conv.is_owned = false;
39352         // WARNING: This object doesn't live past this scope, needs clone!
39353         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
39354         return ret_ret;
39355 }
39356
39357 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_signer_provider"))) TS_ChannelManagerReadArgs_set_signer_provider(uint64_t this_ptr, uint64_t val) {
39358         LDKChannelManagerReadArgs this_ptr_conv;
39359         this_ptr_conv.inner = untag_ptr(this_ptr);
39360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39362         this_ptr_conv.is_owned = false;
39363         void* val_ptr = untag_ptr(val);
39364         CHECK_ACCESS(val_ptr);
39365         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
39366         if (val_conv.free == LDKSignerProvider_JCalls_free) {
39367                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39368                 LDKSignerProvider_JCalls_cloned(&val_conv);
39369         }
39370         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
39371 }
39372
39373 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
39374         LDKChannelManagerReadArgs this_ptr_conv;
39375         this_ptr_conv.inner = untag_ptr(this_ptr);
39376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39378         this_ptr_conv.is_owned = false;
39379         // WARNING: This object doesn't live past this scope, needs clone!
39380         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
39381         return ret_ret;
39382 }
39383
39384 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
39385         LDKChannelManagerReadArgs this_ptr_conv;
39386         this_ptr_conv.inner = untag_ptr(this_ptr);
39387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39389         this_ptr_conv.is_owned = false;
39390         void* val_ptr = untag_ptr(val);
39391         CHECK_ACCESS(val_ptr);
39392         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
39393         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
39394                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39395                 LDKFeeEstimator_JCalls_cloned(&val_conv);
39396         }
39397         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
39398 }
39399
39400 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
39401         LDKChannelManagerReadArgs this_ptr_conv;
39402         this_ptr_conv.inner = untag_ptr(this_ptr);
39403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39405         this_ptr_conv.is_owned = false;
39406         // WARNING: This object doesn't live past this scope, needs clone!
39407         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
39408         return ret_ret;
39409 }
39410
39411 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
39412         LDKChannelManagerReadArgs this_ptr_conv;
39413         this_ptr_conv.inner = untag_ptr(this_ptr);
39414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39416         this_ptr_conv.is_owned = false;
39417         void* val_ptr = untag_ptr(val);
39418         CHECK_ACCESS(val_ptr);
39419         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
39420         if (val_conv.free == LDKWatch_JCalls_free) {
39421                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39422                 LDKWatch_JCalls_cloned(&val_conv);
39423         }
39424         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
39425 }
39426
39427 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
39428         LDKChannelManagerReadArgs this_ptr_conv;
39429         this_ptr_conv.inner = untag_ptr(this_ptr);
39430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39432         this_ptr_conv.is_owned = false;
39433         // WARNING: This object doesn't live past this scope, needs clone!
39434         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
39435         return ret_ret;
39436 }
39437
39438 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
39439         LDKChannelManagerReadArgs this_ptr_conv;
39440         this_ptr_conv.inner = untag_ptr(this_ptr);
39441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39443         this_ptr_conv.is_owned = false;
39444         void* val_ptr = untag_ptr(val);
39445         CHECK_ACCESS(val_ptr);
39446         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
39447         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
39448                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39449                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
39450         }
39451         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
39452 }
39453
39454 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_router"))) TS_ChannelManagerReadArgs_get_router(uint64_t this_ptr) {
39455         LDKChannelManagerReadArgs this_ptr_conv;
39456         this_ptr_conv.inner = untag_ptr(this_ptr);
39457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39459         this_ptr_conv.is_owned = false;
39460         // WARNING: This object doesn't live past this scope, needs clone!
39461         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
39462         return ret_ret;
39463 }
39464
39465 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_router"))) TS_ChannelManagerReadArgs_set_router(uint64_t this_ptr, uint64_t val) {
39466         LDKChannelManagerReadArgs this_ptr_conv;
39467         this_ptr_conv.inner = untag_ptr(this_ptr);
39468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39470         this_ptr_conv.is_owned = false;
39471         void* val_ptr = untag_ptr(val);
39472         CHECK_ACCESS(val_ptr);
39473         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
39474         if (val_conv.free == LDKRouter_JCalls_free) {
39475                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39476                 LDKRouter_JCalls_cloned(&val_conv);
39477         }
39478         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
39479 }
39480
39481 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
39482         LDKChannelManagerReadArgs this_ptr_conv;
39483         this_ptr_conv.inner = untag_ptr(this_ptr);
39484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39486         this_ptr_conv.is_owned = false;
39487         // WARNING: This object doesn't live past this scope, needs clone!
39488         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
39489         return ret_ret;
39490 }
39491
39492 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
39493         LDKChannelManagerReadArgs this_ptr_conv;
39494         this_ptr_conv.inner = untag_ptr(this_ptr);
39495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39497         this_ptr_conv.is_owned = false;
39498         void* val_ptr = untag_ptr(val);
39499         CHECK_ACCESS(val_ptr);
39500         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
39501         if (val_conv.free == LDKLogger_JCalls_free) {
39502                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39503                 LDKLogger_JCalls_cloned(&val_conv);
39504         }
39505         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
39506 }
39507
39508 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
39509         LDKChannelManagerReadArgs this_ptr_conv;
39510         this_ptr_conv.inner = untag_ptr(this_ptr);
39511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39513         this_ptr_conv.is_owned = false;
39514         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
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
39521 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
39522         LDKChannelManagerReadArgs this_ptr_conv;
39523         this_ptr_conv.inner = untag_ptr(this_ptr);
39524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39526         this_ptr_conv.is_owned = false;
39527         LDKUserConfig val_conv;
39528         val_conv.inner = untag_ptr(val);
39529         val_conv.is_owned = ptr_is_owned(val);
39530         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39531         val_conv = UserConfig_clone(&val_conv);
39532         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
39533 }
39534
39535 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) {
39536         void* entropy_source_ptr = untag_ptr(entropy_source);
39537         CHECK_ACCESS(entropy_source_ptr);
39538         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
39539         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
39540                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39541                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
39542         }
39543         void* node_signer_ptr = untag_ptr(node_signer);
39544         CHECK_ACCESS(node_signer_ptr);
39545         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
39546         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
39547                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39548                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
39549         }
39550         void* signer_provider_ptr = untag_ptr(signer_provider);
39551         CHECK_ACCESS(signer_provider_ptr);
39552         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
39553         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
39554                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39555                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
39556         }
39557         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39558         CHECK_ACCESS(fee_estimator_ptr);
39559         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39560         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39561                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39562                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39563         }
39564         void* chain_monitor_ptr = untag_ptr(chain_monitor);
39565         CHECK_ACCESS(chain_monitor_ptr);
39566         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
39567         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
39568                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39569                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
39570         }
39571         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
39572         CHECK_ACCESS(tx_broadcaster_ptr);
39573         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
39574         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39575                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39576                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
39577         }
39578         void* router_ptr = untag_ptr(router);
39579         CHECK_ACCESS(router_ptr);
39580         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
39581         if (router_conv.free == LDKRouter_JCalls_free) {
39582                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39583                 LDKRouter_JCalls_cloned(&router_conv);
39584         }
39585         void* logger_ptr = untag_ptr(logger);
39586         CHECK_ACCESS(logger_ptr);
39587         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
39588         if (logger_conv.free == LDKLogger_JCalls_free) {
39589                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39590                 LDKLogger_JCalls_cloned(&logger_conv);
39591         }
39592         LDKUserConfig default_config_conv;
39593         default_config_conv.inner = untag_ptr(default_config);
39594         default_config_conv.is_owned = ptr_is_owned(default_config);
39595         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
39596         default_config_conv = UserConfig_clone(&default_config_conv);
39597         LDKCVec_ChannelMonitorZ channel_monitors_constr;
39598         channel_monitors_constr.datalen = channel_monitors->arr_len;
39599         if (channel_monitors_constr.datalen > 0)
39600                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
39601         else
39602                 channel_monitors_constr.data = NULL;
39603         uint64_t* channel_monitors_vals = channel_monitors->elems;
39604         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
39605                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
39606                 LDKChannelMonitor channel_monitors_conv_16_conv;
39607                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
39608                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
39609                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
39610                 channel_monitors_conv_16_conv.is_owned = false;
39611                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
39612         }
39613         FREE(channel_monitors);
39614         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);
39615         uint64_t ret_ref = 0;
39616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39618         return ret_ref;
39619 }
39620
39621 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_read"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
39622         LDKu8slice ser_ref;
39623         ser_ref.datalen = ser->arr_len;
39624         ser_ref.data = ser->elems;
39625         LDKChannelManagerReadArgs arg_conv;
39626         arg_conv.inner = untag_ptr(arg);
39627         arg_conv.is_owned = ptr_is_owned(arg);
39628         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39629         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
39630         
39631         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
39632         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
39633         FREE(ser);
39634         return tag_ptr(ret_conv, true);
39635 }
39636
39637 void  __attribute__((export_name("TS_DelayedPaymentBasepoint_free"))) TS_DelayedPaymentBasepoint_free(uint64_t this_obj) {
39638         LDKDelayedPaymentBasepoint this_obj_conv;
39639         this_obj_conv.inner = untag_ptr(this_obj);
39640         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39642         DelayedPaymentBasepoint_free(this_obj_conv);
39643 }
39644
39645 int8_tArray  __attribute__((export_name("TS_DelayedPaymentBasepoint_get_a"))) TS_DelayedPaymentBasepoint_get_a(uint64_t this_ptr) {
39646         LDKDelayedPaymentBasepoint this_ptr_conv;
39647         this_ptr_conv.inner = untag_ptr(this_ptr);
39648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39650         this_ptr_conv.is_owned = false;
39651         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39652         memcpy(ret_arr->elems, DelayedPaymentBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
39653         return ret_arr;
39654 }
39655
39656 void  __attribute__((export_name("TS_DelayedPaymentBasepoint_set_a"))) TS_DelayedPaymentBasepoint_set_a(uint64_t this_ptr, int8_tArray val) {
39657         LDKDelayedPaymentBasepoint this_ptr_conv;
39658         this_ptr_conv.inner = untag_ptr(this_ptr);
39659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39661         this_ptr_conv.is_owned = false;
39662         LDKPublicKey val_ref;
39663         CHECK(val->arr_len == 33);
39664         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39665         DelayedPaymentBasepoint_set_a(&this_ptr_conv, val_ref);
39666 }
39667
39668 uint64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_new"))) TS_DelayedPaymentBasepoint_new(int8_tArray a_arg) {
39669         LDKPublicKey a_arg_ref;
39670         CHECK(a_arg->arr_len == 33);
39671         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
39672         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_new(a_arg_ref);
39673         uint64_t ret_ref = 0;
39674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39676         return ret_ref;
39677 }
39678
39679 jboolean  __attribute__((export_name("TS_DelayedPaymentBasepoint_eq"))) TS_DelayedPaymentBasepoint_eq(uint64_t a, uint64_t b) {
39680         LDKDelayedPaymentBasepoint a_conv;
39681         a_conv.inner = untag_ptr(a);
39682         a_conv.is_owned = ptr_is_owned(a);
39683         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39684         a_conv.is_owned = false;
39685         LDKDelayedPaymentBasepoint b_conv;
39686         b_conv.inner = untag_ptr(b);
39687         b_conv.is_owned = ptr_is_owned(b);
39688         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39689         b_conv.is_owned = false;
39690         jboolean ret_conv = DelayedPaymentBasepoint_eq(&a_conv, &b_conv);
39691         return ret_conv;
39692 }
39693
39694 static inline uint64_t DelayedPaymentBasepoint_clone_ptr(LDKDelayedPaymentBasepoint *NONNULL_PTR arg) {
39695         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(arg);
39696         uint64_t ret_ref = 0;
39697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39699         return ret_ref;
39700 }
39701 int64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_clone_ptr"))) TS_DelayedPaymentBasepoint_clone_ptr(uint64_t arg) {
39702         LDKDelayedPaymentBasepoint arg_conv;
39703         arg_conv.inner = untag_ptr(arg);
39704         arg_conv.is_owned = ptr_is_owned(arg);
39705         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39706         arg_conv.is_owned = false;
39707         int64_t ret_conv = DelayedPaymentBasepoint_clone_ptr(&arg_conv);
39708         return ret_conv;
39709 }
39710
39711 uint64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_clone"))) TS_DelayedPaymentBasepoint_clone(uint64_t orig) {
39712         LDKDelayedPaymentBasepoint orig_conv;
39713         orig_conv.inner = untag_ptr(orig);
39714         orig_conv.is_owned = ptr_is_owned(orig);
39715         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39716         orig_conv.is_owned = false;
39717         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(&orig_conv);
39718         uint64_t ret_ref = 0;
39719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39721         return ret_ref;
39722 }
39723
39724 int64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_hash"))) TS_DelayedPaymentBasepoint_hash(uint64_t o) {
39725         LDKDelayedPaymentBasepoint o_conv;
39726         o_conv.inner = untag_ptr(o);
39727         o_conv.is_owned = ptr_is_owned(o);
39728         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39729         o_conv.is_owned = false;
39730         int64_t ret_conv = DelayedPaymentBasepoint_hash(&o_conv);
39731         return ret_conv;
39732 }
39733
39734 int8_tArray  __attribute__((export_name("TS_DelayedPaymentBasepoint_to_public_key"))) TS_DelayedPaymentBasepoint_to_public_key(uint64_t this_arg) {
39735         LDKDelayedPaymentBasepoint this_arg_conv;
39736         this_arg_conv.inner = untag_ptr(this_arg);
39737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39739         this_arg_conv.is_owned = false;
39740         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39741         memcpy(ret_arr->elems, DelayedPaymentBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
39742         return ret_arr;
39743 }
39744
39745 int8_tArray  __attribute__((export_name("TS_DelayedPaymentBasepoint_write"))) TS_DelayedPaymentBasepoint_write(uint64_t obj) {
39746         LDKDelayedPaymentBasepoint obj_conv;
39747         obj_conv.inner = untag_ptr(obj);
39748         obj_conv.is_owned = ptr_is_owned(obj);
39749         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39750         obj_conv.is_owned = false;
39751         LDKCVec_u8Z ret_var = DelayedPaymentBasepoint_write(&obj_conv);
39752         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39753         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39754         CVec_u8Z_free(ret_var);
39755         return ret_arr;
39756 }
39757
39758 uint64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_read"))) TS_DelayedPaymentBasepoint_read(int8_tArray ser) {
39759         LDKu8slice ser_ref;
39760         ser_ref.datalen = ser->arr_len;
39761         ser_ref.data = ser->elems;
39762         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
39763         *ret_conv = DelayedPaymentBasepoint_read(ser_ref);
39764         FREE(ser);
39765         return tag_ptr(ret_conv, true);
39766 }
39767
39768 void  __attribute__((export_name("TS_DelayedPaymentKey_free"))) TS_DelayedPaymentKey_free(uint64_t this_obj) {
39769         LDKDelayedPaymentKey this_obj_conv;
39770         this_obj_conv.inner = untag_ptr(this_obj);
39771         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39773         DelayedPaymentKey_free(this_obj_conv);
39774 }
39775
39776 int8_tArray  __attribute__((export_name("TS_DelayedPaymentKey_get_a"))) TS_DelayedPaymentKey_get_a(uint64_t this_ptr) {
39777         LDKDelayedPaymentKey this_ptr_conv;
39778         this_ptr_conv.inner = untag_ptr(this_ptr);
39779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39781         this_ptr_conv.is_owned = false;
39782         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39783         memcpy(ret_arr->elems, DelayedPaymentKey_get_a(&this_ptr_conv).compressed_form, 33);
39784         return ret_arr;
39785 }
39786
39787 void  __attribute__((export_name("TS_DelayedPaymentKey_set_a"))) TS_DelayedPaymentKey_set_a(uint64_t this_ptr, int8_tArray val) {
39788         LDKDelayedPaymentKey this_ptr_conv;
39789         this_ptr_conv.inner = untag_ptr(this_ptr);
39790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39792         this_ptr_conv.is_owned = false;
39793         LDKPublicKey val_ref;
39794         CHECK(val->arr_len == 33);
39795         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39796         DelayedPaymentKey_set_a(&this_ptr_conv, val_ref);
39797 }
39798
39799 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_new"))) TS_DelayedPaymentKey_new(int8_tArray a_arg) {
39800         LDKPublicKey a_arg_ref;
39801         CHECK(a_arg->arr_len == 33);
39802         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
39803         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_new(a_arg_ref);
39804         uint64_t ret_ref = 0;
39805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39807         return ret_ref;
39808 }
39809
39810 jboolean  __attribute__((export_name("TS_DelayedPaymentKey_eq"))) TS_DelayedPaymentKey_eq(uint64_t a, uint64_t b) {
39811         LDKDelayedPaymentKey a_conv;
39812         a_conv.inner = untag_ptr(a);
39813         a_conv.is_owned = ptr_is_owned(a);
39814         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39815         a_conv.is_owned = false;
39816         LDKDelayedPaymentKey b_conv;
39817         b_conv.inner = untag_ptr(b);
39818         b_conv.is_owned = ptr_is_owned(b);
39819         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39820         b_conv.is_owned = false;
39821         jboolean ret_conv = DelayedPaymentKey_eq(&a_conv, &b_conv);
39822         return ret_conv;
39823 }
39824
39825 static inline uint64_t DelayedPaymentKey_clone_ptr(LDKDelayedPaymentKey *NONNULL_PTR arg) {
39826         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(arg);
39827         uint64_t ret_ref = 0;
39828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39830         return ret_ref;
39831 }
39832 int64_t  __attribute__((export_name("TS_DelayedPaymentKey_clone_ptr"))) TS_DelayedPaymentKey_clone_ptr(uint64_t arg) {
39833         LDKDelayedPaymentKey arg_conv;
39834         arg_conv.inner = untag_ptr(arg);
39835         arg_conv.is_owned = ptr_is_owned(arg);
39836         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39837         arg_conv.is_owned = false;
39838         int64_t ret_conv = DelayedPaymentKey_clone_ptr(&arg_conv);
39839         return ret_conv;
39840 }
39841
39842 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_clone"))) TS_DelayedPaymentKey_clone(uint64_t orig) {
39843         LDKDelayedPaymentKey orig_conv;
39844         orig_conv.inner = untag_ptr(orig);
39845         orig_conv.is_owned = ptr_is_owned(orig);
39846         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39847         orig_conv.is_owned = false;
39848         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(&orig_conv);
39849         uint64_t ret_ref = 0;
39850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39852         return ret_ref;
39853 }
39854
39855 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_from_basepoint"))) TS_DelayedPaymentKey_from_basepoint(uint64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
39856         LDKDelayedPaymentBasepoint countersignatory_basepoint_conv;
39857         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
39858         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
39859         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
39860         countersignatory_basepoint_conv.is_owned = false;
39861         LDKPublicKey per_commitment_point_ref;
39862         CHECK(per_commitment_point->arr_len == 33);
39863         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
39864         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
39865         uint64_t ret_ref = 0;
39866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39868         return ret_ref;
39869 }
39870
39871 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_from_secret_key"))) TS_DelayedPaymentKey_from_secret_key(int8_tArray sk) {
39872         uint8_t sk_arr[32];
39873         CHECK(sk->arr_len == 32);
39874         memcpy(sk_arr, sk->elems, 32); FREE(sk);
39875         uint8_t (*sk_ref)[32] = &sk_arr;
39876         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_secret_key(sk_ref);
39877         uint64_t ret_ref = 0;
39878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39880         return ret_ref;
39881 }
39882
39883 int8_tArray  __attribute__((export_name("TS_DelayedPaymentKey_to_public_key"))) TS_DelayedPaymentKey_to_public_key(uint64_t this_arg) {
39884         LDKDelayedPaymentKey this_arg_conv;
39885         this_arg_conv.inner = untag_ptr(this_arg);
39886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39888         this_arg_conv.is_owned = false;
39889         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39890         memcpy(ret_arr->elems, DelayedPaymentKey_to_public_key(&this_arg_conv).compressed_form, 33);
39891         return ret_arr;
39892 }
39893
39894 int8_tArray  __attribute__((export_name("TS_DelayedPaymentKey_write"))) TS_DelayedPaymentKey_write(uint64_t obj) {
39895         LDKDelayedPaymentKey obj_conv;
39896         obj_conv.inner = untag_ptr(obj);
39897         obj_conv.is_owned = ptr_is_owned(obj);
39898         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39899         obj_conv.is_owned = false;
39900         LDKCVec_u8Z ret_var = DelayedPaymentKey_write(&obj_conv);
39901         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39902         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39903         CVec_u8Z_free(ret_var);
39904         return ret_arr;
39905 }
39906
39907 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_read"))) TS_DelayedPaymentKey_read(int8_tArray ser) {
39908         LDKu8slice ser_ref;
39909         ser_ref.datalen = ser->arr_len;
39910         ser_ref.data = ser->elems;
39911         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
39912         *ret_conv = DelayedPaymentKey_read(ser_ref);
39913         FREE(ser);
39914         return tag_ptr(ret_conv, true);
39915 }
39916
39917 void  __attribute__((export_name("TS_HtlcBasepoint_free"))) TS_HtlcBasepoint_free(uint64_t this_obj) {
39918         LDKHtlcBasepoint this_obj_conv;
39919         this_obj_conv.inner = untag_ptr(this_obj);
39920         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39922         HtlcBasepoint_free(this_obj_conv);
39923 }
39924
39925 int8_tArray  __attribute__((export_name("TS_HtlcBasepoint_get_a"))) TS_HtlcBasepoint_get_a(uint64_t this_ptr) {
39926         LDKHtlcBasepoint this_ptr_conv;
39927         this_ptr_conv.inner = untag_ptr(this_ptr);
39928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39930         this_ptr_conv.is_owned = false;
39931         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39932         memcpy(ret_arr->elems, HtlcBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
39933         return ret_arr;
39934 }
39935
39936 void  __attribute__((export_name("TS_HtlcBasepoint_set_a"))) TS_HtlcBasepoint_set_a(uint64_t this_ptr, int8_tArray val) {
39937         LDKHtlcBasepoint this_ptr_conv;
39938         this_ptr_conv.inner = untag_ptr(this_ptr);
39939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39941         this_ptr_conv.is_owned = false;
39942         LDKPublicKey val_ref;
39943         CHECK(val->arr_len == 33);
39944         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39945         HtlcBasepoint_set_a(&this_ptr_conv, val_ref);
39946 }
39947
39948 uint64_t  __attribute__((export_name("TS_HtlcBasepoint_new"))) TS_HtlcBasepoint_new(int8_tArray a_arg) {
39949         LDKPublicKey a_arg_ref;
39950         CHECK(a_arg->arr_len == 33);
39951         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
39952         LDKHtlcBasepoint ret_var = HtlcBasepoint_new(a_arg_ref);
39953         uint64_t ret_ref = 0;
39954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39956         return ret_ref;
39957 }
39958
39959 jboolean  __attribute__((export_name("TS_HtlcBasepoint_eq"))) TS_HtlcBasepoint_eq(uint64_t a, uint64_t b) {
39960         LDKHtlcBasepoint a_conv;
39961         a_conv.inner = untag_ptr(a);
39962         a_conv.is_owned = ptr_is_owned(a);
39963         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39964         a_conv.is_owned = false;
39965         LDKHtlcBasepoint b_conv;
39966         b_conv.inner = untag_ptr(b);
39967         b_conv.is_owned = ptr_is_owned(b);
39968         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39969         b_conv.is_owned = false;
39970         jboolean ret_conv = HtlcBasepoint_eq(&a_conv, &b_conv);
39971         return ret_conv;
39972 }
39973
39974 static inline uint64_t HtlcBasepoint_clone_ptr(LDKHtlcBasepoint *NONNULL_PTR arg) {
39975         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(arg);
39976         uint64_t ret_ref = 0;
39977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39979         return ret_ref;
39980 }
39981 int64_t  __attribute__((export_name("TS_HtlcBasepoint_clone_ptr"))) TS_HtlcBasepoint_clone_ptr(uint64_t arg) {
39982         LDKHtlcBasepoint arg_conv;
39983         arg_conv.inner = untag_ptr(arg);
39984         arg_conv.is_owned = ptr_is_owned(arg);
39985         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39986         arg_conv.is_owned = false;
39987         int64_t ret_conv = HtlcBasepoint_clone_ptr(&arg_conv);
39988         return ret_conv;
39989 }
39990
39991 uint64_t  __attribute__((export_name("TS_HtlcBasepoint_clone"))) TS_HtlcBasepoint_clone(uint64_t orig) {
39992         LDKHtlcBasepoint orig_conv;
39993         orig_conv.inner = untag_ptr(orig);
39994         orig_conv.is_owned = ptr_is_owned(orig);
39995         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39996         orig_conv.is_owned = false;
39997         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(&orig_conv);
39998         uint64_t ret_ref = 0;
39999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40001         return ret_ref;
40002 }
40003
40004 int64_t  __attribute__((export_name("TS_HtlcBasepoint_hash"))) TS_HtlcBasepoint_hash(uint64_t o) {
40005         LDKHtlcBasepoint o_conv;
40006         o_conv.inner = untag_ptr(o);
40007         o_conv.is_owned = ptr_is_owned(o);
40008         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40009         o_conv.is_owned = false;
40010         int64_t ret_conv = HtlcBasepoint_hash(&o_conv);
40011         return ret_conv;
40012 }
40013
40014 int8_tArray  __attribute__((export_name("TS_HtlcBasepoint_to_public_key"))) TS_HtlcBasepoint_to_public_key(uint64_t this_arg) {
40015         LDKHtlcBasepoint this_arg_conv;
40016         this_arg_conv.inner = untag_ptr(this_arg);
40017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40019         this_arg_conv.is_owned = false;
40020         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40021         memcpy(ret_arr->elems, HtlcBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
40022         return ret_arr;
40023 }
40024
40025 int8_tArray  __attribute__((export_name("TS_HtlcBasepoint_write"))) TS_HtlcBasepoint_write(uint64_t obj) {
40026         LDKHtlcBasepoint obj_conv;
40027         obj_conv.inner = untag_ptr(obj);
40028         obj_conv.is_owned = ptr_is_owned(obj);
40029         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40030         obj_conv.is_owned = false;
40031         LDKCVec_u8Z ret_var = HtlcBasepoint_write(&obj_conv);
40032         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40033         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40034         CVec_u8Z_free(ret_var);
40035         return ret_arr;
40036 }
40037
40038 uint64_t  __attribute__((export_name("TS_HtlcBasepoint_read"))) TS_HtlcBasepoint_read(int8_tArray ser) {
40039         LDKu8slice ser_ref;
40040         ser_ref.datalen = ser->arr_len;
40041         ser_ref.data = ser->elems;
40042         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
40043         *ret_conv = HtlcBasepoint_read(ser_ref);
40044         FREE(ser);
40045         return tag_ptr(ret_conv, true);
40046 }
40047
40048 void  __attribute__((export_name("TS_HtlcKey_free"))) TS_HtlcKey_free(uint64_t this_obj) {
40049         LDKHtlcKey this_obj_conv;
40050         this_obj_conv.inner = untag_ptr(this_obj);
40051         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40053         HtlcKey_free(this_obj_conv);
40054 }
40055
40056 int8_tArray  __attribute__((export_name("TS_HtlcKey_get_a"))) TS_HtlcKey_get_a(uint64_t this_ptr) {
40057         LDKHtlcKey this_ptr_conv;
40058         this_ptr_conv.inner = untag_ptr(this_ptr);
40059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40061         this_ptr_conv.is_owned = false;
40062         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40063         memcpy(ret_arr->elems, HtlcKey_get_a(&this_ptr_conv).compressed_form, 33);
40064         return ret_arr;
40065 }
40066
40067 void  __attribute__((export_name("TS_HtlcKey_set_a"))) TS_HtlcKey_set_a(uint64_t this_ptr, int8_tArray val) {
40068         LDKHtlcKey this_ptr_conv;
40069         this_ptr_conv.inner = untag_ptr(this_ptr);
40070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40072         this_ptr_conv.is_owned = false;
40073         LDKPublicKey val_ref;
40074         CHECK(val->arr_len == 33);
40075         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40076         HtlcKey_set_a(&this_ptr_conv, val_ref);
40077 }
40078
40079 uint64_t  __attribute__((export_name("TS_HtlcKey_new"))) TS_HtlcKey_new(int8_tArray a_arg) {
40080         LDKPublicKey a_arg_ref;
40081         CHECK(a_arg->arr_len == 33);
40082         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
40083         LDKHtlcKey ret_var = HtlcKey_new(a_arg_ref);
40084         uint64_t ret_ref = 0;
40085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40087         return ret_ref;
40088 }
40089
40090 jboolean  __attribute__((export_name("TS_HtlcKey_eq"))) TS_HtlcKey_eq(uint64_t a, uint64_t b) {
40091         LDKHtlcKey a_conv;
40092         a_conv.inner = untag_ptr(a);
40093         a_conv.is_owned = ptr_is_owned(a);
40094         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40095         a_conv.is_owned = false;
40096         LDKHtlcKey b_conv;
40097         b_conv.inner = untag_ptr(b);
40098         b_conv.is_owned = ptr_is_owned(b);
40099         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40100         b_conv.is_owned = false;
40101         jboolean ret_conv = HtlcKey_eq(&a_conv, &b_conv);
40102         return ret_conv;
40103 }
40104
40105 static inline uint64_t HtlcKey_clone_ptr(LDKHtlcKey *NONNULL_PTR arg) {
40106         LDKHtlcKey ret_var = HtlcKey_clone(arg);
40107         uint64_t ret_ref = 0;
40108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40110         return ret_ref;
40111 }
40112 int64_t  __attribute__((export_name("TS_HtlcKey_clone_ptr"))) TS_HtlcKey_clone_ptr(uint64_t arg) {
40113         LDKHtlcKey arg_conv;
40114         arg_conv.inner = untag_ptr(arg);
40115         arg_conv.is_owned = ptr_is_owned(arg);
40116         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40117         arg_conv.is_owned = false;
40118         int64_t ret_conv = HtlcKey_clone_ptr(&arg_conv);
40119         return ret_conv;
40120 }
40121
40122 uint64_t  __attribute__((export_name("TS_HtlcKey_clone"))) TS_HtlcKey_clone(uint64_t orig) {
40123         LDKHtlcKey orig_conv;
40124         orig_conv.inner = untag_ptr(orig);
40125         orig_conv.is_owned = ptr_is_owned(orig);
40126         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40127         orig_conv.is_owned = false;
40128         LDKHtlcKey ret_var = HtlcKey_clone(&orig_conv);
40129         uint64_t ret_ref = 0;
40130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40132         return ret_ref;
40133 }
40134
40135 uint64_t  __attribute__((export_name("TS_HtlcKey_from_basepoint"))) TS_HtlcKey_from_basepoint(uint64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
40136         LDKHtlcBasepoint countersignatory_basepoint_conv;
40137         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
40138         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
40139         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
40140         countersignatory_basepoint_conv.is_owned = false;
40141         LDKPublicKey per_commitment_point_ref;
40142         CHECK(per_commitment_point->arr_len == 33);
40143         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
40144         LDKHtlcKey ret_var = HtlcKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
40145         uint64_t ret_ref = 0;
40146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40148         return ret_ref;
40149 }
40150
40151 uint64_t  __attribute__((export_name("TS_HtlcKey_from_secret_key"))) TS_HtlcKey_from_secret_key(int8_tArray sk) {
40152         uint8_t sk_arr[32];
40153         CHECK(sk->arr_len == 32);
40154         memcpy(sk_arr, sk->elems, 32); FREE(sk);
40155         uint8_t (*sk_ref)[32] = &sk_arr;
40156         LDKHtlcKey ret_var = HtlcKey_from_secret_key(sk_ref);
40157         uint64_t ret_ref = 0;
40158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40160         return ret_ref;
40161 }
40162
40163 int8_tArray  __attribute__((export_name("TS_HtlcKey_to_public_key"))) TS_HtlcKey_to_public_key(uint64_t this_arg) {
40164         LDKHtlcKey this_arg_conv;
40165         this_arg_conv.inner = untag_ptr(this_arg);
40166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40168         this_arg_conv.is_owned = false;
40169         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40170         memcpy(ret_arr->elems, HtlcKey_to_public_key(&this_arg_conv).compressed_form, 33);
40171         return ret_arr;
40172 }
40173
40174 int8_tArray  __attribute__((export_name("TS_HtlcKey_write"))) TS_HtlcKey_write(uint64_t obj) {
40175         LDKHtlcKey obj_conv;
40176         obj_conv.inner = untag_ptr(obj);
40177         obj_conv.is_owned = ptr_is_owned(obj);
40178         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40179         obj_conv.is_owned = false;
40180         LDKCVec_u8Z ret_var = HtlcKey_write(&obj_conv);
40181         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40182         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40183         CVec_u8Z_free(ret_var);
40184         return ret_arr;
40185 }
40186
40187 uint64_t  __attribute__((export_name("TS_HtlcKey_read"))) TS_HtlcKey_read(int8_tArray ser) {
40188         LDKu8slice ser_ref;
40189         ser_ref.datalen = ser->arr_len;
40190         ser_ref.data = ser->elems;
40191         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
40192         *ret_conv = HtlcKey_read(ser_ref);
40193         FREE(ser);
40194         return tag_ptr(ret_conv, true);
40195 }
40196
40197 void  __attribute__((export_name("TS_RevocationBasepoint_free"))) TS_RevocationBasepoint_free(uint64_t this_obj) {
40198         LDKRevocationBasepoint this_obj_conv;
40199         this_obj_conv.inner = untag_ptr(this_obj);
40200         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40202         RevocationBasepoint_free(this_obj_conv);
40203 }
40204
40205 int8_tArray  __attribute__((export_name("TS_RevocationBasepoint_get_a"))) TS_RevocationBasepoint_get_a(uint64_t this_ptr) {
40206         LDKRevocationBasepoint this_ptr_conv;
40207         this_ptr_conv.inner = untag_ptr(this_ptr);
40208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40210         this_ptr_conv.is_owned = false;
40211         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40212         memcpy(ret_arr->elems, RevocationBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
40213         return ret_arr;
40214 }
40215
40216 void  __attribute__((export_name("TS_RevocationBasepoint_set_a"))) TS_RevocationBasepoint_set_a(uint64_t this_ptr, int8_tArray val) {
40217         LDKRevocationBasepoint this_ptr_conv;
40218         this_ptr_conv.inner = untag_ptr(this_ptr);
40219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40221         this_ptr_conv.is_owned = false;
40222         LDKPublicKey val_ref;
40223         CHECK(val->arr_len == 33);
40224         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40225         RevocationBasepoint_set_a(&this_ptr_conv, val_ref);
40226 }
40227
40228 uint64_t  __attribute__((export_name("TS_RevocationBasepoint_new"))) TS_RevocationBasepoint_new(int8_tArray a_arg) {
40229         LDKPublicKey a_arg_ref;
40230         CHECK(a_arg->arr_len == 33);
40231         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
40232         LDKRevocationBasepoint ret_var = RevocationBasepoint_new(a_arg_ref);
40233         uint64_t ret_ref = 0;
40234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40236         return ret_ref;
40237 }
40238
40239 jboolean  __attribute__((export_name("TS_RevocationBasepoint_eq"))) TS_RevocationBasepoint_eq(uint64_t a, uint64_t b) {
40240         LDKRevocationBasepoint a_conv;
40241         a_conv.inner = untag_ptr(a);
40242         a_conv.is_owned = ptr_is_owned(a);
40243         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40244         a_conv.is_owned = false;
40245         LDKRevocationBasepoint b_conv;
40246         b_conv.inner = untag_ptr(b);
40247         b_conv.is_owned = ptr_is_owned(b);
40248         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40249         b_conv.is_owned = false;
40250         jboolean ret_conv = RevocationBasepoint_eq(&a_conv, &b_conv);
40251         return ret_conv;
40252 }
40253
40254 static inline uint64_t RevocationBasepoint_clone_ptr(LDKRevocationBasepoint *NONNULL_PTR arg) {
40255         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(arg);
40256         uint64_t ret_ref = 0;
40257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40259         return ret_ref;
40260 }
40261 int64_t  __attribute__((export_name("TS_RevocationBasepoint_clone_ptr"))) TS_RevocationBasepoint_clone_ptr(uint64_t arg) {
40262         LDKRevocationBasepoint arg_conv;
40263         arg_conv.inner = untag_ptr(arg);
40264         arg_conv.is_owned = ptr_is_owned(arg);
40265         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40266         arg_conv.is_owned = false;
40267         int64_t ret_conv = RevocationBasepoint_clone_ptr(&arg_conv);
40268         return ret_conv;
40269 }
40270
40271 uint64_t  __attribute__((export_name("TS_RevocationBasepoint_clone"))) TS_RevocationBasepoint_clone(uint64_t orig) {
40272         LDKRevocationBasepoint orig_conv;
40273         orig_conv.inner = untag_ptr(orig);
40274         orig_conv.is_owned = ptr_is_owned(orig);
40275         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40276         orig_conv.is_owned = false;
40277         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(&orig_conv);
40278         uint64_t ret_ref = 0;
40279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40281         return ret_ref;
40282 }
40283
40284 int64_t  __attribute__((export_name("TS_RevocationBasepoint_hash"))) TS_RevocationBasepoint_hash(uint64_t o) {
40285         LDKRevocationBasepoint o_conv;
40286         o_conv.inner = untag_ptr(o);
40287         o_conv.is_owned = ptr_is_owned(o);
40288         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40289         o_conv.is_owned = false;
40290         int64_t ret_conv = RevocationBasepoint_hash(&o_conv);
40291         return ret_conv;
40292 }
40293
40294 int8_tArray  __attribute__((export_name("TS_RevocationBasepoint_to_public_key"))) TS_RevocationBasepoint_to_public_key(uint64_t this_arg) {
40295         LDKRevocationBasepoint this_arg_conv;
40296         this_arg_conv.inner = untag_ptr(this_arg);
40297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40299         this_arg_conv.is_owned = false;
40300         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40301         memcpy(ret_arr->elems, RevocationBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
40302         return ret_arr;
40303 }
40304
40305 int8_tArray  __attribute__((export_name("TS_RevocationBasepoint_write"))) TS_RevocationBasepoint_write(uint64_t obj) {
40306         LDKRevocationBasepoint obj_conv;
40307         obj_conv.inner = untag_ptr(obj);
40308         obj_conv.is_owned = ptr_is_owned(obj);
40309         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40310         obj_conv.is_owned = false;
40311         LDKCVec_u8Z ret_var = RevocationBasepoint_write(&obj_conv);
40312         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40313         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40314         CVec_u8Z_free(ret_var);
40315         return ret_arr;
40316 }
40317
40318 uint64_t  __attribute__((export_name("TS_RevocationBasepoint_read"))) TS_RevocationBasepoint_read(int8_tArray ser) {
40319         LDKu8slice ser_ref;
40320         ser_ref.datalen = ser->arr_len;
40321         ser_ref.data = ser->elems;
40322         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
40323         *ret_conv = RevocationBasepoint_read(ser_ref);
40324         FREE(ser);
40325         return tag_ptr(ret_conv, true);
40326 }
40327
40328 void  __attribute__((export_name("TS_RevocationKey_free"))) TS_RevocationKey_free(uint64_t this_obj) {
40329         LDKRevocationKey this_obj_conv;
40330         this_obj_conv.inner = untag_ptr(this_obj);
40331         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40333         RevocationKey_free(this_obj_conv);
40334 }
40335
40336 int8_tArray  __attribute__((export_name("TS_RevocationKey_get_a"))) TS_RevocationKey_get_a(uint64_t this_ptr) {
40337         LDKRevocationKey this_ptr_conv;
40338         this_ptr_conv.inner = untag_ptr(this_ptr);
40339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40341         this_ptr_conv.is_owned = false;
40342         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40343         memcpy(ret_arr->elems, RevocationKey_get_a(&this_ptr_conv).compressed_form, 33);
40344         return ret_arr;
40345 }
40346
40347 void  __attribute__((export_name("TS_RevocationKey_set_a"))) TS_RevocationKey_set_a(uint64_t this_ptr, int8_tArray val) {
40348         LDKRevocationKey this_ptr_conv;
40349         this_ptr_conv.inner = untag_ptr(this_ptr);
40350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40352         this_ptr_conv.is_owned = false;
40353         LDKPublicKey val_ref;
40354         CHECK(val->arr_len == 33);
40355         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40356         RevocationKey_set_a(&this_ptr_conv, val_ref);
40357 }
40358
40359 uint64_t  __attribute__((export_name("TS_RevocationKey_new"))) TS_RevocationKey_new(int8_tArray a_arg) {
40360         LDKPublicKey a_arg_ref;
40361         CHECK(a_arg->arr_len == 33);
40362         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
40363         LDKRevocationKey ret_var = RevocationKey_new(a_arg_ref);
40364         uint64_t ret_ref = 0;
40365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40367         return ret_ref;
40368 }
40369
40370 jboolean  __attribute__((export_name("TS_RevocationKey_eq"))) TS_RevocationKey_eq(uint64_t a, uint64_t b) {
40371         LDKRevocationKey a_conv;
40372         a_conv.inner = untag_ptr(a);
40373         a_conv.is_owned = ptr_is_owned(a);
40374         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40375         a_conv.is_owned = false;
40376         LDKRevocationKey b_conv;
40377         b_conv.inner = untag_ptr(b);
40378         b_conv.is_owned = ptr_is_owned(b);
40379         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40380         b_conv.is_owned = false;
40381         jboolean ret_conv = RevocationKey_eq(&a_conv, &b_conv);
40382         return ret_conv;
40383 }
40384
40385 static inline uint64_t RevocationKey_clone_ptr(LDKRevocationKey *NONNULL_PTR arg) {
40386         LDKRevocationKey ret_var = RevocationKey_clone(arg);
40387         uint64_t ret_ref = 0;
40388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40390         return ret_ref;
40391 }
40392 int64_t  __attribute__((export_name("TS_RevocationKey_clone_ptr"))) TS_RevocationKey_clone_ptr(uint64_t arg) {
40393         LDKRevocationKey arg_conv;
40394         arg_conv.inner = untag_ptr(arg);
40395         arg_conv.is_owned = ptr_is_owned(arg);
40396         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40397         arg_conv.is_owned = false;
40398         int64_t ret_conv = RevocationKey_clone_ptr(&arg_conv);
40399         return ret_conv;
40400 }
40401
40402 uint64_t  __attribute__((export_name("TS_RevocationKey_clone"))) TS_RevocationKey_clone(uint64_t orig) {
40403         LDKRevocationKey orig_conv;
40404         orig_conv.inner = untag_ptr(orig);
40405         orig_conv.is_owned = ptr_is_owned(orig);
40406         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40407         orig_conv.is_owned = false;
40408         LDKRevocationKey ret_var = RevocationKey_clone(&orig_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 int64_t  __attribute__((export_name("TS_RevocationKey_hash"))) TS_RevocationKey_hash(uint64_t o) {
40416         LDKRevocationKey o_conv;
40417         o_conv.inner = untag_ptr(o);
40418         o_conv.is_owned = ptr_is_owned(o);
40419         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40420         o_conv.is_owned = false;
40421         int64_t ret_conv = RevocationKey_hash(&o_conv);
40422         return ret_conv;
40423 }
40424
40425 uint64_t  __attribute__((export_name("TS_RevocationKey_from_basepoint"))) TS_RevocationKey_from_basepoint(uint64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
40426         LDKRevocationBasepoint countersignatory_basepoint_conv;
40427         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
40428         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
40429         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
40430         countersignatory_basepoint_conv.is_owned = false;
40431         LDKPublicKey per_commitment_point_ref;
40432         CHECK(per_commitment_point->arr_len == 33);
40433         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
40434         LDKRevocationKey ret_var = RevocationKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
40435         uint64_t ret_ref = 0;
40436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40438         return ret_ref;
40439 }
40440
40441 int8_tArray  __attribute__((export_name("TS_RevocationKey_to_public_key"))) TS_RevocationKey_to_public_key(uint64_t this_arg) {
40442         LDKRevocationKey this_arg_conv;
40443         this_arg_conv.inner = untag_ptr(this_arg);
40444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40446         this_arg_conv.is_owned = false;
40447         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40448         memcpy(ret_arr->elems, RevocationKey_to_public_key(&this_arg_conv).compressed_form, 33);
40449         return ret_arr;
40450 }
40451
40452 int8_tArray  __attribute__((export_name("TS_RevocationKey_write"))) TS_RevocationKey_write(uint64_t obj) {
40453         LDKRevocationKey obj_conv;
40454         obj_conv.inner = untag_ptr(obj);
40455         obj_conv.is_owned = ptr_is_owned(obj);
40456         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40457         obj_conv.is_owned = false;
40458         LDKCVec_u8Z ret_var = RevocationKey_write(&obj_conv);
40459         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40460         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40461         CVec_u8Z_free(ret_var);
40462         return ret_arr;
40463 }
40464
40465 uint64_t  __attribute__((export_name("TS_RevocationKey_read"))) TS_RevocationKey_read(int8_tArray ser) {
40466         LDKu8slice ser_ref;
40467         ser_ref.datalen = ser->arr_len;
40468         ser_ref.data = ser->elems;
40469         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
40470         *ret_conv = RevocationKey_read(ser_ref);
40471         FREE(ser);
40472         return tag_ptr(ret_conv, true);
40473 }
40474
40475 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
40476         LDKExpandedKey this_obj_conv;
40477         this_obj_conv.inner = untag_ptr(this_obj);
40478         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40480         ExpandedKey_free(this_obj_conv);
40481 }
40482
40483 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
40484         uint8_t key_material_arr[32];
40485         CHECK(key_material->arr_len == 32);
40486         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
40487         uint8_t (*key_material_ref)[32] = &key_material_arr;
40488         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
40489         uint64_t ret_ref = 0;
40490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40492         return ret_ref;
40493 }
40494
40495 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) {
40496         LDKExpandedKey keys_conv;
40497         keys_conv.inner = untag_ptr(keys);
40498         keys_conv.is_owned = ptr_is_owned(keys);
40499         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
40500         keys_conv.is_owned = false;
40501         void* min_value_msat_ptr = untag_ptr(min_value_msat);
40502         CHECK_ACCESS(min_value_msat_ptr);
40503         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
40504         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
40505         void* entropy_source_ptr = untag_ptr(entropy_source);
40506         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
40507         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
40508         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
40509         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
40510         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
40511         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
40512         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
40513         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
40514         return tag_ptr(ret_conv, true);
40515 }
40516
40517 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) {
40518         LDKExpandedKey keys_conv;
40519         keys_conv.inner = untag_ptr(keys);
40520         keys_conv.is_owned = ptr_is_owned(keys);
40521         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
40522         keys_conv.is_owned = false;
40523         void* min_value_msat_ptr = untag_ptr(min_value_msat);
40524         CHECK_ACCESS(min_value_msat_ptr);
40525         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
40526         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
40527         LDKThirtyTwoBytes payment_hash_ref;
40528         CHECK(payment_hash->arr_len == 32);
40529         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
40530         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
40531         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
40532         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
40533         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
40534         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
40535         *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);
40536         return tag_ptr(ret_conv, true);
40537 }
40538
40539 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
40540         if (!ptr_is_owned(this_ptr)) return;
40541         void* this_ptr_ptr = untag_ptr(this_ptr);
40542         CHECK_ACCESS(this_ptr_ptr);
40543         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
40544         FREE(untag_ptr(this_ptr));
40545         DecodeError_free(this_ptr_conv);
40546 }
40547
40548 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
40549         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40550         *ret_copy = DecodeError_clone(arg);
40551         uint64_t ret_ref = tag_ptr(ret_copy, true);
40552         return ret_ref;
40553 }
40554 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
40555         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
40556         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
40557         return ret_conv;
40558 }
40559
40560 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
40561         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
40562         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40563         *ret_copy = DecodeError_clone(orig_conv);
40564         uint64_t ret_ref = tag_ptr(ret_copy, true);
40565         return ret_ref;
40566 }
40567
40568 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
40569         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40570         *ret_copy = DecodeError_unknown_version();
40571         uint64_t ret_ref = tag_ptr(ret_copy, true);
40572         return ret_ref;
40573 }
40574
40575 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
40576         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40577         *ret_copy = DecodeError_unknown_required_feature();
40578         uint64_t ret_ref = tag_ptr(ret_copy, true);
40579         return ret_ref;
40580 }
40581
40582 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
40583         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40584         *ret_copy = DecodeError_invalid_value();
40585         uint64_t ret_ref = tag_ptr(ret_copy, true);
40586         return ret_ref;
40587 }
40588
40589 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
40590         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40591         *ret_copy = DecodeError_short_read();
40592         uint64_t ret_ref = tag_ptr(ret_copy, true);
40593         return ret_ref;
40594 }
40595
40596 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
40597         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40598         *ret_copy = DecodeError_bad_length_descriptor();
40599         uint64_t ret_ref = tag_ptr(ret_copy, true);
40600         return ret_ref;
40601 }
40602
40603 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
40604         LDKIOError a_conv = LDKIOError_from_js(a);
40605         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40606         *ret_copy = DecodeError_io(a_conv);
40607         uint64_t ret_ref = tag_ptr(ret_copy, true);
40608         return ret_ref;
40609 }
40610
40611 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
40612         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40613         *ret_copy = DecodeError_unsupported_compression();
40614         uint64_t ret_ref = tag_ptr(ret_copy, true);
40615         return ret_ref;
40616 }
40617
40618 int64_t  __attribute__((export_name("TS_DecodeError_hash"))) TS_DecodeError_hash(uint64_t o) {
40619         LDKDecodeError* o_conv = (LDKDecodeError*)untag_ptr(o);
40620         int64_t ret_conv = DecodeError_hash(o_conv);
40621         return ret_conv;
40622 }
40623
40624 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
40625         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
40626         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
40627         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
40628         return ret_conv;
40629 }
40630
40631 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
40632         LDKInit this_obj_conv;
40633         this_obj_conv.inner = untag_ptr(this_obj);
40634         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40636         Init_free(this_obj_conv);
40637 }
40638
40639 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
40640         LDKInit this_ptr_conv;
40641         this_ptr_conv.inner = untag_ptr(this_ptr);
40642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40644         this_ptr_conv.is_owned = false;
40645         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
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
40652 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
40653         LDKInit this_ptr_conv;
40654         this_ptr_conv.inner = untag_ptr(this_ptr);
40655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40657         this_ptr_conv.is_owned = false;
40658         LDKInitFeatures val_conv;
40659         val_conv.inner = untag_ptr(val);
40660         val_conv.is_owned = ptr_is_owned(val);
40661         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40662         val_conv = InitFeatures_clone(&val_conv);
40663         Init_set_features(&this_ptr_conv, val_conv);
40664 }
40665
40666 uint64_t  __attribute__((export_name("TS_Init_get_networks"))) TS_Init_get_networks(uint64_t this_ptr) {
40667         LDKInit this_ptr_conv;
40668         this_ptr_conv.inner = untag_ptr(this_ptr);
40669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40671         this_ptr_conv.is_owned = false;
40672         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
40673         *ret_copy = Init_get_networks(&this_ptr_conv);
40674         uint64_t ret_ref = tag_ptr(ret_copy, true);
40675         return ret_ref;
40676 }
40677
40678 void  __attribute__((export_name("TS_Init_set_networks"))) TS_Init_set_networks(uint64_t this_ptr, uint64_t val) {
40679         LDKInit this_ptr_conv;
40680         this_ptr_conv.inner = untag_ptr(this_ptr);
40681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40683         this_ptr_conv.is_owned = false;
40684         void* val_ptr = untag_ptr(val);
40685         CHECK_ACCESS(val_ptr);
40686         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
40687         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
40688         Init_set_networks(&this_ptr_conv, val_conv);
40689 }
40690
40691 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
40692         LDKInit this_ptr_conv;
40693         this_ptr_conv.inner = untag_ptr(this_ptr);
40694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40696         this_ptr_conv.is_owned = false;
40697         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
40698         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
40699         uint64_t ret_ref = tag_ptr(ret_copy, true);
40700         return ret_ref;
40701 }
40702
40703 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
40704         LDKInit this_ptr_conv;
40705         this_ptr_conv.inner = untag_ptr(this_ptr);
40706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40708         this_ptr_conv.is_owned = false;
40709         void* val_ptr = untag_ptr(val);
40710         CHECK_ACCESS(val_ptr);
40711         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
40712         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
40713         Init_set_remote_network_address(&this_ptr_conv, val_conv);
40714 }
40715
40716 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) {
40717         LDKInitFeatures features_arg_conv;
40718         features_arg_conv.inner = untag_ptr(features_arg);
40719         features_arg_conv.is_owned = ptr_is_owned(features_arg);
40720         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
40721         features_arg_conv = InitFeatures_clone(&features_arg_conv);
40722         void* networks_arg_ptr = untag_ptr(networks_arg);
40723         CHECK_ACCESS(networks_arg_ptr);
40724         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
40725         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
40726         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
40727         CHECK_ACCESS(remote_network_address_arg_ptr);
40728         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
40729         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
40730         uint64_t ret_ref = 0;
40731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40733         return ret_ref;
40734 }
40735
40736 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
40737         LDKInit ret_var = Init_clone(arg);
40738         uint64_t ret_ref = 0;
40739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40741         return ret_ref;
40742 }
40743 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
40744         LDKInit arg_conv;
40745         arg_conv.inner = untag_ptr(arg);
40746         arg_conv.is_owned = ptr_is_owned(arg);
40747         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40748         arg_conv.is_owned = false;
40749         int64_t ret_conv = Init_clone_ptr(&arg_conv);
40750         return ret_conv;
40751 }
40752
40753 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
40754         LDKInit orig_conv;
40755         orig_conv.inner = untag_ptr(orig);
40756         orig_conv.is_owned = ptr_is_owned(orig);
40757         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40758         orig_conv.is_owned = false;
40759         LDKInit ret_var = Init_clone(&orig_conv);
40760         uint64_t ret_ref = 0;
40761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40763         return ret_ref;
40764 }
40765
40766 int64_t  __attribute__((export_name("TS_Init_hash"))) TS_Init_hash(uint64_t o) {
40767         LDKInit o_conv;
40768         o_conv.inner = untag_ptr(o);
40769         o_conv.is_owned = ptr_is_owned(o);
40770         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40771         o_conv.is_owned = false;
40772         int64_t ret_conv = Init_hash(&o_conv);
40773         return ret_conv;
40774 }
40775
40776 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
40777         LDKInit a_conv;
40778         a_conv.inner = untag_ptr(a);
40779         a_conv.is_owned = ptr_is_owned(a);
40780         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40781         a_conv.is_owned = false;
40782         LDKInit b_conv;
40783         b_conv.inner = untag_ptr(b);
40784         b_conv.is_owned = ptr_is_owned(b);
40785         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40786         b_conv.is_owned = false;
40787         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
40788         return ret_conv;
40789 }
40790
40791 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
40792         LDKErrorMessage this_obj_conv;
40793         this_obj_conv.inner = untag_ptr(this_obj);
40794         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40796         ErrorMessage_free(this_obj_conv);
40797 }
40798
40799 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
40800         LDKErrorMessage this_ptr_conv;
40801         this_ptr_conv.inner = untag_ptr(this_ptr);
40802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40804         this_ptr_conv.is_owned = false;
40805         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40806         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
40807         return ret_arr;
40808 }
40809
40810 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40811         LDKErrorMessage this_ptr_conv;
40812         this_ptr_conv.inner = untag_ptr(this_ptr);
40813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40815         this_ptr_conv.is_owned = false;
40816         LDKThirtyTwoBytes val_ref;
40817         CHECK(val->arr_len == 32);
40818         memcpy(val_ref.data, val->elems, 32); FREE(val);
40819         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
40820 }
40821
40822 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
40823         LDKErrorMessage this_ptr_conv;
40824         this_ptr_conv.inner = untag_ptr(this_ptr);
40825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40827         this_ptr_conv.is_owned = false;
40828         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
40829         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
40830         Str_free(ret_str);
40831         return ret_conv;
40832 }
40833
40834 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
40835         LDKErrorMessage this_ptr_conv;
40836         this_ptr_conv.inner = untag_ptr(this_ptr);
40837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40839         this_ptr_conv.is_owned = false;
40840         LDKStr val_conv = str_ref_to_owned_c(val);
40841         ErrorMessage_set_data(&this_ptr_conv, val_conv);
40842 }
40843
40844 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
40845         LDKThirtyTwoBytes channel_id_arg_ref;
40846         CHECK(channel_id_arg->arr_len == 32);
40847         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40848         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
40849         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
40850         uint64_t ret_ref = 0;
40851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40853         return ret_ref;
40854 }
40855
40856 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
40857         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
40858         uint64_t ret_ref = 0;
40859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40861         return ret_ref;
40862 }
40863 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
40864         LDKErrorMessage arg_conv;
40865         arg_conv.inner = untag_ptr(arg);
40866         arg_conv.is_owned = ptr_is_owned(arg);
40867         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40868         arg_conv.is_owned = false;
40869         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
40870         return ret_conv;
40871 }
40872
40873 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
40874         LDKErrorMessage orig_conv;
40875         orig_conv.inner = untag_ptr(orig);
40876         orig_conv.is_owned = ptr_is_owned(orig);
40877         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40878         orig_conv.is_owned = false;
40879         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
40880         uint64_t ret_ref = 0;
40881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40883         return ret_ref;
40884 }
40885
40886 int64_t  __attribute__((export_name("TS_ErrorMessage_hash"))) TS_ErrorMessage_hash(uint64_t o) {
40887         LDKErrorMessage o_conv;
40888         o_conv.inner = untag_ptr(o);
40889         o_conv.is_owned = ptr_is_owned(o);
40890         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40891         o_conv.is_owned = false;
40892         int64_t ret_conv = ErrorMessage_hash(&o_conv);
40893         return ret_conv;
40894 }
40895
40896 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
40897         LDKErrorMessage a_conv;
40898         a_conv.inner = untag_ptr(a);
40899         a_conv.is_owned = ptr_is_owned(a);
40900         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40901         a_conv.is_owned = false;
40902         LDKErrorMessage b_conv;
40903         b_conv.inner = untag_ptr(b);
40904         b_conv.is_owned = ptr_is_owned(b);
40905         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40906         b_conv.is_owned = false;
40907         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
40908         return ret_conv;
40909 }
40910
40911 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
40912         LDKWarningMessage this_obj_conv;
40913         this_obj_conv.inner = untag_ptr(this_obj);
40914         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40916         WarningMessage_free(this_obj_conv);
40917 }
40918
40919 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
40920         LDKWarningMessage this_ptr_conv;
40921         this_ptr_conv.inner = untag_ptr(this_ptr);
40922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40924         this_ptr_conv.is_owned = false;
40925         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40926         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
40927         return ret_arr;
40928 }
40929
40930 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40931         LDKWarningMessage this_ptr_conv;
40932         this_ptr_conv.inner = untag_ptr(this_ptr);
40933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40935         this_ptr_conv.is_owned = false;
40936         LDKThirtyTwoBytes val_ref;
40937         CHECK(val->arr_len == 32);
40938         memcpy(val_ref.data, val->elems, 32); FREE(val);
40939         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
40940 }
40941
40942 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
40943         LDKWarningMessage this_ptr_conv;
40944         this_ptr_conv.inner = untag_ptr(this_ptr);
40945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40947         this_ptr_conv.is_owned = false;
40948         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
40949         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
40950         Str_free(ret_str);
40951         return ret_conv;
40952 }
40953
40954 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
40955         LDKWarningMessage this_ptr_conv;
40956         this_ptr_conv.inner = untag_ptr(this_ptr);
40957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40959         this_ptr_conv.is_owned = false;
40960         LDKStr val_conv = str_ref_to_owned_c(val);
40961         WarningMessage_set_data(&this_ptr_conv, val_conv);
40962 }
40963
40964 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
40965         LDKThirtyTwoBytes channel_id_arg_ref;
40966         CHECK(channel_id_arg->arr_len == 32);
40967         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40968         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
40969         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
40970         uint64_t ret_ref = 0;
40971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40973         return ret_ref;
40974 }
40975
40976 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
40977         LDKWarningMessage ret_var = WarningMessage_clone(arg);
40978         uint64_t ret_ref = 0;
40979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40981         return ret_ref;
40982 }
40983 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
40984         LDKWarningMessage arg_conv;
40985         arg_conv.inner = untag_ptr(arg);
40986         arg_conv.is_owned = ptr_is_owned(arg);
40987         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40988         arg_conv.is_owned = false;
40989         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
40990         return ret_conv;
40991 }
40992
40993 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
40994         LDKWarningMessage orig_conv;
40995         orig_conv.inner = untag_ptr(orig);
40996         orig_conv.is_owned = ptr_is_owned(orig);
40997         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40998         orig_conv.is_owned = false;
40999         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
41000         uint64_t ret_ref = 0;
41001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41003         return ret_ref;
41004 }
41005
41006 int64_t  __attribute__((export_name("TS_WarningMessage_hash"))) TS_WarningMessage_hash(uint64_t o) {
41007         LDKWarningMessage o_conv;
41008         o_conv.inner = untag_ptr(o);
41009         o_conv.is_owned = ptr_is_owned(o);
41010         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41011         o_conv.is_owned = false;
41012         int64_t ret_conv = WarningMessage_hash(&o_conv);
41013         return ret_conv;
41014 }
41015
41016 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
41017         LDKWarningMessage a_conv;
41018         a_conv.inner = untag_ptr(a);
41019         a_conv.is_owned = ptr_is_owned(a);
41020         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41021         a_conv.is_owned = false;
41022         LDKWarningMessage b_conv;
41023         b_conv.inner = untag_ptr(b);
41024         b_conv.is_owned = ptr_is_owned(b);
41025         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41026         b_conv.is_owned = false;
41027         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
41028         return ret_conv;
41029 }
41030
41031 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
41032         LDKPing this_obj_conv;
41033         this_obj_conv.inner = untag_ptr(this_obj);
41034         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41036         Ping_free(this_obj_conv);
41037 }
41038
41039 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
41040         LDKPing this_ptr_conv;
41041         this_ptr_conv.inner = untag_ptr(this_ptr);
41042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41044         this_ptr_conv.is_owned = false;
41045         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
41046         return ret_conv;
41047 }
41048
41049 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
41050         LDKPing this_ptr_conv;
41051         this_ptr_conv.inner = untag_ptr(this_ptr);
41052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41054         this_ptr_conv.is_owned = false;
41055         Ping_set_ponglen(&this_ptr_conv, val);
41056 }
41057
41058 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
41059         LDKPing this_ptr_conv;
41060         this_ptr_conv.inner = untag_ptr(this_ptr);
41061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41063         this_ptr_conv.is_owned = false;
41064         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
41065         return ret_conv;
41066 }
41067
41068 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
41069         LDKPing this_ptr_conv;
41070         this_ptr_conv.inner = untag_ptr(this_ptr);
41071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41073         this_ptr_conv.is_owned = false;
41074         Ping_set_byteslen(&this_ptr_conv, val);
41075 }
41076
41077 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
41078         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
41079         uint64_t ret_ref = 0;
41080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41082         return ret_ref;
41083 }
41084
41085 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
41086         LDKPing ret_var = Ping_clone(arg);
41087         uint64_t ret_ref = 0;
41088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41090         return ret_ref;
41091 }
41092 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
41093         LDKPing arg_conv;
41094         arg_conv.inner = untag_ptr(arg);
41095         arg_conv.is_owned = ptr_is_owned(arg);
41096         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41097         arg_conv.is_owned = false;
41098         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
41099         return ret_conv;
41100 }
41101
41102 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
41103         LDKPing orig_conv;
41104         orig_conv.inner = untag_ptr(orig);
41105         orig_conv.is_owned = ptr_is_owned(orig);
41106         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41107         orig_conv.is_owned = false;
41108         LDKPing ret_var = Ping_clone(&orig_conv);
41109         uint64_t ret_ref = 0;
41110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41112         return ret_ref;
41113 }
41114
41115 int64_t  __attribute__((export_name("TS_Ping_hash"))) TS_Ping_hash(uint64_t o) {
41116         LDKPing o_conv;
41117         o_conv.inner = untag_ptr(o);
41118         o_conv.is_owned = ptr_is_owned(o);
41119         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41120         o_conv.is_owned = false;
41121         int64_t ret_conv = Ping_hash(&o_conv);
41122         return ret_conv;
41123 }
41124
41125 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
41126         LDKPing a_conv;
41127         a_conv.inner = untag_ptr(a);
41128         a_conv.is_owned = ptr_is_owned(a);
41129         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41130         a_conv.is_owned = false;
41131         LDKPing b_conv;
41132         b_conv.inner = untag_ptr(b);
41133         b_conv.is_owned = ptr_is_owned(b);
41134         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41135         b_conv.is_owned = false;
41136         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
41137         return ret_conv;
41138 }
41139
41140 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
41141         LDKPong this_obj_conv;
41142         this_obj_conv.inner = untag_ptr(this_obj);
41143         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41145         Pong_free(this_obj_conv);
41146 }
41147
41148 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
41149         LDKPong this_ptr_conv;
41150         this_ptr_conv.inner = untag_ptr(this_ptr);
41151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41153         this_ptr_conv.is_owned = false;
41154         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
41155         return ret_conv;
41156 }
41157
41158 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
41159         LDKPong this_ptr_conv;
41160         this_ptr_conv.inner = untag_ptr(this_ptr);
41161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41163         this_ptr_conv.is_owned = false;
41164         Pong_set_byteslen(&this_ptr_conv, val);
41165 }
41166
41167 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
41168         LDKPong ret_var = Pong_new(byteslen_arg);
41169         uint64_t ret_ref = 0;
41170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41172         return ret_ref;
41173 }
41174
41175 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
41176         LDKPong ret_var = Pong_clone(arg);
41177         uint64_t ret_ref = 0;
41178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41180         return ret_ref;
41181 }
41182 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
41183         LDKPong arg_conv;
41184         arg_conv.inner = untag_ptr(arg);
41185         arg_conv.is_owned = ptr_is_owned(arg);
41186         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41187         arg_conv.is_owned = false;
41188         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
41189         return ret_conv;
41190 }
41191
41192 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
41193         LDKPong orig_conv;
41194         orig_conv.inner = untag_ptr(orig);
41195         orig_conv.is_owned = ptr_is_owned(orig);
41196         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41197         orig_conv.is_owned = false;
41198         LDKPong ret_var = Pong_clone(&orig_conv);
41199         uint64_t ret_ref = 0;
41200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41202         return ret_ref;
41203 }
41204
41205 int64_t  __attribute__((export_name("TS_Pong_hash"))) TS_Pong_hash(uint64_t o) {
41206         LDKPong o_conv;
41207         o_conv.inner = untag_ptr(o);
41208         o_conv.is_owned = ptr_is_owned(o);
41209         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41210         o_conv.is_owned = false;
41211         int64_t ret_conv = Pong_hash(&o_conv);
41212         return ret_conv;
41213 }
41214
41215 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
41216         LDKPong a_conv;
41217         a_conv.inner = untag_ptr(a);
41218         a_conv.is_owned = ptr_is_owned(a);
41219         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41220         a_conv.is_owned = false;
41221         LDKPong b_conv;
41222         b_conv.inner = untag_ptr(b);
41223         b_conv.is_owned = ptr_is_owned(b);
41224         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41225         b_conv.is_owned = false;
41226         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
41227         return ret_conv;
41228 }
41229
41230 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
41231         LDKOpenChannel this_obj_conv;
41232         this_obj_conv.inner = untag_ptr(this_obj);
41233         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41235         OpenChannel_free(this_obj_conv);
41236 }
41237
41238 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
41239         LDKOpenChannel this_ptr_conv;
41240         this_ptr_conv.inner = untag_ptr(this_ptr);
41241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41243         this_ptr_conv.is_owned = false;
41244         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41245         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
41246         return ret_arr;
41247 }
41248
41249 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
41250         LDKOpenChannel this_ptr_conv;
41251         this_ptr_conv.inner = untag_ptr(this_ptr);
41252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41254         this_ptr_conv.is_owned = false;
41255         LDKThirtyTwoBytes val_ref;
41256         CHECK(val->arr_len == 32);
41257         memcpy(val_ref.data, val->elems, 32); FREE(val);
41258         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
41259 }
41260
41261 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
41262         LDKOpenChannel 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41268         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
41269         return ret_arr;
41270 }
41271
41272 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
41273         LDKOpenChannel this_ptr_conv;
41274         this_ptr_conv.inner = untag_ptr(this_ptr);
41275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41277         this_ptr_conv.is_owned = false;
41278         LDKThirtyTwoBytes val_ref;
41279         CHECK(val->arr_len == 32);
41280         memcpy(val_ref.data, val->elems, 32); FREE(val);
41281         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
41282 }
41283
41284 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
41285         LDKOpenChannel this_ptr_conv;
41286         this_ptr_conv.inner = untag_ptr(this_ptr);
41287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41289         this_ptr_conv.is_owned = false;
41290         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
41291         return ret_conv;
41292 }
41293
41294 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
41295         LDKOpenChannel this_ptr_conv;
41296         this_ptr_conv.inner = untag_ptr(this_ptr);
41297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41299         this_ptr_conv.is_owned = false;
41300         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
41301 }
41302
41303 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
41304         LDKOpenChannel this_ptr_conv;
41305         this_ptr_conv.inner = untag_ptr(this_ptr);
41306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41308         this_ptr_conv.is_owned = false;
41309         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
41310         return ret_conv;
41311 }
41312
41313 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
41314         LDKOpenChannel this_ptr_conv;
41315         this_ptr_conv.inner = untag_ptr(this_ptr);
41316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41318         this_ptr_conv.is_owned = false;
41319         OpenChannel_set_push_msat(&this_ptr_conv, val);
41320 }
41321
41322 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
41323         LDKOpenChannel this_ptr_conv;
41324         this_ptr_conv.inner = untag_ptr(this_ptr);
41325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41327         this_ptr_conv.is_owned = false;
41328         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
41329         return ret_conv;
41330 }
41331
41332 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
41333         LDKOpenChannel this_ptr_conv;
41334         this_ptr_conv.inner = untag_ptr(this_ptr);
41335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41337         this_ptr_conv.is_owned = false;
41338         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
41339 }
41340
41341 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) {
41342         LDKOpenChannel this_ptr_conv;
41343         this_ptr_conv.inner = untag_ptr(this_ptr);
41344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41346         this_ptr_conv.is_owned = false;
41347         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
41348         return ret_conv;
41349 }
41350
41351 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) {
41352         LDKOpenChannel this_ptr_conv;
41353         this_ptr_conv.inner = untag_ptr(this_ptr);
41354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41356         this_ptr_conv.is_owned = false;
41357         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
41358 }
41359
41360 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
41361         LDKOpenChannel this_ptr_conv;
41362         this_ptr_conv.inner = untag_ptr(this_ptr);
41363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41365         this_ptr_conv.is_owned = false;
41366         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
41367         return ret_conv;
41368 }
41369
41370 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
41371         LDKOpenChannel this_ptr_conv;
41372         this_ptr_conv.inner = untag_ptr(this_ptr);
41373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41375         this_ptr_conv.is_owned = false;
41376         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
41377 }
41378
41379 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
41380         LDKOpenChannel this_ptr_conv;
41381         this_ptr_conv.inner = untag_ptr(this_ptr);
41382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41384         this_ptr_conv.is_owned = false;
41385         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
41386         return ret_conv;
41387 }
41388
41389 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
41390         LDKOpenChannel this_ptr_conv;
41391         this_ptr_conv.inner = untag_ptr(this_ptr);
41392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41394         this_ptr_conv.is_owned = false;
41395         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
41396 }
41397
41398 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
41399         LDKOpenChannel this_ptr_conv;
41400         this_ptr_conv.inner = untag_ptr(this_ptr);
41401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41403         this_ptr_conv.is_owned = false;
41404         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
41405         return ret_conv;
41406 }
41407
41408 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
41409         LDKOpenChannel this_ptr_conv;
41410         this_ptr_conv.inner = untag_ptr(this_ptr);
41411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41413         this_ptr_conv.is_owned = false;
41414         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
41415 }
41416
41417 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
41418         LDKOpenChannel this_ptr_conv;
41419         this_ptr_conv.inner = untag_ptr(this_ptr);
41420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41422         this_ptr_conv.is_owned = false;
41423         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
41424         return ret_conv;
41425 }
41426
41427 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
41428         LDKOpenChannel this_ptr_conv;
41429         this_ptr_conv.inner = untag_ptr(this_ptr);
41430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41432         this_ptr_conv.is_owned = false;
41433         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
41434 }
41435
41436 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
41437         LDKOpenChannel this_ptr_conv;
41438         this_ptr_conv.inner = untag_ptr(this_ptr);
41439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41441         this_ptr_conv.is_owned = false;
41442         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
41443         return ret_conv;
41444 }
41445
41446 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
41447         LDKOpenChannel this_ptr_conv;
41448         this_ptr_conv.inner = untag_ptr(this_ptr);
41449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41451         this_ptr_conv.is_owned = false;
41452         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
41453 }
41454
41455 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
41456         LDKOpenChannel this_ptr_conv;
41457         this_ptr_conv.inner = untag_ptr(this_ptr);
41458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41460         this_ptr_conv.is_owned = false;
41461         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41462         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
41463         return ret_arr;
41464 }
41465
41466 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
41467         LDKOpenChannel this_ptr_conv;
41468         this_ptr_conv.inner = untag_ptr(this_ptr);
41469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41471         this_ptr_conv.is_owned = false;
41472         LDKPublicKey val_ref;
41473         CHECK(val->arr_len == 33);
41474         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41475         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
41476 }
41477
41478 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
41479         LDKOpenChannel this_ptr_conv;
41480         this_ptr_conv.inner = untag_ptr(this_ptr);
41481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41483         this_ptr_conv.is_owned = false;
41484         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41485         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
41486         return ret_arr;
41487 }
41488
41489 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
41490         LDKOpenChannel this_ptr_conv;
41491         this_ptr_conv.inner = untag_ptr(this_ptr);
41492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41494         this_ptr_conv.is_owned = false;
41495         LDKPublicKey val_ref;
41496         CHECK(val->arr_len == 33);
41497         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41498         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
41499 }
41500
41501 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
41502         LDKOpenChannel this_ptr_conv;
41503         this_ptr_conv.inner = untag_ptr(this_ptr);
41504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41506         this_ptr_conv.is_owned = false;
41507         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41508         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
41509         return ret_arr;
41510 }
41511
41512 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
41513         LDKOpenChannel 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         LDKPublicKey val_ref;
41519         CHECK(val->arr_len == 33);
41520         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41521         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
41522 }
41523
41524 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
41525         LDKOpenChannel this_ptr_conv;
41526         this_ptr_conv.inner = untag_ptr(this_ptr);
41527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41529         this_ptr_conv.is_owned = false;
41530         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41531         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
41532         return ret_arr;
41533 }
41534
41535 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
41536         LDKOpenChannel 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         LDKPublicKey val_ref;
41542         CHECK(val->arr_len == 33);
41543         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41544         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
41545 }
41546
41547 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
41548         LDKOpenChannel this_ptr_conv;
41549         this_ptr_conv.inner = untag_ptr(this_ptr);
41550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41552         this_ptr_conv.is_owned = false;
41553         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41554         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
41555         return ret_arr;
41556 }
41557
41558 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
41559         LDKOpenChannel this_ptr_conv;
41560         this_ptr_conv.inner = untag_ptr(this_ptr);
41561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41563         this_ptr_conv.is_owned = false;
41564         LDKPublicKey val_ref;
41565         CHECK(val->arr_len == 33);
41566         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41567         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
41568 }
41569
41570 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
41571         LDKOpenChannel this_ptr_conv;
41572         this_ptr_conv.inner = untag_ptr(this_ptr);
41573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41575         this_ptr_conv.is_owned = false;
41576         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41577         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
41578         return ret_arr;
41579 }
41580
41581 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) {
41582         LDKOpenChannel this_ptr_conv;
41583         this_ptr_conv.inner = untag_ptr(this_ptr);
41584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41586         this_ptr_conv.is_owned = false;
41587         LDKPublicKey val_ref;
41588         CHECK(val->arr_len == 33);
41589         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41590         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
41591 }
41592
41593 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
41594         LDKOpenChannel this_ptr_conv;
41595         this_ptr_conv.inner = untag_ptr(this_ptr);
41596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41598         this_ptr_conv.is_owned = false;
41599         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
41600         return ret_conv;
41601 }
41602
41603 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
41604         LDKOpenChannel this_ptr_conv;
41605         this_ptr_conv.inner = untag_ptr(this_ptr);
41606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41608         this_ptr_conv.is_owned = false;
41609         OpenChannel_set_channel_flags(&this_ptr_conv, val);
41610 }
41611
41612 uint64_t  __attribute__((export_name("TS_OpenChannel_get_shutdown_scriptpubkey"))) TS_OpenChannel_get_shutdown_scriptpubkey(uint64_t this_ptr) {
41613         LDKOpenChannel this_ptr_conv;
41614         this_ptr_conv.inner = untag_ptr(this_ptr);
41615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41617         this_ptr_conv.is_owned = false;
41618         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
41619         *ret_copy = OpenChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
41620         uint64_t ret_ref = tag_ptr(ret_copy, true);
41621         return ret_ref;
41622 }
41623
41624 void  __attribute__((export_name("TS_OpenChannel_set_shutdown_scriptpubkey"))) TS_OpenChannel_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
41625         LDKOpenChannel this_ptr_conv;
41626         this_ptr_conv.inner = untag_ptr(this_ptr);
41627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41629         this_ptr_conv.is_owned = false;
41630         void* val_ptr = untag_ptr(val);
41631         CHECK_ACCESS(val_ptr);
41632         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
41633         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
41634         OpenChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
41635 }
41636
41637 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
41638         LDKOpenChannel 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         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
41644         uint64_t ret_ref = 0;
41645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41647         return ret_ref;
41648 }
41649
41650 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
41651         LDKOpenChannel this_ptr_conv;
41652         this_ptr_conv.inner = untag_ptr(this_ptr);
41653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41655         this_ptr_conv.is_owned = false;
41656         LDKChannelTypeFeatures val_conv;
41657         val_conv.inner = untag_ptr(val);
41658         val_conv.is_owned = ptr_is_owned(val);
41659         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41660         val_conv = ChannelTypeFeatures_clone(&val_conv);
41661         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
41662 }
41663
41664 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) {
41665         LDKThirtyTwoBytes chain_hash_arg_ref;
41666         CHECK(chain_hash_arg->arr_len == 32);
41667         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
41668         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
41669         CHECK(temporary_channel_id_arg->arr_len == 32);
41670         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
41671         LDKPublicKey funding_pubkey_arg_ref;
41672         CHECK(funding_pubkey_arg->arr_len == 33);
41673         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
41674         LDKPublicKey revocation_basepoint_arg_ref;
41675         CHECK(revocation_basepoint_arg->arr_len == 33);
41676         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
41677         LDKPublicKey payment_point_arg_ref;
41678         CHECK(payment_point_arg->arr_len == 33);
41679         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
41680         LDKPublicKey delayed_payment_basepoint_arg_ref;
41681         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
41682         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
41683         LDKPublicKey htlc_basepoint_arg_ref;
41684         CHECK(htlc_basepoint_arg->arr_len == 33);
41685         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
41686         LDKPublicKey first_per_commitment_point_arg_ref;
41687         CHECK(first_per_commitment_point_arg->arr_len == 33);
41688         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
41689         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
41690         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
41691         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
41692         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
41693         LDKChannelTypeFeatures channel_type_arg_conv;
41694         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
41695         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
41696         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
41697         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
41698         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);
41699         uint64_t ret_ref = 0;
41700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41702         return ret_ref;
41703 }
41704
41705 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
41706         LDKOpenChannel ret_var = OpenChannel_clone(arg);
41707         uint64_t ret_ref = 0;
41708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41710         return ret_ref;
41711 }
41712 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
41713         LDKOpenChannel arg_conv;
41714         arg_conv.inner = untag_ptr(arg);
41715         arg_conv.is_owned = ptr_is_owned(arg);
41716         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41717         arg_conv.is_owned = false;
41718         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
41719         return ret_conv;
41720 }
41721
41722 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
41723         LDKOpenChannel orig_conv;
41724         orig_conv.inner = untag_ptr(orig);
41725         orig_conv.is_owned = ptr_is_owned(orig);
41726         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41727         orig_conv.is_owned = false;
41728         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
41729         uint64_t ret_ref = 0;
41730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41732         return ret_ref;
41733 }
41734
41735 int64_t  __attribute__((export_name("TS_OpenChannel_hash"))) TS_OpenChannel_hash(uint64_t o) {
41736         LDKOpenChannel o_conv;
41737         o_conv.inner = untag_ptr(o);
41738         o_conv.is_owned = ptr_is_owned(o);
41739         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41740         o_conv.is_owned = false;
41741         int64_t ret_conv = OpenChannel_hash(&o_conv);
41742         return ret_conv;
41743 }
41744
41745 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
41746         LDKOpenChannel a_conv;
41747         a_conv.inner = untag_ptr(a);
41748         a_conv.is_owned = ptr_is_owned(a);
41749         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41750         a_conv.is_owned = false;
41751         LDKOpenChannel b_conv;
41752         b_conv.inner = untag_ptr(b);
41753         b_conv.is_owned = ptr_is_owned(b);
41754         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41755         b_conv.is_owned = false;
41756         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
41757         return ret_conv;
41758 }
41759
41760 void  __attribute__((export_name("TS_OpenChannelV2_free"))) TS_OpenChannelV2_free(uint64_t this_obj) {
41761         LDKOpenChannelV2 this_obj_conv;
41762         this_obj_conv.inner = untag_ptr(this_obj);
41763         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41765         OpenChannelV2_free(this_obj_conv);
41766 }
41767
41768 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_chain_hash"))) TS_OpenChannelV2_get_chain_hash(uint64_t this_ptr) {
41769         LDKOpenChannelV2 this_ptr_conv;
41770         this_ptr_conv.inner = untag_ptr(this_ptr);
41771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41773         this_ptr_conv.is_owned = false;
41774         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41775         memcpy(ret_arr->elems, *OpenChannelV2_get_chain_hash(&this_ptr_conv), 32);
41776         return ret_arr;
41777 }
41778
41779 void  __attribute__((export_name("TS_OpenChannelV2_set_chain_hash"))) TS_OpenChannelV2_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
41780         LDKOpenChannelV2 this_ptr_conv;
41781         this_ptr_conv.inner = untag_ptr(this_ptr);
41782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41784         this_ptr_conv.is_owned = false;
41785         LDKThirtyTwoBytes val_ref;
41786         CHECK(val->arr_len == 32);
41787         memcpy(val_ref.data, val->elems, 32); FREE(val);
41788         OpenChannelV2_set_chain_hash(&this_ptr_conv, val_ref);
41789 }
41790
41791 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_temporary_channel_id"))) TS_OpenChannelV2_get_temporary_channel_id(uint64_t this_ptr) {
41792         LDKOpenChannelV2 this_ptr_conv;
41793         this_ptr_conv.inner = untag_ptr(this_ptr);
41794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41796         this_ptr_conv.is_owned = false;
41797         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41798         memcpy(ret_arr->elems, *OpenChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
41799         return ret_arr;
41800 }
41801
41802 void  __attribute__((export_name("TS_OpenChannelV2_set_temporary_channel_id"))) TS_OpenChannelV2_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
41803         LDKOpenChannelV2 this_ptr_conv;
41804         this_ptr_conv.inner = untag_ptr(this_ptr);
41805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41807         this_ptr_conv.is_owned = false;
41808         LDKThirtyTwoBytes val_ref;
41809         CHECK(val->arr_len == 32);
41810         memcpy(val_ref.data, val->elems, 32); FREE(val);
41811         OpenChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
41812 }
41813
41814 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) {
41815         LDKOpenChannelV2 this_ptr_conv;
41816         this_ptr_conv.inner = untag_ptr(this_ptr);
41817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41819         this_ptr_conv.is_owned = false;
41820         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
41821         return ret_conv;
41822 }
41823
41824 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) {
41825         LDKOpenChannelV2 this_ptr_conv;
41826         this_ptr_conv.inner = untag_ptr(this_ptr);
41827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41829         this_ptr_conv.is_owned = false;
41830         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
41831 }
41832
41833 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) {
41834         LDKOpenChannelV2 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         int32_t ret_conv = OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
41840         return ret_conv;
41841 }
41842
41843 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) {
41844         LDKOpenChannelV2 this_ptr_conv;
41845         this_ptr_conv.inner = untag_ptr(this_ptr);
41846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41848         this_ptr_conv.is_owned = false;
41849         OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
41850 }
41851
41852 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_funding_satoshis"))) TS_OpenChannelV2_get_funding_satoshis(uint64_t this_ptr) {
41853         LDKOpenChannelV2 this_ptr_conv;
41854         this_ptr_conv.inner = untag_ptr(this_ptr);
41855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41857         this_ptr_conv.is_owned = false;
41858         int64_t ret_conv = OpenChannelV2_get_funding_satoshis(&this_ptr_conv);
41859         return ret_conv;
41860 }
41861
41862 void  __attribute__((export_name("TS_OpenChannelV2_set_funding_satoshis"))) TS_OpenChannelV2_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
41863         LDKOpenChannelV2 this_ptr_conv;
41864         this_ptr_conv.inner = untag_ptr(this_ptr);
41865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41867         this_ptr_conv.is_owned = false;
41868         OpenChannelV2_set_funding_satoshis(&this_ptr_conv, val);
41869 }
41870
41871 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_dust_limit_satoshis"))) TS_OpenChannelV2_get_dust_limit_satoshis(uint64_t this_ptr) {
41872         LDKOpenChannelV2 this_ptr_conv;
41873         this_ptr_conv.inner = untag_ptr(this_ptr);
41874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41876         this_ptr_conv.is_owned = false;
41877         int64_t ret_conv = OpenChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
41878         return ret_conv;
41879 }
41880
41881 void  __attribute__((export_name("TS_OpenChannelV2_set_dust_limit_satoshis"))) TS_OpenChannelV2_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
41882         LDKOpenChannelV2 this_ptr_conv;
41883         this_ptr_conv.inner = untag_ptr(this_ptr);
41884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41886         this_ptr_conv.is_owned = false;
41887         OpenChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
41888 }
41889
41890 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) {
41891         LDKOpenChannelV2 this_ptr_conv;
41892         this_ptr_conv.inner = untag_ptr(this_ptr);
41893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41895         this_ptr_conv.is_owned = false;
41896         int64_t ret_conv = OpenChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
41897         return ret_conv;
41898 }
41899
41900 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) {
41901         LDKOpenChannelV2 this_ptr_conv;
41902         this_ptr_conv.inner = untag_ptr(this_ptr);
41903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41905         this_ptr_conv.is_owned = false;
41906         OpenChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
41907 }
41908
41909 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_htlc_minimum_msat"))) TS_OpenChannelV2_get_htlc_minimum_msat(uint64_t this_ptr) {
41910         LDKOpenChannelV2 this_ptr_conv;
41911         this_ptr_conv.inner = untag_ptr(this_ptr);
41912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41914         this_ptr_conv.is_owned = false;
41915         int64_t ret_conv = OpenChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
41916         return ret_conv;
41917 }
41918
41919 void  __attribute__((export_name("TS_OpenChannelV2_set_htlc_minimum_msat"))) TS_OpenChannelV2_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
41920         LDKOpenChannelV2 this_ptr_conv;
41921         this_ptr_conv.inner = untag_ptr(this_ptr);
41922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41924         this_ptr_conv.is_owned = false;
41925         OpenChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
41926 }
41927
41928 int16_t  __attribute__((export_name("TS_OpenChannelV2_get_to_self_delay"))) TS_OpenChannelV2_get_to_self_delay(uint64_t this_ptr) {
41929         LDKOpenChannelV2 this_ptr_conv;
41930         this_ptr_conv.inner = untag_ptr(this_ptr);
41931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41933         this_ptr_conv.is_owned = false;
41934         int16_t ret_conv = OpenChannelV2_get_to_self_delay(&this_ptr_conv);
41935         return ret_conv;
41936 }
41937
41938 void  __attribute__((export_name("TS_OpenChannelV2_set_to_self_delay"))) TS_OpenChannelV2_set_to_self_delay(uint64_t this_ptr, int16_t val) {
41939         LDKOpenChannelV2 this_ptr_conv;
41940         this_ptr_conv.inner = untag_ptr(this_ptr);
41941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41943         this_ptr_conv.is_owned = false;
41944         OpenChannelV2_set_to_self_delay(&this_ptr_conv, val);
41945 }
41946
41947 int16_t  __attribute__((export_name("TS_OpenChannelV2_get_max_accepted_htlcs"))) TS_OpenChannelV2_get_max_accepted_htlcs(uint64_t this_ptr) {
41948         LDKOpenChannelV2 this_ptr_conv;
41949         this_ptr_conv.inner = untag_ptr(this_ptr);
41950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41952         this_ptr_conv.is_owned = false;
41953         int16_t ret_conv = OpenChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
41954         return ret_conv;
41955 }
41956
41957 void  __attribute__((export_name("TS_OpenChannelV2_set_max_accepted_htlcs"))) TS_OpenChannelV2_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
41958         LDKOpenChannelV2 this_ptr_conv;
41959         this_ptr_conv.inner = untag_ptr(this_ptr);
41960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41962         this_ptr_conv.is_owned = false;
41963         OpenChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
41964 }
41965
41966 int32_t  __attribute__((export_name("TS_OpenChannelV2_get_locktime"))) TS_OpenChannelV2_get_locktime(uint64_t this_ptr) {
41967         LDKOpenChannelV2 this_ptr_conv;
41968         this_ptr_conv.inner = untag_ptr(this_ptr);
41969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41971         this_ptr_conv.is_owned = false;
41972         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
41973         return ret_conv;
41974 }
41975
41976 void  __attribute__((export_name("TS_OpenChannelV2_set_locktime"))) TS_OpenChannelV2_set_locktime(uint64_t this_ptr, int32_t val) {
41977         LDKOpenChannelV2 this_ptr_conv;
41978         this_ptr_conv.inner = untag_ptr(this_ptr);
41979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41981         this_ptr_conv.is_owned = false;
41982         OpenChannelV2_set_locktime(&this_ptr_conv, val);
41983 }
41984
41985 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_funding_pubkey"))) TS_OpenChannelV2_get_funding_pubkey(uint64_t this_ptr) {
41986         LDKOpenChannelV2 this_ptr_conv;
41987         this_ptr_conv.inner = untag_ptr(this_ptr);
41988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41990         this_ptr_conv.is_owned = false;
41991         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41992         memcpy(ret_arr->elems, OpenChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
41993         return ret_arr;
41994 }
41995
41996 void  __attribute__((export_name("TS_OpenChannelV2_set_funding_pubkey"))) TS_OpenChannelV2_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
41997         LDKOpenChannelV2 this_ptr_conv;
41998         this_ptr_conv.inner = untag_ptr(this_ptr);
41999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42001         this_ptr_conv.is_owned = false;
42002         LDKPublicKey val_ref;
42003         CHECK(val->arr_len == 33);
42004         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42005         OpenChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
42006 }
42007
42008 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_revocation_basepoint"))) TS_OpenChannelV2_get_revocation_basepoint(uint64_t this_ptr) {
42009         LDKOpenChannelV2 this_ptr_conv;
42010         this_ptr_conv.inner = untag_ptr(this_ptr);
42011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42013         this_ptr_conv.is_owned = false;
42014         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42015         memcpy(ret_arr->elems, OpenChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
42016         return ret_arr;
42017 }
42018
42019 void  __attribute__((export_name("TS_OpenChannelV2_set_revocation_basepoint"))) TS_OpenChannelV2_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
42020         LDKOpenChannelV2 this_ptr_conv;
42021         this_ptr_conv.inner = untag_ptr(this_ptr);
42022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42024         this_ptr_conv.is_owned = false;
42025         LDKPublicKey val_ref;
42026         CHECK(val->arr_len == 33);
42027         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42028         OpenChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
42029 }
42030
42031 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_payment_basepoint"))) TS_OpenChannelV2_get_payment_basepoint(uint64_t this_ptr) {
42032         LDKOpenChannelV2 this_ptr_conv;
42033         this_ptr_conv.inner = untag_ptr(this_ptr);
42034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42036         this_ptr_conv.is_owned = false;
42037         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42038         memcpy(ret_arr->elems, OpenChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
42039         return ret_arr;
42040 }
42041
42042 void  __attribute__((export_name("TS_OpenChannelV2_set_payment_basepoint"))) TS_OpenChannelV2_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
42043         LDKOpenChannelV2 this_ptr_conv;
42044         this_ptr_conv.inner = untag_ptr(this_ptr);
42045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42047         this_ptr_conv.is_owned = false;
42048         LDKPublicKey val_ref;
42049         CHECK(val->arr_len == 33);
42050         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42051         OpenChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
42052 }
42053
42054 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_delayed_payment_basepoint"))) TS_OpenChannelV2_get_delayed_payment_basepoint(uint64_t this_ptr) {
42055         LDKOpenChannelV2 this_ptr_conv;
42056         this_ptr_conv.inner = untag_ptr(this_ptr);
42057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42059         this_ptr_conv.is_owned = false;
42060         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42061         memcpy(ret_arr->elems, OpenChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
42062         return ret_arr;
42063 }
42064
42065 void  __attribute__((export_name("TS_OpenChannelV2_set_delayed_payment_basepoint"))) TS_OpenChannelV2_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
42066         LDKOpenChannelV2 this_ptr_conv;
42067         this_ptr_conv.inner = untag_ptr(this_ptr);
42068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42070         this_ptr_conv.is_owned = false;
42071         LDKPublicKey val_ref;
42072         CHECK(val->arr_len == 33);
42073         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42074         OpenChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
42075 }
42076
42077 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_htlc_basepoint"))) TS_OpenChannelV2_get_htlc_basepoint(uint64_t this_ptr) {
42078         LDKOpenChannelV2 this_ptr_conv;
42079         this_ptr_conv.inner = untag_ptr(this_ptr);
42080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42082         this_ptr_conv.is_owned = false;
42083         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42084         memcpy(ret_arr->elems, OpenChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
42085         return ret_arr;
42086 }
42087
42088 void  __attribute__((export_name("TS_OpenChannelV2_set_htlc_basepoint"))) TS_OpenChannelV2_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
42089         LDKOpenChannelV2 this_ptr_conv;
42090         this_ptr_conv.inner = untag_ptr(this_ptr);
42091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42093         this_ptr_conv.is_owned = false;
42094         LDKPublicKey val_ref;
42095         CHECK(val->arr_len == 33);
42096         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42097         OpenChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
42098 }
42099
42100 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_first_per_commitment_point"))) TS_OpenChannelV2_get_first_per_commitment_point(uint64_t this_ptr) {
42101         LDKOpenChannelV2 this_ptr_conv;
42102         this_ptr_conv.inner = untag_ptr(this_ptr);
42103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42105         this_ptr_conv.is_owned = false;
42106         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42107         memcpy(ret_arr->elems, OpenChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
42108         return ret_arr;
42109 }
42110
42111 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) {
42112         LDKOpenChannelV2 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         LDKPublicKey val_ref;
42118         CHECK(val->arr_len == 33);
42119         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42120         OpenChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
42121 }
42122
42123 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_second_per_commitment_point"))) TS_OpenChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
42124         LDKOpenChannelV2 this_ptr_conv;
42125         this_ptr_conv.inner = untag_ptr(this_ptr);
42126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42128         this_ptr_conv.is_owned = false;
42129         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42130         memcpy(ret_arr->elems, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
42131         return ret_arr;
42132 }
42133
42134 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) {
42135         LDKOpenChannelV2 this_ptr_conv;
42136         this_ptr_conv.inner = untag_ptr(this_ptr);
42137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42139         this_ptr_conv.is_owned = false;
42140         LDKPublicKey val_ref;
42141         CHECK(val->arr_len == 33);
42142         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42143         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
42144 }
42145
42146 int8_t  __attribute__((export_name("TS_OpenChannelV2_get_channel_flags"))) TS_OpenChannelV2_get_channel_flags(uint64_t this_ptr) {
42147         LDKOpenChannelV2 this_ptr_conv;
42148         this_ptr_conv.inner = untag_ptr(this_ptr);
42149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42151         this_ptr_conv.is_owned = false;
42152         int8_t ret_conv = OpenChannelV2_get_channel_flags(&this_ptr_conv);
42153         return ret_conv;
42154 }
42155
42156 void  __attribute__((export_name("TS_OpenChannelV2_set_channel_flags"))) TS_OpenChannelV2_set_channel_flags(uint64_t this_ptr, int8_t val) {
42157         LDKOpenChannelV2 this_ptr_conv;
42158         this_ptr_conv.inner = untag_ptr(this_ptr);
42159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42161         this_ptr_conv.is_owned = false;
42162         OpenChannelV2_set_channel_flags(&this_ptr_conv, val);
42163 }
42164
42165 uint64_t  __attribute__((export_name("TS_OpenChannelV2_get_shutdown_scriptpubkey"))) TS_OpenChannelV2_get_shutdown_scriptpubkey(uint64_t this_ptr) {
42166         LDKOpenChannelV2 this_ptr_conv;
42167         this_ptr_conv.inner = untag_ptr(this_ptr);
42168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42170         this_ptr_conv.is_owned = false;
42171         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
42172         *ret_copy = OpenChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
42173         uint64_t ret_ref = tag_ptr(ret_copy, true);
42174         return ret_ref;
42175 }
42176
42177 void  __attribute__((export_name("TS_OpenChannelV2_set_shutdown_scriptpubkey"))) TS_OpenChannelV2_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
42178         LDKOpenChannelV2 this_ptr_conv;
42179         this_ptr_conv.inner = untag_ptr(this_ptr);
42180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42182         this_ptr_conv.is_owned = false;
42183         void* val_ptr = untag_ptr(val);
42184         CHECK_ACCESS(val_ptr);
42185         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
42186         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
42187         OpenChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
42188 }
42189
42190 uint64_t  __attribute__((export_name("TS_OpenChannelV2_get_channel_type"))) TS_OpenChannelV2_get_channel_type(uint64_t this_ptr) {
42191         LDKOpenChannelV2 this_ptr_conv;
42192         this_ptr_conv.inner = untag_ptr(this_ptr);
42193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42195         this_ptr_conv.is_owned = false;
42196         LDKChannelTypeFeatures ret_var = OpenChannelV2_get_channel_type(&this_ptr_conv);
42197         uint64_t ret_ref = 0;
42198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42200         return ret_ref;
42201 }
42202
42203 void  __attribute__((export_name("TS_OpenChannelV2_set_channel_type"))) TS_OpenChannelV2_set_channel_type(uint64_t this_ptr, uint64_t val) {
42204         LDKOpenChannelV2 this_ptr_conv;
42205         this_ptr_conv.inner = untag_ptr(this_ptr);
42206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42208         this_ptr_conv.is_owned = false;
42209         LDKChannelTypeFeatures val_conv;
42210         val_conv.inner = untag_ptr(val);
42211         val_conv.is_owned = ptr_is_owned(val);
42212         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42213         val_conv = ChannelTypeFeatures_clone(&val_conv);
42214         OpenChannelV2_set_channel_type(&this_ptr_conv, val_conv);
42215 }
42216
42217 uint32_t  __attribute__((export_name("TS_OpenChannelV2_get_require_confirmed_inputs"))) TS_OpenChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
42218         LDKOpenChannelV2 this_ptr_conv;
42219         this_ptr_conv.inner = untag_ptr(this_ptr);
42220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42222         this_ptr_conv.is_owned = false;
42223         uint32_t ret_conv = LDKCOption_NoneZ_to_js(OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
42224         return ret_conv;
42225 }
42226
42227 void  __attribute__((export_name("TS_OpenChannelV2_set_require_confirmed_inputs"))) TS_OpenChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
42228         LDKOpenChannelV2 this_ptr_conv;
42229         this_ptr_conv.inner = untag_ptr(this_ptr);
42230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42232         this_ptr_conv.is_owned = false;
42233         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
42234         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
42235 }
42236
42237 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) {
42238         LDKThirtyTwoBytes chain_hash_arg_ref;
42239         CHECK(chain_hash_arg->arr_len == 32);
42240         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
42241         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
42242         CHECK(temporary_channel_id_arg->arr_len == 32);
42243         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
42244         LDKPublicKey funding_pubkey_arg_ref;
42245         CHECK(funding_pubkey_arg->arr_len == 33);
42246         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
42247         LDKPublicKey revocation_basepoint_arg_ref;
42248         CHECK(revocation_basepoint_arg->arr_len == 33);
42249         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
42250         LDKPublicKey payment_basepoint_arg_ref;
42251         CHECK(payment_basepoint_arg->arr_len == 33);
42252         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
42253         LDKPublicKey delayed_payment_basepoint_arg_ref;
42254         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
42255         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
42256         LDKPublicKey htlc_basepoint_arg_ref;
42257         CHECK(htlc_basepoint_arg->arr_len == 33);
42258         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
42259         LDKPublicKey first_per_commitment_point_arg_ref;
42260         CHECK(first_per_commitment_point_arg->arr_len == 33);
42261         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
42262         LDKPublicKey second_per_commitment_point_arg_ref;
42263         CHECK(second_per_commitment_point_arg->arr_len == 33);
42264         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
42265         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
42266         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
42267         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
42268         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
42269         LDKChannelTypeFeatures channel_type_arg_conv;
42270         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
42271         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
42272         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
42273         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
42274         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
42275         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);
42276         uint64_t ret_ref = 0;
42277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42279         return ret_ref;
42280 }
42281
42282 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
42283         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
42284         uint64_t ret_ref = 0;
42285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42287         return ret_ref;
42288 }
42289 int64_t  __attribute__((export_name("TS_OpenChannelV2_clone_ptr"))) TS_OpenChannelV2_clone_ptr(uint64_t arg) {
42290         LDKOpenChannelV2 arg_conv;
42291         arg_conv.inner = untag_ptr(arg);
42292         arg_conv.is_owned = ptr_is_owned(arg);
42293         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42294         arg_conv.is_owned = false;
42295         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
42296         return ret_conv;
42297 }
42298
42299 uint64_t  __attribute__((export_name("TS_OpenChannelV2_clone"))) TS_OpenChannelV2_clone(uint64_t orig) {
42300         LDKOpenChannelV2 orig_conv;
42301         orig_conv.inner = untag_ptr(orig);
42302         orig_conv.is_owned = ptr_is_owned(orig);
42303         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42304         orig_conv.is_owned = false;
42305         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
42306         uint64_t ret_ref = 0;
42307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42309         return ret_ref;
42310 }
42311
42312 int64_t  __attribute__((export_name("TS_OpenChannelV2_hash"))) TS_OpenChannelV2_hash(uint64_t o) {
42313         LDKOpenChannelV2 o_conv;
42314         o_conv.inner = untag_ptr(o);
42315         o_conv.is_owned = ptr_is_owned(o);
42316         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42317         o_conv.is_owned = false;
42318         int64_t ret_conv = OpenChannelV2_hash(&o_conv);
42319         return ret_conv;
42320 }
42321
42322 jboolean  __attribute__((export_name("TS_OpenChannelV2_eq"))) TS_OpenChannelV2_eq(uint64_t a, uint64_t b) {
42323         LDKOpenChannelV2 a_conv;
42324         a_conv.inner = untag_ptr(a);
42325         a_conv.is_owned = ptr_is_owned(a);
42326         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42327         a_conv.is_owned = false;
42328         LDKOpenChannelV2 b_conv;
42329         b_conv.inner = untag_ptr(b);
42330         b_conv.is_owned = ptr_is_owned(b);
42331         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42332         b_conv.is_owned = false;
42333         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
42334         return ret_conv;
42335 }
42336
42337 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
42338         LDKAcceptChannel this_obj_conv;
42339         this_obj_conv.inner = untag_ptr(this_obj);
42340         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42342         AcceptChannel_free(this_obj_conv);
42343 }
42344
42345 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
42346         LDKAcceptChannel this_ptr_conv;
42347         this_ptr_conv.inner = untag_ptr(this_ptr);
42348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42350         this_ptr_conv.is_owned = false;
42351         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42352         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
42353         return ret_arr;
42354 }
42355
42356 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
42357         LDKAcceptChannel this_ptr_conv;
42358         this_ptr_conv.inner = untag_ptr(this_ptr);
42359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42361         this_ptr_conv.is_owned = false;
42362         LDKThirtyTwoBytes val_ref;
42363         CHECK(val->arr_len == 32);
42364         memcpy(val_ref.data, val->elems, 32); FREE(val);
42365         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
42366 }
42367
42368 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
42369         LDKAcceptChannel this_ptr_conv;
42370         this_ptr_conv.inner = untag_ptr(this_ptr);
42371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42373         this_ptr_conv.is_owned = false;
42374         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
42375         return ret_conv;
42376 }
42377
42378 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
42379         LDKAcceptChannel this_ptr_conv;
42380         this_ptr_conv.inner = untag_ptr(this_ptr);
42381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42383         this_ptr_conv.is_owned = false;
42384         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
42385 }
42386
42387 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) {
42388         LDKAcceptChannel this_ptr_conv;
42389         this_ptr_conv.inner = untag_ptr(this_ptr);
42390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42392         this_ptr_conv.is_owned = false;
42393         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
42394         return ret_conv;
42395 }
42396
42397 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) {
42398         LDKAcceptChannel this_ptr_conv;
42399         this_ptr_conv.inner = untag_ptr(this_ptr);
42400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42402         this_ptr_conv.is_owned = false;
42403         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
42404 }
42405
42406 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
42407         LDKAcceptChannel this_ptr_conv;
42408         this_ptr_conv.inner = untag_ptr(this_ptr);
42409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42411         this_ptr_conv.is_owned = false;
42412         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
42413         return ret_conv;
42414 }
42415
42416 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
42417         LDKAcceptChannel this_ptr_conv;
42418         this_ptr_conv.inner = untag_ptr(this_ptr);
42419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42421         this_ptr_conv.is_owned = false;
42422         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
42423 }
42424
42425 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
42426         LDKAcceptChannel this_ptr_conv;
42427         this_ptr_conv.inner = untag_ptr(this_ptr);
42428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42430         this_ptr_conv.is_owned = false;
42431         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
42432         return ret_conv;
42433 }
42434
42435 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
42436         LDKAcceptChannel this_ptr_conv;
42437         this_ptr_conv.inner = untag_ptr(this_ptr);
42438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42440         this_ptr_conv.is_owned = false;
42441         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
42442 }
42443
42444 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
42445         LDKAcceptChannel this_ptr_conv;
42446         this_ptr_conv.inner = untag_ptr(this_ptr);
42447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42449         this_ptr_conv.is_owned = false;
42450         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
42451         return ret_conv;
42452 }
42453
42454 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
42455         LDKAcceptChannel this_ptr_conv;
42456         this_ptr_conv.inner = untag_ptr(this_ptr);
42457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42459         this_ptr_conv.is_owned = false;
42460         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
42461 }
42462
42463 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
42464         LDKAcceptChannel this_ptr_conv;
42465         this_ptr_conv.inner = untag_ptr(this_ptr);
42466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42468         this_ptr_conv.is_owned = false;
42469         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
42470         return ret_conv;
42471 }
42472
42473 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
42474         LDKAcceptChannel this_ptr_conv;
42475         this_ptr_conv.inner = untag_ptr(this_ptr);
42476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42478         this_ptr_conv.is_owned = false;
42479         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
42480 }
42481
42482 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
42483         LDKAcceptChannel this_ptr_conv;
42484         this_ptr_conv.inner = untag_ptr(this_ptr);
42485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42487         this_ptr_conv.is_owned = false;
42488         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
42489         return ret_conv;
42490 }
42491
42492 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
42493         LDKAcceptChannel this_ptr_conv;
42494         this_ptr_conv.inner = untag_ptr(this_ptr);
42495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42497         this_ptr_conv.is_owned = false;
42498         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
42499 }
42500
42501 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
42502         LDKAcceptChannel this_ptr_conv;
42503         this_ptr_conv.inner = untag_ptr(this_ptr);
42504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42506         this_ptr_conv.is_owned = false;
42507         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42508         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
42509         return ret_arr;
42510 }
42511
42512 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
42513         LDKAcceptChannel this_ptr_conv;
42514         this_ptr_conv.inner = untag_ptr(this_ptr);
42515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42517         this_ptr_conv.is_owned = false;
42518         LDKPublicKey val_ref;
42519         CHECK(val->arr_len == 33);
42520         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42521         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
42522 }
42523
42524 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
42525         LDKAcceptChannel this_ptr_conv;
42526         this_ptr_conv.inner = untag_ptr(this_ptr);
42527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42529         this_ptr_conv.is_owned = false;
42530         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42531         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
42532         return ret_arr;
42533 }
42534
42535 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
42536         LDKAcceptChannel this_ptr_conv;
42537         this_ptr_conv.inner = untag_ptr(this_ptr);
42538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42540         this_ptr_conv.is_owned = false;
42541         LDKPublicKey val_ref;
42542         CHECK(val->arr_len == 33);
42543         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42544         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
42545 }
42546
42547 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
42548         LDKAcceptChannel this_ptr_conv;
42549         this_ptr_conv.inner = untag_ptr(this_ptr);
42550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42552         this_ptr_conv.is_owned = false;
42553         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42554         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
42555         return ret_arr;
42556 }
42557
42558 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
42559         LDKAcceptChannel this_ptr_conv;
42560         this_ptr_conv.inner = untag_ptr(this_ptr);
42561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42563         this_ptr_conv.is_owned = false;
42564         LDKPublicKey val_ref;
42565         CHECK(val->arr_len == 33);
42566         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42567         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
42568 }
42569
42570 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
42571         LDKAcceptChannel this_ptr_conv;
42572         this_ptr_conv.inner = untag_ptr(this_ptr);
42573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42575         this_ptr_conv.is_owned = false;
42576         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42577         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
42578         return ret_arr;
42579 }
42580
42581 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
42582         LDKAcceptChannel this_ptr_conv;
42583         this_ptr_conv.inner = untag_ptr(this_ptr);
42584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42586         this_ptr_conv.is_owned = false;
42587         LDKPublicKey val_ref;
42588         CHECK(val->arr_len == 33);
42589         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42590         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
42591 }
42592
42593 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
42594         LDKAcceptChannel 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42600         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
42601         return ret_arr;
42602 }
42603
42604 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
42605         LDKAcceptChannel this_ptr_conv;
42606         this_ptr_conv.inner = untag_ptr(this_ptr);
42607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42609         this_ptr_conv.is_owned = false;
42610         LDKPublicKey val_ref;
42611         CHECK(val->arr_len == 33);
42612         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42613         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
42614 }
42615
42616 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
42617         LDKAcceptChannel this_ptr_conv;
42618         this_ptr_conv.inner = untag_ptr(this_ptr);
42619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42621         this_ptr_conv.is_owned = false;
42622         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42623         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
42624         return ret_arr;
42625 }
42626
42627 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) {
42628         LDKAcceptChannel this_ptr_conv;
42629         this_ptr_conv.inner = untag_ptr(this_ptr);
42630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42632         this_ptr_conv.is_owned = false;
42633         LDKPublicKey val_ref;
42634         CHECK(val->arr_len == 33);
42635         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42636         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
42637 }
42638
42639 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_shutdown_scriptpubkey"))) TS_AcceptChannel_get_shutdown_scriptpubkey(uint64_t this_ptr) {
42640         LDKAcceptChannel this_ptr_conv;
42641         this_ptr_conv.inner = untag_ptr(this_ptr);
42642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42644         this_ptr_conv.is_owned = false;
42645         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
42646         *ret_copy = AcceptChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
42647         uint64_t ret_ref = tag_ptr(ret_copy, true);
42648         return ret_ref;
42649 }
42650
42651 void  __attribute__((export_name("TS_AcceptChannel_set_shutdown_scriptpubkey"))) TS_AcceptChannel_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
42652         LDKAcceptChannel this_ptr_conv;
42653         this_ptr_conv.inner = untag_ptr(this_ptr);
42654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42656         this_ptr_conv.is_owned = false;
42657         void* val_ptr = untag_ptr(val);
42658         CHECK_ACCESS(val_ptr);
42659         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
42660         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
42661         AcceptChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
42662 }
42663
42664 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
42665         LDKAcceptChannel this_ptr_conv;
42666         this_ptr_conv.inner = untag_ptr(this_ptr);
42667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42669         this_ptr_conv.is_owned = false;
42670         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
42671         uint64_t ret_ref = 0;
42672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42674         return ret_ref;
42675 }
42676
42677 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
42678         LDKAcceptChannel this_ptr_conv;
42679         this_ptr_conv.inner = untag_ptr(this_ptr);
42680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42682         this_ptr_conv.is_owned = false;
42683         LDKChannelTypeFeatures val_conv;
42684         val_conv.inner = untag_ptr(val);
42685         val_conv.is_owned = ptr_is_owned(val);
42686         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42687         val_conv = ChannelTypeFeatures_clone(&val_conv);
42688         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
42689 }
42690
42691 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) {
42692         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
42693         CHECK(temporary_channel_id_arg->arr_len == 32);
42694         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
42695         LDKPublicKey funding_pubkey_arg_ref;
42696         CHECK(funding_pubkey_arg->arr_len == 33);
42697         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
42698         LDKPublicKey revocation_basepoint_arg_ref;
42699         CHECK(revocation_basepoint_arg->arr_len == 33);
42700         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
42701         LDKPublicKey payment_point_arg_ref;
42702         CHECK(payment_point_arg->arr_len == 33);
42703         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
42704         LDKPublicKey delayed_payment_basepoint_arg_ref;
42705         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
42706         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
42707         LDKPublicKey htlc_basepoint_arg_ref;
42708         CHECK(htlc_basepoint_arg->arr_len == 33);
42709         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
42710         LDKPublicKey first_per_commitment_point_arg_ref;
42711         CHECK(first_per_commitment_point_arg->arr_len == 33);
42712         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
42713         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
42714         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
42715         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
42716         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
42717         LDKChannelTypeFeatures channel_type_arg_conv;
42718         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
42719         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
42720         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
42721         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
42722         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);
42723         uint64_t ret_ref = 0;
42724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42726         return ret_ref;
42727 }
42728
42729 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
42730         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
42731         uint64_t ret_ref = 0;
42732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42734         return ret_ref;
42735 }
42736 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
42737         LDKAcceptChannel arg_conv;
42738         arg_conv.inner = untag_ptr(arg);
42739         arg_conv.is_owned = ptr_is_owned(arg);
42740         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42741         arg_conv.is_owned = false;
42742         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
42743         return ret_conv;
42744 }
42745
42746 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
42747         LDKAcceptChannel orig_conv;
42748         orig_conv.inner = untag_ptr(orig);
42749         orig_conv.is_owned = ptr_is_owned(orig);
42750         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42751         orig_conv.is_owned = false;
42752         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
42753         uint64_t ret_ref = 0;
42754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42756         return ret_ref;
42757 }
42758
42759 int64_t  __attribute__((export_name("TS_AcceptChannel_hash"))) TS_AcceptChannel_hash(uint64_t o) {
42760         LDKAcceptChannel o_conv;
42761         o_conv.inner = untag_ptr(o);
42762         o_conv.is_owned = ptr_is_owned(o);
42763         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42764         o_conv.is_owned = false;
42765         int64_t ret_conv = AcceptChannel_hash(&o_conv);
42766         return ret_conv;
42767 }
42768
42769 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
42770         LDKAcceptChannel a_conv;
42771         a_conv.inner = untag_ptr(a);
42772         a_conv.is_owned = ptr_is_owned(a);
42773         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42774         a_conv.is_owned = false;
42775         LDKAcceptChannel b_conv;
42776         b_conv.inner = untag_ptr(b);
42777         b_conv.is_owned = ptr_is_owned(b);
42778         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42779         b_conv.is_owned = false;
42780         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
42781         return ret_conv;
42782 }
42783
42784 void  __attribute__((export_name("TS_AcceptChannelV2_free"))) TS_AcceptChannelV2_free(uint64_t this_obj) {
42785         LDKAcceptChannelV2 this_obj_conv;
42786         this_obj_conv.inner = untag_ptr(this_obj);
42787         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42789         AcceptChannelV2_free(this_obj_conv);
42790 }
42791
42792 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_temporary_channel_id"))) TS_AcceptChannelV2_get_temporary_channel_id(uint64_t this_ptr) {
42793         LDKAcceptChannelV2 this_ptr_conv;
42794         this_ptr_conv.inner = untag_ptr(this_ptr);
42795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42797         this_ptr_conv.is_owned = false;
42798         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42799         memcpy(ret_arr->elems, *AcceptChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
42800         return ret_arr;
42801 }
42802
42803 void  __attribute__((export_name("TS_AcceptChannelV2_set_temporary_channel_id"))) TS_AcceptChannelV2_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
42804         LDKAcceptChannelV2 this_ptr_conv;
42805         this_ptr_conv.inner = untag_ptr(this_ptr);
42806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42808         this_ptr_conv.is_owned = false;
42809         LDKThirtyTwoBytes val_ref;
42810         CHECK(val->arr_len == 32);
42811         memcpy(val_ref.data, val->elems, 32); FREE(val);
42812         AcceptChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
42813 }
42814
42815 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_funding_satoshis"))) TS_AcceptChannelV2_get_funding_satoshis(uint64_t this_ptr) {
42816         LDKAcceptChannelV2 this_ptr_conv;
42817         this_ptr_conv.inner = untag_ptr(this_ptr);
42818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42820         this_ptr_conv.is_owned = false;
42821         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
42822         return ret_conv;
42823 }
42824
42825 void  __attribute__((export_name("TS_AcceptChannelV2_set_funding_satoshis"))) TS_AcceptChannelV2_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
42826         LDKAcceptChannelV2 this_ptr_conv;
42827         this_ptr_conv.inner = untag_ptr(this_ptr);
42828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42830         this_ptr_conv.is_owned = false;
42831         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
42832 }
42833
42834 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_dust_limit_satoshis"))) TS_AcceptChannelV2_get_dust_limit_satoshis(uint64_t this_ptr) {
42835         LDKAcceptChannelV2 this_ptr_conv;
42836         this_ptr_conv.inner = untag_ptr(this_ptr);
42837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42839         this_ptr_conv.is_owned = false;
42840         int64_t ret_conv = AcceptChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
42841         return ret_conv;
42842 }
42843
42844 void  __attribute__((export_name("TS_AcceptChannelV2_set_dust_limit_satoshis"))) TS_AcceptChannelV2_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
42845         LDKAcceptChannelV2 this_ptr_conv;
42846         this_ptr_conv.inner = untag_ptr(this_ptr);
42847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42849         this_ptr_conv.is_owned = false;
42850         AcceptChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
42851 }
42852
42853 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) {
42854         LDKAcceptChannelV2 this_ptr_conv;
42855         this_ptr_conv.inner = untag_ptr(this_ptr);
42856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42858         this_ptr_conv.is_owned = false;
42859         int64_t ret_conv = AcceptChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
42860         return ret_conv;
42861 }
42862
42863 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) {
42864         LDKAcceptChannelV2 this_ptr_conv;
42865         this_ptr_conv.inner = untag_ptr(this_ptr);
42866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42868         this_ptr_conv.is_owned = false;
42869         AcceptChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
42870 }
42871
42872 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_htlc_minimum_msat"))) TS_AcceptChannelV2_get_htlc_minimum_msat(uint64_t this_ptr) {
42873         LDKAcceptChannelV2 this_ptr_conv;
42874         this_ptr_conv.inner = untag_ptr(this_ptr);
42875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42877         this_ptr_conv.is_owned = false;
42878         int64_t ret_conv = AcceptChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
42879         return ret_conv;
42880 }
42881
42882 void  __attribute__((export_name("TS_AcceptChannelV2_set_htlc_minimum_msat"))) TS_AcceptChannelV2_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
42883         LDKAcceptChannelV2 this_ptr_conv;
42884         this_ptr_conv.inner = untag_ptr(this_ptr);
42885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42887         this_ptr_conv.is_owned = false;
42888         AcceptChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
42889 }
42890
42891 int32_t  __attribute__((export_name("TS_AcceptChannelV2_get_minimum_depth"))) TS_AcceptChannelV2_get_minimum_depth(uint64_t this_ptr) {
42892         LDKAcceptChannelV2 this_ptr_conv;
42893         this_ptr_conv.inner = untag_ptr(this_ptr);
42894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42896         this_ptr_conv.is_owned = false;
42897         int32_t ret_conv = AcceptChannelV2_get_minimum_depth(&this_ptr_conv);
42898         return ret_conv;
42899 }
42900
42901 void  __attribute__((export_name("TS_AcceptChannelV2_set_minimum_depth"))) TS_AcceptChannelV2_set_minimum_depth(uint64_t this_ptr, int32_t val) {
42902         LDKAcceptChannelV2 this_ptr_conv;
42903         this_ptr_conv.inner = untag_ptr(this_ptr);
42904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42906         this_ptr_conv.is_owned = false;
42907         AcceptChannelV2_set_minimum_depth(&this_ptr_conv, val);
42908 }
42909
42910 int16_t  __attribute__((export_name("TS_AcceptChannelV2_get_to_self_delay"))) TS_AcceptChannelV2_get_to_self_delay(uint64_t this_ptr) {
42911         LDKAcceptChannelV2 this_ptr_conv;
42912         this_ptr_conv.inner = untag_ptr(this_ptr);
42913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42915         this_ptr_conv.is_owned = false;
42916         int16_t ret_conv = AcceptChannelV2_get_to_self_delay(&this_ptr_conv);
42917         return ret_conv;
42918 }
42919
42920 void  __attribute__((export_name("TS_AcceptChannelV2_set_to_self_delay"))) TS_AcceptChannelV2_set_to_self_delay(uint64_t this_ptr, int16_t val) {
42921         LDKAcceptChannelV2 this_ptr_conv;
42922         this_ptr_conv.inner = untag_ptr(this_ptr);
42923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42925         this_ptr_conv.is_owned = false;
42926         AcceptChannelV2_set_to_self_delay(&this_ptr_conv, val);
42927 }
42928
42929 int16_t  __attribute__((export_name("TS_AcceptChannelV2_get_max_accepted_htlcs"))) TS_AcceptChannelV2_get_max_accepted_htlcs(uint64_t this_ptr) {
42930         LDKAcceptChannelV2 this_ptr_conv;
42931         this_ptr_conv.inner = untag_ptr(this_ptr);
42932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42934         this_ptr_conv.is_owned = false;
42935         int16_t ret_conv = AcceptChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
42936         return ret_conv;
42937 }
42938
42939 void  __attribute__((export_name("TS_AcceptChannelV2_set_max_accepted_htlcs"))) TS_AcceptChannelV2_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
42940         LDKAcceptChannelV2 this_ptr_conv;
42941         this_ptr_conv.inner = untag_ptr(this_ptr);
42942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42944         this_ptr_conv.is_owned = false;
42945         AcceptChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
42946 }
42947
42948 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_funding_pubkey"))) TS_AcceptChannelV2_get_funding_pubkey(uint64_t this_ptr) {
42949         LDKAcceptChannelV2 this_ptr_conv;
42950         this_ptr_conv.inner = untag_ptr(this_ptr);
42951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42953         this_ptr_conv.is_owned = false;
42954         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42955         memcpy(ret_arr->elems, AcceptChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
42956         return ret_arr;
42957 }
42958
42959 void  __attribute__((export_name("TS_AcceptChannelV2_set_funding_pubkey"))) TS_AcceptChannelV2_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
42960         LDKAcceptChannelV2 this_ptr_conv;
42961         this_ptr_conv.inner = untag_ptr(this_ptr);
42962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42964         this_ptr_conv.is_owned = false;
42965         LDKPublicKey val_ref;
42966         CHECK(val->arr_len == 33);
42967         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42968         AcceptChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
42969 }
42970
42971 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_revocation_basepoint"))) TS_AcceptChannelV2_get_revocation_basepoint(uint64_t this_ptr) {
42972         LDKAcceptChannelV2 this_ptr_conv;
42973         this_ptr_conv.inner = untag_ptr(this_ptr);
42974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42976         this_ptr_conv.is_owned = false;
42977         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42978         memcpy(ret_arr->elems, AcceptChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
42979         return ret_arr;
42980 }
42981
42982 void  __attribute__((export_name("TS_AcceptChannelV2_set_revocation_basepoint"))) TS_AcceptChannelV2_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
42983         LDKAcceptChannelV2 this_ptr_conv;
42984         this_ptr_conv.inner = untag_ptr(this_ptr);
42985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42987         this_ptr_conv.is_owned = false;
42988         LDKPublicKey val_ref;
42989         CHECK(val->arr_len == 33);
42990         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42991         AcceptChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
42992 }
42993
42994 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_payment_basepoint"))) TS_AcceptChannelV2_get_payment_basepoint(uint64_t this_ptr) {
42995         LDKAcceptChannelV2 this_ptr_conv;
42996         this_ptr_conv.inner = untag_ptr(this_ptr);
42997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42999         this_ptr_conv.is_owned = false;
43000         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43001         memcpy(ret_arr->elems, AcceptChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
43002         return ret_arr;
43003 }
43004
43005 void  __attribute__((export_name("TS_AcceptChannelV2_set_payment_basepoint"))) TS_AcceptChannelV2_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
43006         LDKAcceptChannelV2 this_ptr_conv;
43007         this_ptr_conv.inner = untag_ptr(this_ptr);
43008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43010         this_ptr_conv.is_owned = false;
43011         LDKPublicKey val_ref;
43012         CHECK(val->arr_len == 33);
43013         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43014         AcceptChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
43015 }
43016
43017 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_delayed_payment_basepoint"))) TS_AcceptChannelV2_get_delayed_payment_basepoint(uint64_t this_ptr) {
43018         LDKAcceptChannelV2 this_ptr_conv;
43019         this_ptr_conv.inner = untag_ptr(this_ptr);
43020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43022         this_ptr_conv.is_owned = false;
43023         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43024         memcpy(ret_arr->elems, AcceptChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
43025         return ret_arr;
43026 }
43027
43028 void  __attribute__((export_name("TS_AcceptChannelV2_set_delayed_payment_basepoint"))) TS_AcceptChannelV2_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
43029         LDKAcceptChannelV2 this_ptr_conv;
43030         this_ptr_conv.inner = untag_ptr(this_ptr);
43031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43033         this_ptr_conv.is_owned = false;
43034         LDKPublicKey val_ref;
43035         CHECK(val->arr_len == 33);
43036         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43037         AcceptChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
43038 }
43039
43040 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_htlc_basepoint"))) TS_AcceptChannelV2_get_htlc_basepoint(uint64_t this_ptr) {
43041         LDKAcceptChannelV2 this_ptr_conv;
43042         this_ptr_conv.inner = untag_ptr(this_ptr);
43043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43045         this_ptr_conv.is_owned = false;
43046         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43047         memcpy(ret_arr->elems, AcceptChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
43048         return ret_arr;
43049 }
43050
43051 void  __attribute__((export_name("TS_AcceptChannelV2_set_htlc_basepoint"))) TS_AcceptChannelV2_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
43052         LDKAcceptChannelV2 this_ptr_conv;
43053         this_ptr_conv.inner = untag_ptr(this_ptr);
43054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43056         this_ptr_conv.is_owned = false;
43057         LDKPublicKey val_ref;
43058         CHECK(val->arr_len == 33);
43059         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43060         AcceptChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
43061 }
43062
43063 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_first_per_commitment_point"))) TS_AcceptChannelV2_get_first_per_commitment_point(uint64_t this_ptr) {
43064         LDKAcceptChannelV2 this_ptr_conv;
43065         this_ptr_conv.inner = untag_ptr(this_ptr);
43066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43068         this_ptr_conv.is_owned = false;
43069         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43070         memcpy(ret_arr->elems, AcceptChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
43071         return ret_arr;
43072 }
43073
43074 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) {
43075         LDKAcceptChannelV2 this_ptr_conv;
43076         this_ptr_conv.inner = untag_ptr(this_ptr);
43077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43079         this_ptr_conv.is_owned = false;
43080         LDKPublicKey val_ref;
43081         CHECK(val->arr_len == 33);
43082         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43083         AcceptChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
43084 }
43085
43086 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_second_per_commitment_point"))) TS_AcceptChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
43087         LDKAcceptChannelV2 this_ptr_conv;
43088         this_ptr_conv.inner = untag_ptr(this_ptr);
43089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43091         this_ptr_conv.is_owned = false;
43092         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43093         memcpy(ret_arr->elems, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
43094         return ret_arr;
43095 }
43096
43097 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) {
43098         LDKAcceptChannelV2 this_ptr_conv;
43099         this_ptr_conv.inner = untag_ptr(this_ptr);
43100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43102         this_ptr_conv.is_owned = false;
43103         LDKPublicKey val_ref;
43104         CHECK(val->arr_len == 33);
43105         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43106         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
43107 }
43108
43109 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_get_shutdown_scriptpubkey"))) TS_AcceptChannelV2_get_shutdown_scriptpubkey(uint64_t this_ptr) {
43110         LDKAcceptChannelV2 this_ptr_conv;
43111         this_ptr_conv.inner = untag_ptr(this_ptr);
43112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43114         this_ptr_conv.is_owned = false;
43115         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
43116         *ret_copy = AcceptChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
43117         uint64_t ret_ref = tag_ptr(ret_copy, true);
43118         return ret_ref;
43119 }
43120
43121 void  __attribute__((export_name("TS_AcceptChannelV2_set_shutdown_scriptpubkey"))) TS_AcceptChannelV2_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
43122         LDKAcceptChannelV2 this_ptr_conv;
43123         this_ptr_conv.inner = untag_ptr(this_ptr);
43124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43126         this_ptr_conv.is_owned = false;
43127         void* val_ptr = untag_ptr(val);
43128         CHECK_ACCESS(val_ptr);
43129         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
43130         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
43131         AcceptChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
43132 }
43133
43134 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_get_channel_type"))) TS_AcceptChannelV2_get_channel_type(uint64_t this_ptr) {
43135         LDKAcceptChannelV2 this_ptr_conv;
43136         this_ptr_conv.inner = untag_ptr(this_ptr);
43137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43139         this_ptr_conv.is_owned = false;
43140         LDKChannelTypeFeatures ret_var = AcceptChannelV2_get_channel_type(&this_ptr_conv);
43141         uint64_t ret_ref = 0;
43142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43144         return ret_ref;
43145 }
43146
43147 void  __attribute__((export_name("TS_AcceptChannelV2_set_channel_type"))) TS_AcceptChannelV2_set_channel_type(uint64_t this_ptr, uint64_t val) {
43148         LDKAcceptChannelV2 this_ptr_conv;
43149         this_ptr_conv.inner = untag_ptr(this_ptr);
43150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43152         this_ptr_conv.is_owned = false;
43153         LDKChannelTypeFeatures val_conv;
43154         val_conv.inner = untag_ptr(val);
43155         val_conv.is_owned = ptr_is_owned(val);
43156         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43157         val_conv = ChannelTypeFeatures_clone(&val_conv);
43158         AcceptChannelV2_set_channel_type(&this_ptr_conv, val_conv);
43159 }
43160
43161 uint32_t  __attribute__((export_name("TS_AcceptChannelV2_get_require_confirmed_inputs"))) TS_AcceptChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
43162         LDKAcceptChannelV2 this_ptr_conv;
43163         this_ptr_conv.inner = untag_ptr(this_ptr);
43164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43166         this_ptr_conv.is_owned = false;
43167         uint32_t ret_conv = LDKCOption_NoneZ_to_js(AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
43168         return ret_conv;
43169 }
43170
43171 void  __attribute__((export_name("TS_AcceptChannelV2_set_require_confirmed_inputs"))) TS_AcceptChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
43172         LDKAcceptChannelV2 this_ptr_conv;
43173         this_ptr_conv.inner = untag_ptr(this_ptr);
43174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43176         this_ptr_conv.is_owned = false;
43177         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
43178         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
43179 }
43180
43181 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) {
43182         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
43183         CHECK(temporary_channel_id_arg->arr_len == 32);
43184         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
43185         LDKPublicKey funding_pubkey_arg_ref;
43186         CHECK(funding_pubkey_arg->arr_len == 33);
43187         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
43188         LDKPublicKey revocation_basepoint_arg_ref;
43189         CHECK(revocation_basepoint_arg->arr_len == 33);
43190         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
43191         LDKPublicKey payment_basepoint_arg_ref;
43192         CHECK(payment_basepoint_arg->arr_len == 33);
43193         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
43194         LDKPublicKey delayed_payment_basepoint_arg_ref;
43195         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
43196         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
43197         LDKPublicKey htlc_basepoint_arg_ref;
43198         CHECK(htlc_basepoint_arg->arr_len == 33);
43199         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
43200         LDKPublicKey first_per_commitment_point_arg_ref;
43201         CHECK(first_per_commitment_point_arg->arr_len == 33);
43202         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
43203         LDKPublicKey second_per_commitment_point_arg_ref;
43204         CHECK(second_per_commitment_point_arg->arr_len == 33);
43205         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
43206         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
43207         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
43208         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
43209         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
43210         LDKChannelTypeFeatures channel_type_arg_conv;
43211         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
43212         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
43213         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
43214         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
43215         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
43216         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);
43217         uint64_t ret_ref = 0;
43218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43220         return ret_ref;
43221 }
43222
43223 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
43224         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
43225         uint64_t ret_ref = 0;
43226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43228         return ret_ref;
43229 }
43230 int64_t  __attribute__((export_name("TS_AcceptChannelV2_clone_ptr"))) TS_AcceptChannelV2_clone_ptr(uint64_t arg) {
43231         LDKAcceptChannelV2 arg_conv;
43232         arg_conv.inner = untag_ptr(arg);
43233         arg_conv.is_owned = ptr_is_owned(arg);
43234         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43235         arg_conv.is_owned = false;
43236         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
43237         return ret_conv;
43238 }
43239
43240 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_clone"))) TS_AcceptChannelV2_clone(uint64_t orig) {
43241         LDKAcceptChannelV2 orig_conv;
43242         orig_conv.inner = untag_ptr(orig);
43243         orig_conv.is_owned = ptr_is_owned(orig);
43244         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43245         orig_conv.is_owned = false;
43246         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
43247         uint64_t ret_ref = 0;
43248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43250         return ret_ref;
43251 }
43252
43253 int64_t  __attribute__((export_name("TS_AcceptChannelV2_hash"))) TS_AcceptChannelV2_hash(uint64_t o) {
43254         LDKAcceptChannelV2 o_conv;
43255         o_conv.inner = untag_ptr(o);
43256         o_conv.is_owned = ptr_is_owned(o);
43257         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43258         o_conv.is_owned = false;
43259         int64_t ret_conv = AcceptChannelV2_hash(&o_conv);
43260         return ret_conv;
43261 }
43262
43263 jboolean  __attribute__((export_name("TS_AcceptChannelV2_eq"))) TS_AcceptChannelV2_eq(uint64_t a, uint64_t b) {
43264         LDKAcceptChannelV2 a_conv;
43265         a_conv.inner = untag_ptr(a);
43266         a_conv.is_owned = ptr_is_owned(a);
43267         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43268         a_conv.is_owned = false;
43269         LDKAcceptChannelV2 b_conv;
43270         b_conv.inner = untag_ptr(b);
43271         b_conv.is_owned = ptr_is_owned(b);
43272         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43273         b_conv.is_owned = false;
43274         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
43275         return ret_conv;
43276 }
43277
43278 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
43279         LDKFundingCreated this_obj_conv;
43280         this_obj_conv.inner = untag_ptr(this_obj);
43281         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43283         FundingCreated_free(this_obj_conv);
43284 }
43285
43286 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
43287         LDKFundingCreated this_ptr_conv;
43288         this_ptr_conv.inner = untag_ptr(this_ptr);
43289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43291         this_ptr_conv.is_owned = false;
43292         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43293         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
43294         return ret_arr;
43295 }
43296
43297 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
43298         LDKFundingCreated this_ptr_conv;
43299         this_ptr_conv.inner = untag_ptr(this_ptr);
43300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43302         this_ptr_conv.is_owned = false;
43303         LDKThirtyTwoBytes val_ref;
43304         CHECK(val->arr_len == 32);
43305         memcpy(val_ref.data, val->elems, 32); FREE(val);
43306         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
43307 }
43308
43309 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
43310         LDKFundingCreated this_ptr_conv;
43311         this_ptr_conv.inner = untag_ptr(this_ptr);
43312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43314         this_ptr_conv.is_owned = false;
43315         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43316         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
43317         return ret_arr;
43318 }
43319
43320 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
43321         LDKFundingCreated this_ptr_conv;
43322         this_ptr_conv.inner = untag_ptr(this_ptr);
43323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43325         this_ptr_conv.is_owned = false;
43326         LDKThirtyTwoBytes val_ref;
43327         CHECK(val->arr_len == 32);
43328         memcpy(val_ref.data, val->elems, 32); FREE(val);
43329         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
43330 }
43331
43332 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
43333         LDKFundingCreated this_ptr_conv;
43334         this_ptr_conv.inner = untag_ptr(this_ptr);
43335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43337         this_ptr_conv.is_owned = false;
43338         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
43339         return ret_conv;
43340 }
43341
43342 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
43343         LDKFundingCreated this_ptr_conv;
43344         this_ptr_conv.inner = untag_ptr(this_ptr);
43345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43347         this_ptr_conv.is_owned = false;
43348         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
43349 }
43350
43351 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
43352         LDKFundingCreated this_ptr_conv;
43353         this_ptr_conv.inner = untag_ptr(this_ptr);
43354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43356         this_ptr_conv.is_owned = false;
43357         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43358         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
43359         return ret_arr;
43360 }
43361
43362 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
43363         LDKFundingCreated this_ptr_conv;
43364         this_ptr_conv.inner = untag_ptr(this_ptr);
43365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43367         this_ptr_conv.is_owned = false;
43368         LDKECDSASignature val_ref;
43369         CHECK(val->arr_len == 64);
43370         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43371         FundingCreated_set_signature(&this_ptr_conv, val_ref);
43372 }
43373
43374 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) {
43375         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
43376         CHECK(temporary_channel_id_arg->arr_len == 32);
43377         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
43378         LDKThirtyTwoBytes funding_txid_arg_ref;
43379         CHECK(funding_txid_arg->arr_len == 32);
43380         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
43381         LDKECDSASignature signature_arg_ref;
43382         CHECK(signature_arg->arr_len == 64);
43383         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
43384         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
43385         uint64_t ret_ref = 0;
43386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43388         return ret_ref;
43389 }
43390
43391 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
43392         LDKFundingCreated ret_var = FundingCreated_clone(arg);
43393         uint64_t ret_ref = 0;
43394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43396         return ret_ref;
43397 }
43398 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
43399         LDKFundingCreated arg_conv;
43400         arg_conv.inner = untag_ptr(arg);
43401         arg_conv.is_owned = ptr_is_owned(arg);
43402         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43403         arg_conv.is_owned = false;
43404         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
43405         return ret_conv;
43406 }
43407
43408 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
43409         LDKFundingCreated orig_conv;
43410         orig_conv.inner = untag_ptr(orig);
43411         orig_conv.is_owned = ptr_is_owned(orig);
43412         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43413         orig_conv.is_owned = false;
43414         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
43415         uint64_t ret_ref = 0;
43416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43418         return ret_ref;
43419 }
43420
43421 int64_t  __attribute__((export_name("TS_FundingCreated_hash"))) TS_FundingCreated_hash(uint64_t o) {
43422         LDKFundingCreated o_conv;
43423         o_conv.inner = untag_ptr(o);
43424         o_conv.is_owned = ptr_is_owned(o);
43425         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43426         o_conv.is_owned = false;
43427         int64_t ret_conv = FundingCreated_hash(&o_conv);
43428         return ret_conv;
43429 }
43430
43431 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
43432         LDKFundingCreated a_conv;
43433         a_conv.inner = untag_ptr(a);
43434         a_conv.is_owned = ptr_is_owned(a);
43435         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43436         a_conv.is_owned = false;
43437         LDKFundingCreated b_conv;
43438         b_conv.inner = untag_ptr(b);
43439         b_conv.is_owned = ptr_is_owned(b);
43440         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43441         b_conv.is_owned = false;
43442         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
43443         return ret_conv;
43444 }
43445
43446 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
43447         LDKFundingSigned this_obj_conv;
43448         this_obj_conv.inner = untag_ptr(this_obj);
43449         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43451         FundingSigned_free(this_obj_conv);
43452 }
43453
43454 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
43455         LDKFundingSigned this_ptr_conv;
43456         this_ptr_conv.inner = untag_ptr(this_ptr);
43457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43459         this_ptr_conv.is_owned = false;
43460         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43461         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
43462         return ret_arr;
43463 }
43464
43465 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
43466         LDKFundingSigned this_ptr_conv;
43467         this_ptr_conv.inner = untag_ptr(this_ptr);
43468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43470         this_ptr_conv.is_owned = false;
43471         LDKThirtyTwoBytes val_ref;
43472         CHECK(val->arr_len == 32);
43473         memcpy(val_ref.data, val->elems, 32); FREE(val);
43474         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
43475 }
43476
43477 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
43478         LDKFundingSigned this_ptr_conv;
43479         this_ptr_conv.inner = untag_ptr(this_ptr);
43480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43482         this_ptr_conv.is_owned = false;
43483         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43484         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
43485         return ret_arr;
43486 }
43487
43488 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
43489         LDKFundingSigned this_ptr_conv;
43490         this_ptr_conv.inner = untag_ptr(this_ptr);
43491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43493         this_ptr_conv.is_owned = false;
43494         LDKECDSASignature val_ref;
43495         CHECK(val->arr_len == 64);
43496         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43497         FundingSigned_set_signature(&this_ptr_conv, val_ref);
43498 }
43499
43500 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
43501         LDKThirtyTwoBytes channel_id_arg_ref;
43502         CHECK(channel_id_arg->arr_len == 32);
43503         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
43504         LDKECDSASignature signature_arg_ref;
43505         CHECK(signature_arg->arr_len == 64);
43506         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
43507         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
43508         uint64_t ret_ref = 0;
43509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43511         return ret_ref;
43512 }
43513
43514 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
43515         LDKFundingSigned ret_var = FundingSigned_clone(arg);
43516         uint64_t ret_ref = 0;
43517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43519         return ret_ref;
43520 }
43521 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
43522         LDKFundingSigned arg_conv;
43523         arg_conv.inner = untag_ptr(arg);
43524         arg_conv.is_owned = ptr_is_owned(arg);
43525         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43526         arg_conv.is_owned = false;
43527         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
43528         return ret_conv;
43529 }
43530
43531 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
43532         LDKFundingSigned orig_conv;
43533         orig_conv.inner = untag_ptr(orig);
43534         orig_conv.is_owned = ptr_is_owned(orig);
43535         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43536         orig_conv.is_owned = false;
43537         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
43538         uint64_t ret_ref = 0;
43539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43541         return ret_ref;
43542 }
43543
43544 int64_t  __attribute__((export_name("TS_FundingSigned_hash"))) TS_FundingSigned_hash(uint64_t o) {
43545         LDKFundingSigned o_conv;
43546         o_conv.inner = untag_ptr(o);
43547         o_conv.is_owned = ptr_is_owned(o);
43548         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43549         o_conv.is_owned = false;
43550         int64_t ret_conv = FundingSigned_hash(&o_conv);
43551         return ret_conv;
43552 }
43553
43554 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
43555         LDKFundingSigned a_conv;
43556         a_conv.inner = untag_ptr(a);
43557         a_conv.is_owned = ptr_is_owned(a);
43558         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43559         a_conv.is_owned = false;
43560         LDKFundingSigned b_conv;
43561         b_conv.inner = untag_ptr(b);
43562         b_conv.is_owned = ptr_is_owned(b);
43563         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43564         b_conv.is_owned = false;
43565         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
43566         return ret_conv;
43567 }
43568
43569 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
43570         LDKChannelReady this_obj_conv;
43571         this_obj_conv.inner = untag_ptr(this_obj);
43572         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43574         ChannelReady_free(this_obj_conv);
43575 }
43576
43577 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
43578         LDKChannelReady this_ptr_conv;
43579         this_ptr_conv.inner = untag_ptr(this_ptr);
43580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43582         this_ptr_conv.is_owned = false;
43583         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43584         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
43585         return ret_arr;
43586 }
43587
43588 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
43589         LDKChannelReady this_ptr_conv;
43590         this_ptr_conv.inner = untag_ptr(this_ptr);
43591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43593         this_ptr_conv.is_owned = false;
43594         LDKThirtyTwoBytes val_ref;
43595         CHECK(val->arr_len == 32);
43596         memcpy(val_ref.data, val->elems, 32); FREE(val);
43597         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
43598 }
43599
43600 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
43601         LDKChannelReady this_ptr_conv;
43602         this_ptr_conv.inner = untag_ptr(this_ptr);
43603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43605         this_ptr_conv.is_owned = false;
43606         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43607         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
43608         return ret_arr;
43609 }
43610
43611 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) {
43612         LDKChannelReady this_ptr_conv;
43613         this_ptr_conv.inner = untag_ptr(this_ptr);
43614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43616         this_ptr_conv.is_owned = false;
43617         LDKPublicKey val_ref;
43618         CHECK(val->arr_len == 33);
43619         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43620         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
43621 }
43622
43623 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
43624         LDKChannelReady this_ptr_conv;
43625         this_ptr_conv.inner = untag_ptr(this_ptr);
43626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43628         this_ptr_conv.is_owned = false;
43629         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43630         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
43631         uint64_t ret_ref = tag_ptr(ret_copy, true);
43632         return ret_ref;
43633 }
43634
43635 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) {
43636         LDKChannelReady this_ptr_conv;
43637         this_ptr_conv.inner = untag_ptr(this_ptr);
43638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43640         this_ptr_conv.is_owned = false;
43641         void* val_ptr = untag_ptr(val);
43642         CHECK_ACCESS(val_ptr);
43643         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
43644         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
43645         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
43646 }
43647
43648 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) {
43649         LDKThirtyTwoBytes channel_id_arg_ref;
43650         CHECK(channel_id_arg->arr_len == 32);
43651         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
43652         LDKPublicKey next_per_commitment_point_arg_ref;
43653         CHECK(next_per_commitment_point_arg->arr_len == 33);
43654         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
43655         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
43656         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
43657         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
43658         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
43659         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
43660         uint64_t ret_ref = 0;
43661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43663         return ret_ref;
43664 }
43665
43666 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
43667         LDKChannelReady ret_var = ChannelReady_clone(arg);
43668         uint64_t ret_ref = 0;
43669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43671         return ret_ref;
43672 }
43673 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
43674         LDKChannelReady arg_conv;
43675         arg_conv.inner = untag_ptr(arg);
43676         arg_conv.is_owned = ptr_is_owned(arg);
43677         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43678         arg_conv.is_owned = false;
43679         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
43680         return ret_conv;
43681 }
43682
43683 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
43684         LDKChannelReady orig_conv;
43685         orig_conv.inner = untag_ptr(orig);
43686         orig_conv.is_owned = ptr_is_owned(orig);
43687         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43688         orig_conv.is_owned = false;
43689         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
43690         uint64_t ret_ref = 0;
43691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43693         return ret_ref;
43694 }
43695
43696 int64_t  __attribute__((export_name("TS_ChannelReady_hash"))) TS_ChannelReady_hash(uint64_t o) {
43697         LDKChannelReady o_conv;
43698         o_conv.inner = untag_ptr(o);
43699         o_conv.is_owned = ptr_is_owned(o);
43700         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43701         o_conv.is_owned = false;
43702         int64_t ret_conv = ChannelReady_hash(&o_conv);
43703         return ret_conv;
43704 }
43705
43706 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
43707         LDKChannelReady a_conv;
43708         a_conv.inner = untag_ptr(a);
43709         a_conv.is_owned = ptr_is_owned(a);
43710         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43711         a_conv.is_owned = false;
43712         LDKChannelReady b_conv;
43713         b_conv.inner = untag_ptr(b);
43714         b_conv.is_owned = ptr_is_owned(b);
43715         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43716         b_conv.is_owned = false;
43717         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
43718         return ret_conv;
43719 }
43720
43721 void  __attribute__((export_name("TS_Stfu_free"))) TS_Stfu_free(uint64_t this_obj) {
43722         LDKStfu this_obj_conv;
43723         this_obj_conv.inner = untag_ptr(this_obj);
43724         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43726         Stfu_free(this_obj_conv);
43727 }
43728
43729 int8_tArray  __attribute__((export_name("TS_Stfu_get_channel_id"))) TS_Stfu_get_channel_id(uint64_t this_ptr) {
43730         LDKStfu this_ptr_conv;
43731         this_ptr_conv.inner = untag_ptr(this_ptr);
43732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43734         this_ptr_conv.is_owned = false;
43735         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43736         memcpy(ret_arr->elems, *Stfu_get_channel_id(&this_ptr_conv), 32);
43737         return ret_arr;
43738 }
43739
43740 void  __attribute__((export_name("TS_Stfu_set_channel_id"))) TS_Stfu_set_channel_id(uint64_t this_ptr, int8_tArray val) {
43741         LDKStfu this_ptr_conv;
43742         this_ptr_conv.inner = untag_ptr(this_ptr);
43743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43745         this_ptr_conv.is_owned = false;
43746         LDKThirtyTwoBytes val_ref;
43747         CHECK(val->arr_len == 32);
43748         memcpy(val_ref.data, val->elems, 32); FREE(val);
43749         Stfu_set_channel_id(&this_ptr_conv, val_ref);
43750 }
43751
43752 int8_t  __attribute__((export_name("TS_Stfu_get_initiator"))) TS_Stfu_get_initiator(uint64_t this_ptr) {
43753         LDKStfu this_ptr_conv;
43754         this_ptr_conv.inner = untag_ptr(this_ptr);
43755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43757         this_ptr_conv.is_owned = false;
43758         int8_t ret_conv = Stfu_get_initiator(&this_ptr_conv);
43759         return ret_conv;
43760 }
43761
43762 void  __attribute__((export_name("TS_Stfu_set_initiator"))) TS_Stfu_set_initiator(uint64_t this_ptr, int8_t val) {
43763         LDKStfu this_ptr_conv;
43764         this_ptr_conv.inner = untag_ptr(this_ptr);
43765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43767         this_ptr_conv.is_owned = false;
43768         Stfu_set_initiator(&this_ptr_conv, val);
43769 }
43770
43771 uint64_t  __attribute__((export_name("TS_Stfu_new"))) TS_Stfu_new(int8_tArray channel_id_arg, int8_t initiator_arg) {
43772         LDKThirtyTwoBytes channel_id_arg_ref;
43773         CHECK(channel_id_arg->arr_len == 32);
43774         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
43775         LDKStfu ret_var = Stfu_new(channel_id_arg_ref, initiator_arg);
43776         uint64_t ret_ref = 0;
43777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43779         return ret_ref;
43780 }
43781
43782 static inline uint64_t Stfu_clone_ptr(LDKStfu *NONNULL_PTR arg) {
43783         LDKStfu ret_var = Stfu_clone(arg);
43784         uint64_t ret_ref = 0;
43785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43787         return ret_ref;
43788 }
43789 int64_t  __attribute__((export_name("TS_Stfu_clone_ptr"))) TS_Stfu_clone_ptr(uint64_t arg) {
43790         LDKStfu arg_conv;
43791         arg_conv.inner = untag_ptr(arg);
43792         arg_conv.is_owned = ptr_is_owned(arg);
43793         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43794         arg_conv.is_owned = false;
43795         int64_t ret_conv = Stfu_clone_ptr(&arg_conv);
43796         return ret_conv;
43797 }
43798
43799 uint64_t  __attribute__((export_name("TS_Stfu_clone"))) TS_Stfu_clone(uint64_t orig) {
43800         LDKStfu orig_conv;
43801         orig_conv.inner = untag_ptr(orig);
43802         orig_conv.is_owned = ptr_is_owned(orig);
43803         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43804         orig_conv.is_owned = false;
43805         LDKStfu ret_var = Stfu_clone(&orig_conv);
43806         uint64_t ret_ref = 0;
43807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43809         return ret_ref;
43810 }
43811
43812 jboolean  __attribute__((export_name("TS_Stfu_eq"))) TS_Stfu_eq(uint64_t a, uint64_t b) {
43813         LDKStfu a_conv;
43814         a_conv.inner = untag_ptr(a);
43815         a_conv.is_owned = ptr_is_owned(a);
43816         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43817         a_conv.is_owned = false;
43818         LDKStfu b_conv;
43819         b_conv.inner = untag_ptr(b);
43820         b_conv.is_owned = ptr_is_owned(b);
43821         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43822         b_conv.is_owned = false;
43823         jboolean ret_conv = Stfu_eq(&a_conv, &b_conv);
43824         return ret_conv;
43825 }
43826
43827 void  __attribute__((export_name("TS_Splice_free"))) TS_Splice_free(uint64_t this_obj) {
43828         LDKSplice this_obj_conv;
43829         this_obj_conv.inner = untag_ptr(this_obj);
43830         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43832         Splice_free(this_obj_conv);
43833 }
43834
43835 int8_tArray  __attribute__((export_name("TS_Splice_get_channel_id"))) TS_Splice_get_channel_id(uint64_t this_ptr) {
43836         LDKSplice this_ptr_conv;
43837         this_ptr_conv.inner = untag_ptr(this_ptr);
43838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43840         this_ptr_conv.is_owned = false;
43841         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43842         memcpy(ret_arr->elems, *Splice_get_channel_id(&this_ptr_conv), 32);
43843         return ret_arr;
43844 }
43845
43846 void  __attribute__((export_name("TS_Splice_set_channel_id"))) TS_Splice_set_channel_id(uint64_t this_ptr, int8_tArray val) {
43847         LDKSplice this_ptr_conv;
43848         this_ptr_conv.inner = untag_ptr(this_ptr);
43849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43851         this_ptr_conv.is_owned = false;
43852         LDKThirtyTwoBytes val_ref;
43853         CHECK(val->arr_len == 32);
43854         memcpy(val_ref.data, val->elems, 32); FREE(val);
43855         Splice_set_channel_id(&this_ptr_conv, val_ref);
43856 }
43857
43858 int8_tArray  __attribute__((export_name("TS_Splice_get_chain_hash"))) TS_Splice_get_chain_hash(uint64_t this_ptr) {
43859         LDKSplice this_ptr_conv;
43860         this_ptr_conv.inner = untag_ptr(this_ptr);
43861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43863         this_ptr_conv.is_owned = false;
43864         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43865         memcpy(ret_arr->elems, *Splice_get_chain_hash(&this_ptr_conv), 32);
43866         return ret_arr;
43867 }
43868
43869 void  __attribute__((export_name("TS_Splice_set_chain_hash"))) TS_Splice_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
43870         LDKSplice this_ptr_conv;
43871         this_ptr_conv.inner = untag_ptr(this_ptr);
43872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43874         this_ptr_conv.is_owned = false;
43875         LDKThirtyTwoBytes val_ref;
43876         CHECK(val->arr_len == 32);
43877         memcpy(val_ref.data, val->elems, 32); FREE(val);
43878         Splice_set_chain_hash(&this_ptr_conv, val_ref);
43879 }
43880
43881 int64_t  __attribute__((export_name("TS_Splice_get_relative_satoshis"))) TS_Splice_get_relative_satoshis(uint64_t this_ptr) {
43882         LDKSplice this_ptr_conv;
43883         this_ptr_conv.inner = untag_ptr(this_ptr);
43884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43886         this_ptr_conv.is_owned = false;
43887         int64_t ret_conv = Splice_get_relative_satoshis(&this_ptr_conv);
43888         return ret_conv;
43889 }
43890
43891 void  __attribute__((export_name("TS_Splice_set_relative_satoshis"))) TS_Splice_set_relative_satoshis(uint64_t this_ptr, int64_t val) {
43892         LDKSplice this_ptr_conv;
43893         this_ptr_conv.inner = untag_ptr(this_ptr);
43894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43896         this_ptr_conv.is_owned = false;
43897         Splice_set_relative_satoshis(&this_ptr_conv, val);
43898 }
43899
43900 int32_t  __attribute__((export_name("TS_Splice_get_funding_feerate_perkw"))) TS_Splice_get_funding_feerate_perkw(uint64_t this_ptr) {
43901         LDKSplice this_ptr_conv;
43902         this_ptr_conv.inner = untag_ptr(this_ptr);
43903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43905         this_ptr_conv.is_owned = false;
43906         int32_t ret_conv = Splice_get_funding_feerate_perkw(&this_ptr_conv);
43907         return ret_conv;
43908 }
43909
43910 void  __attribute__((export_name("TS_Splice_set_funding_feerate_perkw"))) TS_Splice_set_funding_feerate_perkw(uint64_t this_ptr, int32_t val) {
43911         LDKSplice this_ptr_conv;
43912         this_ptr_conv.inner = untag_ptr(this_ptr);
43913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43915         this_ptr_conv.is_owned = false;
43916         Splice_set_funding_feerate_perkw(&this_ptr_conv, val);
43917 }
43918
43919 int32_t  __attribute__((export_name("TS_Splice_get_locktime"))) TS_Splice_get_locktime(uint64_t this_ptr) {
43920         LDKSplice this_ptr_conv;
43921         this_ptr_conv.inner = untag_ptr(this_ptr);
43922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43924         this_ptr_conv.is_owned = false;
43925         int32_t ret_conv = Splice_get_locktime(&this_ptr_conv);
43926         return ret_conv;
43927 }
43928
43929 void  __attribute__((export_name("TS_Splice_set_locktime"))) TS_Splice_set_locktime(uint64_t this_ptr, int32_t val) {
43930         LDKSplice this_ptr_conv;
43931         this_ptr_conv.inner = untag_ptr(this_ptr);
43932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43934         this_ptr_conv.is_owned = false;
43935         Splice_set_locktime(&this_ptr_conv, val);
43936 }
43937
43938 int8_tArray  __attribute__((export_name("TS_Splice_get_funding_pubkey"))) TS_Splice_get_funding_pubkey(uint64_t this_ptr) {
43939         LDKSplice this_ptr_conv;
43940         this_ptr_conv.inner = untag_ptr(this_ptr);
43941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43943         this_ptr_conv.is_owned = false;
43944         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43945         memcpy(ret_arr->elems, Splice_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
43946         return ret_arr;
43947 }
43948
43949 void  __attribute__((export_name("TS_Splice_set_funding_pubkey"))) TS_Splice_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
43950         LDKSplice this_ptr_conv;
43951         this_ptr_conv.inner = untag_ptr(this_ptr);
43952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43954         this_ptr_conv.is_owned = false;
43955         LDKPublicKey val_ref;
43956         CHECK(val->arr_len == 33);
43957         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43958         Splice_set_funding_pubkey(&this_ptr_conv, val_ref);
43959 }
43960
43961 uint64_t  __attribute__((export_name("TS_Splice_new"))) TS_Splice_new(int8_tArray channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int32_t funding_feerate_perkw_arg, int32_t locktime_arg, int8_tArray funding_pubkey_arg) {
43962         LDKThirtyTwoBytes channel_id_arg_ref;
43963         CHECK(channel_id_arg->arr_len == 32);
43964         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
43965         LDKThirtyTwoBytes chain_hash_arg_ref;
43966         CHECK(chain_hash_arg->arr_len == 32);
43967         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
43968         LDKPublicKey funding_pubkey_arg_ref;
43969         CHECK(funding_pubkey_arg->arr_len == 33);
43970         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
43971         LDKSplice ret_var = Splice_new(channel_id_arg_ref, chain_hash_arg_ref, relative_satoshis_arg, funding_feerate_perkw_arg, locktime_arg, funding_pubkey_arg_ref);
43972         uint64_t ret_ref = 0;
43973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43975         return ret_ref;
43976 }
43977
43978 static inline uint64_t Splice_clone_ptr(LDKSplice *NONNULL_PTR arg) {
43979         LDKSplice ret_var = Splice_clone(arg);
43980         uint64_t ret_ref = 0;
43981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43983         return ret_ref;
43984 }
43985 int64_t  __attribute__((export_name("TS_Splice_clone_ptr"))) TS_Splice_clone_ptr(uint64_t arg) {
43986         LDKSplice arg_conv;
43987         arg_conv.inner = untag_ptr(arg);
43988         arg_conv.is_owned = ptr_is_owned(arg);
43989         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43990         arg_conv.is_owned = false;
43991         int64_t ret_conv = Splice_clone_ptr(&arg_conv);
43992         return ret_conv;
43993 }
43994
43995 uint64_t  __attribute__((export_name("TS_Splice_clone"))) TS_Splice_clone(uint64_t orig) {
43996         LDKSplice orig_conv;
43997         orig_conv.inner = untag_ptr(orig);
43998         orig_conv.is_owned = ptr_is_owned(orig);
43999         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44000         orig_conv.is_owned = false;
44001         LDKSplice ret_var = Splice_clone(&orig_conv);
44002         uint64_t ret_ref = 0;
44003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44005         return ret_ref;
44006 }
44007
44008 jboolean  __attribute__((export_name("TS_Splice_eq"))) TS_Splice_eq(uint64_t a, uint64_t b) {
44009         LDKSplice a_conv;
44010         a_conv.inner = untag_ptr(a);
44011         a_conv.is_owned = ptr_is_owned(a);
44012         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44013         a_conv.is_owned = false;
44014         LDKSplice b_conv;
44015         b_conv.inner = untag_ptr(b);
44016         b_conv.is_owned = ptr_is_owned(b);
44017         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44018         b_conv.is_owned = false;
44019         jboolean ret_conv = Splice_eq(&a_conv, &b_conv);
44020         return ret_conv;
44021 }
44022
44023 void  __attribute__((export_name("TS_SpliceAck_free"))) TS_SpliceAck_free(uint64_t this_obj) {
44024         LDKSpliceAck this_obj_conv;
44025         this_obj_conv.inner = untag_ptr(this_obj);
44026         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44028         SpliceAck_free(this_obj_conv);
44029 }
44030
44031 int8_tArray  __attribute__((export_name("TS_SpliceAck_get_channel_id"))) TS_SpliceAck_get_channel_id(uint64_t this_ptr) {
44032         LDKSpliceAck this_ptr_conv;
44033         this_ptr_conv.inner = untag_ptr(this_ptr);
44034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44036         this_ptr_conv.is_owned = false;
44037         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44038         memcpy(ret_arr->elems, *SpliceAck_get_channel_id(&this_ptr_conv), 32);
44039         return ret_arr;
44040 }
44041
44042 void  __attribute__((export_name("TS_SpliceAck_set_channel_id"))) TS_SpliceAck_set_channel_id(uint64_t this_ptr, int8_tArray val) {
44043         LDKSpliceAck this_ptr_conv;
44044         this_ptr_conv.inner = untag_ptr(this_ptr);
44045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44047         this_ptr_conv.is_owned = false;
44048         LDKThirtyTwoBytes val_ref;
44049         CHECK(val->arr_len == 32);
44050         memcpy(val_ref.data, val->elems, 32); FREE(val);
44051         SpliceAck_set_channel_id(&this_ptr_conv, val_ref);
44052 }
44053
44054 int8_tArray  __attribute__((export_name("TS_SpliceAck_get_chain_hash"))) TS_SpliceAck_get_chain_hash(uint64_t this_ptr) {
44055         LDKSpliceAck this_ptr_conv;
44056         this_ptr_conv.inner = untag_ptr(this_ptr);
44057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44059         this_ptr_conv.is_owned = false;
44060         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44061         memcpy(ret_arr->elems, *SpliceAck_get_chain_hash(&this_ptr_conv), 32);
44062         return ret_arr;
44063 }
44064
44065 void  __attribute__((export_name("TS_SpliceAck_set_chain_hash"))) TS_SpliceAck_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
44066         LDKSpliceAck this_ptr_conv;
44067         this_ptr_conv.inner = untag_ptr(this_ptr);
44068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44070         this_ptr_conv.is_owned = false;
44071         LDKThirtyTwoBytes val_ref;
44072         CHECK(val->arr_len == 32);
44073         memcpy(val_ref.data, val->elems, 32); FREE(val);
44074         SpliceAck_set_chain_hash(&this_ptr_conv, val_ref);
44075 }
44076
44077 int64_t  __attribute__((export_name("TS_SpliceAck_get_relative_satoshis"))) TS_SpliceAck_get_relative_satoshis(uint64_t this_ptr) {
44078         LDKSpliceAck this_ptr_conv;
44079         this_ptr_conv.inner = untag_ptr(this_ptr);
44080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44082         this_ptr_conv.is_owned = false;
44083         int64_t ret_conv = SpliceAck_get_relative_satoshis(&this_ptr_conv);
44084         return ret_conv;
44085 }
44086
44087 void  __attribute__((export_name("TS_SpliceAck_set_relative_satoshis"))) TS_SpliceAck_set_relative_satoshis(uint64_t this_ptr, int64_t val) {
44088         LDKSpliceAck this_ptr_conv;
44089         this_ptr_conv.inner = untag_ptr(this_ptr);
44090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44092         this_ptr_conv.is_owned = false;
44093         SpliceAck_set_relative_satoshis(&this_ptr_conv, val);
44094 }
44095
44096 int8_tArray  __attribute__((export_name("TS_SpliceAck_get_funding_pubkey"))) TS_SpliceAck_get_funding_pubkey(uint64_t this_ptr) {
44097         LDKSpliceAck this_ptr_conv;
44098         this_ptr_conv.inner = untag_ptr(this_ptr);
44099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44101         this_ptr_conv.is_owned = false;
44102         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44103         memcpy(ret_arr->elems, SpliceAck_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
44104         return ret_arr;
44105 }
44106
44107 void  __attribute__((export_name("TS_SpliceAck_set_funding_pubkey"))) TS_SpliceAck_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
44108         LDKSpliceAck this_ptr_conv;
44109         this_ptr_conv.inner = untag_ptr(this_ptr);
44110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44112         this_ptr_conv.is_owned = false;
44113         LDKPublicKey val_ref;
44114         CHECK(val->arr_len == 33);
44115         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44116         SpliceAck_set_funding_pubkey(&this_ptr_conv, val_ref);
44117 }
44118
44119 uint64_t  __attribute__((export_name("TS_SpliceAck_new"))) TS_SpliceAck_new(int8_tArray channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int8_tArray funding_pubkey_arg) {
44120         LDKThirtyTwoBytes channel_id_arg_ref;
44121         CHECK(channel_id_arg->arr_len == 32);
44122         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44123         LDKThirtyTwoBytes chain_hash_arg_ref;
44124         CHECK(chain_hash_arg->arr_len == 32);
44125         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44126         LDKPublicKey funding_pubkey_arg_ref;
44127         CHECK(funding_pubkey_arg->arr_len == 33);
44128         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
44129         LDKSpliceAck ret_var = SpliceAck_new(channel_id_arg_ref, chain_hash_arg_ref, relative_satoshis_arg, funding_pubkey_arg_ref);
44130         uint64_t ret_ref = 0;
44131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44133         return ret_ref;
44134 }
44135
44136 static inline uint64_t SpliceAck_clone_ptr(LDKSpliceAck *NONNULL_PTR arg) {
44137         LDKSpliceAck ret_var = SpliceAck_clone(arg);
44138         uint64_t ret_ref = 0;
44139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44141         return ret_ref;
44142 }
44143 int64_t  __attribute__((export_name("TS_SpliceAck_clone_ptr"))) TS_SpliceAck_clone_ptr(uint64_t arg) {
44144         LDKSpliceAck arg_conv;
44145         arg_conv.inner = untag_ptr(arg);
44146         arg_conv.is_owned = ptr_is_owned(arg);
44147         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44148         arg_conv.is_owned = false;
44149         int64_t ret_conv = SpliceAck_clone_ptr(&arg_conv);
44150         return ret_conv;
44151 }
44152
44153 uint64_t  __attribute__((export_name("TS_SpliceAck_clone"))) TS_SpliceAck_clone(uint64_t orig) {
44154         LDKSpliceAck orig_conv;
44155         orig_conv.inner = untag_ptr(orig);
44156         orig_conv.is_owned = ptr_is_owned(orig);
44157         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44158         orig_conv.is_owned = false;
44159         LDKSpliceAck ret_var = SpliceAck_clone(&orig_conv);
44160         uint64_t ret_ref = 0;
44161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44163         return ret_ref;
44164 }
44165
44166 jboolean  __attribute__((export_name("TS_SpliceAck_eq"))) TS_SpliceAck_eq(uint64_t a, uint64_t b) {
44167         LDKSpliceAck a_conv;
44168         a_conv.inner = untag_ptr(a);
44169         a_conv.is_owned = ptr_is_owned(a);
44170         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44171         a_conv.is_owned = false;
44172         LDKSpliceAck b_conv;
44173         b_conv.inner = untag_ptr(b);
44174         b_conv.is_owned = ptr_is_owned(b);
44175         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44176         b_conv.is_owned = false;
44177         jboolean ret_conv = SpliceAck_eq(&a_conv, &b_conv);
44178         return ret_conv;
44179 }
44180
44181 void  __attribute__((export_name("TS_SpliceLocked_free"))) TS_SpliceLocked_free(uint64_t this_obj) {
44182         LDKSpliceLocked this_obj_conv;
44183         this_obj_conv.inner = untag_ptr(this_obj);
44184         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44186         SpliceLocked_free(this_obj_conv);
44187 }
44188
44189 int8_tArray  __attribute__((export_name("TS_SpliceLocked_get_channel_id"))) TS_SpliceLocked_get_channel_id(uint64_t this_ptr) {
44190         LDKSpliceLocked this_ptr_conv;
44191         this_ptr_conv.inner = untag_ptr(this_ptr);
44192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44194         this_ptr_conv.is_owned = false;
44195         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44196         memcpy(ret_arr->elems, *SpliceLocked_get_channel_id(&this_ptr_conv), 32);
44197         return ret_arr;
44198 }
44199
44200 void  __attribute__((export_name("TS_SpliceLocked_set_channel_id"))) TS_SpliceLocked_set_channel_id(uint64_t this_ptr, int8_tArray val) {
44201         LDKSpliceLocked this_ptr_conv;
44202         this_ptr_conv.inner = untag_ptr(this_ptr);
44203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44205         this_ptr_conv.is_owned = false;
44206         LDKThirtyTwoBytes val_ref;
44207         CHECK(val->arr_len == 32);
44208         memcpy(val_ref.data, val->elems, 32); FREE(val);
44209         SpliceLocked_set_channel_id(&this_ptr_conv, val_ref);
44210 }
44211
44212 uint64_t  __attribute__((export_name("TS_SpliceLocked_new"))) TS_SpliceLocked_new(int8_tArray channel_id_arg) {
44213         LDKThirtyTwoBytes channel_id_arg_ref;
44214         CHECK(channel_id_arg->arr_len == 32);
44215         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44216         LDKSpliceLocked ret_var = SpliceLocked_new(channel_id_arg_ref);
44217         uint64_t ret_ref = 0;
44218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44220         return ret_ref;
44221 }
44222
44223 static inline uint64_t SpliceLocked_clone_ptr(LDKSpliceLocked *NONNULL_PTR arg) {
44224         LDKSpliceLocked ret_var = SpliceLocked_clone(arg);
44225         uint64_t ret_ref = 0;
44226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44228         return ret_ref;
44229 }
44230 int64_t  __attribute__((export_name("TS_SpliceLocked_clone_ptr"))) TS_SpliceLocked_clone_ptr(uint64_t arg) {
44231         LDKSpliceLocked arg_conv;
44232         arg_conv.inner = untag_ptr(arg);
44233         arg_conv.is_owned = ptr_is_owned(arg);
44234         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44235         arg_conv.is_owned = false;
44236         int64_t ret_conv = SpliceLocked_clone_ptr(&arg_conv);
44237         return ret_conv;
44238 }
44239
44240 uint64_t  __attribute__((export_name("TS_SpliceLocked_clone"))) TS_SpliceLocked_clone(uint64_t orig) {
44241         LDKSpliceLocked orig_conv;
44242         orig_conv.inner = untag_ptr(orig);
44243         orig_conv.is_owned = ptr_is_owned(orig);
44244         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44245         orig_conv.is_owned = false;
44246         LDKSpliceLocked ret_var = SpliceLocked_clone(&orig_conv);
44247         uint64_t ret_ref = 0;
44248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44250         return ret_ref;
44251 }
44252
44253 jboolean  __attribute__((export_name("TS_SpliceLocked_eq"))) TS_SpliceLocked_eq(uint64_t a, uint64_t b) {
44254         LDKSpliceLocked a_conv;
44255         a_conv.inner = untag_ptr(a);
44256         a_conv.is_owned = ptr_is_owned(a);
44257         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44258         a_conv.is_owned = false;
44259         LDKSpliceLocked b_conv;
44260         b_conv.inner = untag_ptr(b);
44261         b_conv.is_owned = ptr_is_owned(b);
44262         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44263         b_conv.is_owned = false;
44264         jboolean ret_conv = SpliceLocked_eq(&a_conv, &b_conv);
44265         return ret_conv;
44266 }
44267
44268 void  __attribute__((export_name("TS_TxAddInput_free"))) TS_TxAddInput_free(uint64_t this_obj) {
44269         LDKTxAddInput this_obj_conv;
44270         this_obj_conv.inner = untag_ptr(this_obj);
44271         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44273         TxAddInput_free(this_obj_conv);
44274 }
44275
44276 int8_tArray  __attribute__((export_name("TS_TxAddInput_get_channel_id"))) TS_TxAddInput_get_channel_id(uint64_t this_ptr) {
44277         LDKTxAddInput this_ptr_conv;
44278         this_ptr_conv.inner = untag_ptr(this_ptr);
44279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44281         this_ptr_conv.is_owned = false;
44282         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44283         memcpy(ret_arr->elems, *TxAddInput_get_channel_id(&this_ptr_conv), 32);
44284         return ret_arr;
44285 }
44286
44287 void  __attribute__((export_name("TS_TxAddInput_set_channel_id"))) TS_TxAddInput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
44288         LDKTxAddInput this_ptr_conv;
44289         this_ptr_conv.inner = untag_ptr(this_ptr);
44290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44292         this_ptr_conv.is_owned = false;
44293         LDKThirtyTwoBytes val_ref;
44294         CHECK(val->arr_len == 32);
44295         memcpy(val_ref.data, val->elems, 32); FREE(val);
44296         TxAddInput_set_channel_id(&this_ptr_conv, val_ref);
44297 }
44298
44299 int64_t  __attribute__((export_name("TS_TxAddInput_get_serial_id"))) TS_TxAddInput_get_serial_id(uint64_t this_ptr) {
44300         LDKTxAddInput this_ptr_conv;
44301         this_ptr_conv.inner = untag_ptr(this_ptr);
44302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44304         this_ptr_conv.is_owned = false;
44305         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
44306         return ret_conv;
44307 }
44308
44309 void  __attribute__((export_name("TS_TxAddInput_set_serial_id"))) TS_TxAddInput_set_serial_id(uint64_t this_ptr, int64_t val) {
44310         LDKTxAddInput this_ptr_conv;
44311         this_ptr_conv.inner = untag_ptr(this_ptr);
44312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44314         this_ptr_conv.is_owned = false;
44315         TxAddInput_set_serial_id(&this_ptr_conv, val);
44316 }
44317
44318 uint64_t  __attribute__((export_name("TS_TxAddInput_get_prevtx"))) TS_TxAddInput_get_prevtx(uint64_t this_ptr) {
44319         LDKTxAddInput this_ptr_conv;
44320         this_ptr_conv.inner = untag_ptr(this_ptr);
44321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44323         this_ptr_conv.is_owned = false;
44324         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
44325         uint64_t ret_ref = 0;
44326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44328         return ret_ref;
44329 }
44330
44331 void  __attribute__((export_name("TS_TxAddInput_set_prevtx"))) TS_TxAddInput_set_prevtx(uint64_t this_ptr, uint64_t val) {
44332         LDKTxAddInput this_ptr_conv;
44333         this_ptr_conv.inner = untag_ptr(this_ptr);
44334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44336         this_ptr_conv.is_owned = false;
44337         LDKTransactionU16LenLimited val_conv;
44338         val_conv.inner = untag_ptr(val);
44339         val_conv.is_owned = ptr_is_owned(val);
44340         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44341         val_conv = TransactionU16LenLimited_clone(&val_conv);
44342         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
44343 }
44344
44345 int32_t  __attribute__((export_name("TS_TxAddInput_get_prevtx_out"))) TS_TxAddInput_get_prevtx_out(uint64_t this_ptr) {
44346         LDKTxAddInput this_ptr_conv;
44347         this_ptr_conv.inner = untag_ptr(this_ptr);
44348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44350         this_ptr_conv.is_owned = false;
44351         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
44352         return ret_conv;
44353 }
44354
44355 void  __attribute__((export_name("TS_TxAddInput_set_prevtx_out"))) TS_TxAddInput_set_prevtx_out(uint64_t this_ptr, int32_t val) {
44356         LDKTxAddInput this_ptr_conv;
44357         this_ptr_conv.inner = untag_ptr(this_ptr);
44358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44360         this_ptr_conv.is_owned = false;
44361         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
44362 }
44363
44364 int32_t  __attribute__((export_name("TS_TxAddInput_get_sequence"))) TS_TxAddInput_get_sequence(uint64_t this_ptr) {
44365         LDKTxAddInput this_ptr_conv;
44366         this_ptr_conv.inner = untag_ptr(this_ptr);
44367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44369         this_ptr_conv.is_owned = false;
44370         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
44371         return ret_conv;
44372 }
44373
44374 void  __attribute__((export_name("TS_TxAddInput_set_sequence"))) TS_TxAddInput_set_sequence(uint64_t this_ptr, int32_t val) {
44375         LDKTxAddInput this_ptr_conv;
44376         this_ptr_conv.inner = untag_ptr(this_ptr);
44377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44379         this_ptr_conv.is_owned = false;
44380         TxAddInput_set_sequence(&this_ptr_conv, val);
44381 }
44382
44383 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) {
44384         LDKThirtyTwoBytes channel_id_arg_ref;
44385         CHECK(channel_id_arg->arr_len == 32);
44386         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44387         LDKTransactionU16LenLimited prevtx_arg_conv;
44388         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
44389         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
44390         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
44391         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
44392         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_ref, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
44393         uint64_t ret_ref = 0;
44394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44396         return ret_ref;
44397 }
44398
44399 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
44400         LDKTxAddInput ret_var = TxAddInput_clone(arg);
44401         uint64_t ret_ref = 0;
44402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44404         return ret_ref;
44405 }
44406 int64_t  __attribute__((export_name("TS_TxAddInput_clone_ptr"))) TS_TxAddInput_clone_ptr(uint64_t arg) {
44407         LDKTxAddInput arg_conv;
44408         arg_conv.inner = untag_ptr(arg);
44409         arg_conv.is_owned = ptr_is_owned(arg);
44410         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44411         arg_conv.is_owned = false;
44412         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
44413         return ret_conv;
44414 }
44415
44416 uint64_t  __attribute__((export_name("TS_TxAddInput_clone"))) TS_TxAddInput_clone(uint64_t orig) {
44417         LDKTxAddInput orig_conv;
44418         orig_conv.inner = untag_ptr(orig);
44419         orig_conv.is_owned = ptr_is_owned(orig);
44420         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44421         orig_conv.is_owned = false;
44422         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
44423         uint64_t ret_ref = 0;
44424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44426         return ret_ref;
44427 }
44428
44429 int64_t  __attribute__((export_name("TS_TxAddInput_hash"))) TS_TxAddInput_hash(uint64_t o) {
44430         LDKTxAddInput o_conv;
44431         o_conv.inner = untag_ptr(o);
44432         o_conv.is_owned = ptr_is_owned(o);
44433         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44434         o_conv.is_owned = false;
44435         int64_t ret_conv = TxAddInput_hash(&o_conv);
44436         return ret_conv;
44437 }
44438
44439 jboolean  __attribute__((export_name("TS_TxAddInput_eq"))) TS_TxAddInput_eq(uint64_t a, uint64_t b) {
44440         LDKTxAddInput a_conv;
44441         a_conv.inner = untag_ptr(a);
44442         a_conv.is_owned = ptr_is_owned(a);
44443         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44444         a_conv.is_owned = false;
44445         LDKTxAddInput b_conv;
44446         b_conv.inner = untag_ptr(b);
44447         b_conv.is_owned = ptr_is_owned(b);
44448         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44449         b_conv.is_owned = false;
44450         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
44451         return ret_conv;
44452 }
44453
44454 void  __attribute__((export_name("TS_TxAddOutput_free"))) TS_TxAddOutput_free(uint64_t this_obj) {
44455         LDKTxAddOutput this_obj_conv;
44456         this_obj_conv.inner = untag_ptr(this_obj);
44457         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44459         TxAddOutput_free(this_obj_conv);
44460 }
44461
44462 int8_tArray  __attribute__((export_name("TS_TxAddOutput_get_channel_id"))) TS_TxAddOutput_get_channel_id(uint64_t this_ptr) {
44463         LDKTxAddOutput this_ptr_conv;
44464         this_ptr_conv.inner = untag_ptr(this_ptr);
44465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44467         this_ptr_conv.is_owned = false;
44468         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44469         memcpy(ret_arr->elems, *TxAddOutput_get_channel_id(&this_ptr_conv), 32);
44470         return ret_arr;
44471 }
44472
44473 void  __attribute__((export_name("TS_TxAddOutput_set_channel_id"))) TS_TxAddOutput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
44474         LDKTxAddOutput this_ptr_conv;
44475         this_ptr_conv.inner = untag_ptr(this_ptr);
44476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44478         this_ptr_conv.is_owned = false;
44479         LDKThirtyTwoBytes val_ref;
44480         CHECK(val->arr_len == 32);
44481         memcpy(val_ref.data, val->elems, 32); FREE(val);
44482         TxAddOutput_set_channel_id(&this_ptr_conv, val_ref);
44483 }
44484
44485 int64_t  __attribute__((export_name("TS_TxAddOutput_get_serial_id"))) TS_TxAddOutput_get_serial_id(uint64_t this_ptr) {
44486         LDKTxAddOutput this_ptr_conv;
44487         this_ptr_conv.inner = untag_ptr(this_ptr);
44488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44490         this_ptr_conv.is_owned = false;
44491         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
44492         return ret_conv;
44493 }
44494
44495 void  __attribute__((export_name("TS_TxAddOutput_set_serial_id"))) TS_TxAddOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
44496         LDKTxAddOutput this_ptr_conv;
44497         this_ptr_conv.inner = untag_ptr(this_ptr);
44498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44500         this_ptr_conv.is_owned = false;
44501         TxAddOutput_set_serial_id(&this_ptr_conv, val);
44502 }
44503
44504 int64_t  __attribute__((export_name("TS_TxAddOutput_get_sats"))) TS_TxAddOutput_get_sats(uint64_t this_ptr) {
44505         LDKTxAddOutput this_ptr_conv;
44506         this_ptr_conv.inner = untag_ptr(this_ptr);
44507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44509         this_ptr_conv.is_owned = false;
44510         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
44511         return ret_conv;
44512 }
44513
44514 void  __attribute__((export_name("TS_TxAddOutput_set_sats"))) TS_TxAddOutput_set_sats(uint64_t this_ptr, int64_t val) {
44515         LDKTxAddOutput this_ptr_conv;
44516         this_ptr_conv.inner = untag_ptr(this_ptr);
44517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44519         this_ptr_conv.is_owned = false;
44520         TxAddOutput_set_sats(&this_ptr_conv, val);
44521 }
44522
44523 int8_tArray  __attribute__((export_name("TS_TxAddOutput_get_script"))) TS_TxAddOutput_get_script(uint64_t this_ptr) {
44524         LDKTxAddOutput this_ptr_conv;
44525         this_ptr_conv.inner = untag_ptr(this_ptr);
44526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44528         this_ptr_conv.is_owned = false;
44529         LDKCVec_u8Z ret_var = TxAddOutput_get_script(&this_ptr_conv);
44530         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44531         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44532         CVec_u8Z_free(ret_var);
44533         return ret_arr;
44534 }
44535
44536 void  __attribute__((export_name("TS_TxAddOutput_set_script"))) TS_TxAddOutput_set_script(uint64_t this_ptr, int8_tArray val) {
44537         LDKTxAddOutput this_ptr_conv;
44538         this_ptr_conv.inner = untag_ptr(this_ptr);
44539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44541         this_ptr_conv.is_owned = false;
44542         LDKCVec_u8Z val_ref;
44543         val_ref.datalen = val->arr_len;
44544         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
44545         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
44546         TxAddOutput_set_script(&this_ptr_conv, val_ref);
44547 }
44548
44549 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) {
44550         LDKThirtyTwoBytes channel_id_arg_ref;
44551         CHECK(channel_id_arg->arr_len == 32);
44552         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44553         LDKCVec_u8Z script_arg_ref;
44554         script_arg_ref.datalen = script_arg->arr_len;
44555         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
44556         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
44557         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_ref, serial_id_arg, sats_arg, script_arg_ref);
44558         uint64_t ret_ref = 0;
44559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44561         return ret_ref;
44562 }
44563
44564 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
44565         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
44566         uint64_t ret_ref = 0;
44567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44569         return ret_ref;
44570 }
44571 int64_t  __attribute__((export_name("TS_TxAddOutput_clone_ptr"))) TS_TxAddOutput_clone_ptr(uint64_t arg) {
44572         LDKTxAddOutput arg_conv;
44573         arg_conv.inner = untag_ptr(arg);
44574         arg_conv.is_owned = ptr_is_owned(arg);
44575         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44576         arg_conv.is_owned = false;
44577         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
44578         return ret_conv;
44579 }
44580
44581 uint64_t  __attribute__((export_name("TS_TxAddOutput_clone"))) TS_TxAddOutput_clone(uint64_t orig) {
44582         LDKTxAddOutput orig_conv;
44583         orig_conv.inner = untag_ptr(orig);
44584         orig_conv.is_owned = ptr_is_owned(orig);
44585         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44586         orig_conv.is_owned = false;
44587         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
44588         uint64_t ret_ref = 0;
44589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44591         return ret_ref;
44592 }
44593
44594 int64_t  __attribute__((export_name("TS_TxAddOutput_hash"))) TS_TxAddOutput_hash(uint64_t o) {
44595         LDKTxAddOutput o_conv;
44596         o_conv.inner = untag_ptr(o);
44597         o_conv.is_owned = ptr_is_owned(o);
44598         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44599         o_conv.is_owned = false;
44600         int64_t ret_conv = TxAddOutput_hash(&o_conv);
44601         return ret_conv;
44602 }
44603
44604 jboolean  __attribute__((export_name("TS_TxAddOutput_eq"))) TS_TxAddOutput_eq(uint64_t a, uint64_t b) {
44605         LDKTxAddOutput a_conv;
44606         a_conv.inner = untag_ptr(a);
44607         a_conv.is_owned = ptr_is_owned(a);
44608         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44609         a_conv.is_owned = false;
44610         LDKTxAddOutput b_conv;
44611         b_conv.inner = untag_ptr(b);
44612         b_conv.is_owned = ptr_is_owned(b);
44613         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44614         b_conv.is_owned = false;
44615         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
44616         return ret_conv;
44617 }
44618
44619 void  __attribute__((export_name("TS_TxRemoveInput_free"))) TS_TxRemoveInput_free(uint64_t this_obj) {
44620         LDKTxRemoveInput this_obj_conv;
44621         this_obj_conv.inner = untag_ptr(this_obj);
44622         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44624         TxRemoveInput_free(this_obj_conv);
44625 }
44626
44627 int8_tArray  __attribute__((export_name("TS_TxRemoveInput_get_channel_id"))) TS_TxRemoveInput_get_channel_id(uint64_t this_ptr) {
44628         LDKTxRemoveInput this_ptr_conv;
44629         this_ptr_conv.inner = untag_ptr(this_ptr);
44630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44632         this_ptr_conv.is_owned = false;
44633         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44634         memcpy(ret_arr->elems, *TxRemoveInput_get_channel_id(&this_ptr_conv), 32);
44635         return ret_arr;
44636 }
44637
44638 void  __attribute__((export_name("TS_TxRemoveInput_set_channel_id"))) TS_TxRemoveInput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
44639         LDKTxRemoveInput this_ptr_conv;
44640         this_ptr_conv.inner = untag_ptr(this_ptr);
44641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44643         this_ptr_conv.is_owned = false;
44644         LDKThirtyTwoBytes val_ref;
44645         CHECK(val->arr_len == 32);
44646         memcpy(val_ref.data, val->elems, 32); FREE(val);
44647         TxRemoveInput_set_channel_id(&this_ptr_conv, val_ref);
44648 }
44649
44650 int64_t  __attribute__((export_name("TS_TxRemoveInput_get_serial_id"))) TS_TxRemoveInput_get_serial_id(uint64_t this_ptr) {
44651         LDKTxRemoveInput this_ptr_conv;
44652         this_ptr_conv.inner = untag_ptr(this_ptr);
44653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44655         this_ptr_conv.is_owned = false;
44656         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
44657         return ret_conv;
44658 }
44659
44660 void  __attribute__((export_name("TS_TxRemoveInput_set_serial_id"))) TS_TxRemoveInput_set_serial_id(uint64_t this_ptr, int64_t val) {
44661         LDKTxRemoveInput this_ptr_conv;
44662         this_ptr_conv.inner = untag_ptr(this_ptr);
44663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44665         this_ptr_conv.is_owned = false;
44666         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
44667 }
44668
44669 uint64_t  __attribute__((export_name("TS_TxRemoveInput_new"))) TS_TxRemoveInput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
44670         LDKThirtyTwoBytes channel_id_arg_ref;
44671         CHECK(channel_id_arg->arr_len == 32);
44672         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44673         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_ref, serial_id_arg);
44674         uint64_t ret_ref = 0;
44675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44677         return ret_ref;
44678 }
44679
44680 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
44681         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
44682         uint64_t ret_ref = 0;
44683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44685         return ret_ref;
44686 }
44687 int64_t  __attribute__((export_name("TS_TxRemoveInput_clone_ptr"))) TS_TxRemoveInput_clone_ptr(uint64_t arg) {
44688         LDKTxRemoveInput arg_conv;
44689         arg_conv.inner = untag_ptr(arg);
44690         arg_conv.is_owned = ptr_is_owned(arg);
44691         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44692         arg_conv.is_owned = false;
44693         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
44694         return ret_conv;
44695 }
44696
44697 uint64_t  __attribute__((export_name("TS_TxRemoveInput_clone"))) TS_TxRemoveInput_clone(uint64_t orig) {
44698         LDKTxRemoveInput orig_conv;
44699         orig_conv.inner = untag_ptr(orig);
44700         orig_conv.is_owned = ptr_is_owned(orig);
44701         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44702         orig_conv.is_owned = false;
44703         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
44704         uint64_t ret_ref = 0;
44705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44707         return ret_ref;
44708 }
44709
44710 int64_t  __attribute__((export_name("TS_TxRemoveInput_hash"))) TS_TxRemoveInput_hash(uint64_t o) {
44711         LDKTxRemoveInput o_conv;
44712         o_conv.inner = untag_ptr(o);
44713         o_conv.is_owned = ptr_is_owned(o);
44714         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44715         o_conv.is_owned = false;
44716         int64_t ret_conv = TxRemoveInput_hash(&o_conv);
44717         return ret_conv;
44718 }
44719
44720 jboolean  __attribute__((export_name("TS_TxRemoveInput_eq"))) TS_TxRemoveInput_eq(uint64_t a, uint64_t b) {
44721         LDKTxRemoveInput a_conv;
44722         a_conv.inner = untag_ptr(a);
44723         a_conv.is_owned = ptr_is_owned(a);
44724         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44725         a_conv.is_owned = false;
44726         LDKTxRemoveInput b_conv;
44727         b_conv.inner = untag_ptr(b);
44728         b_conv.is_owned = ptr_is_owned(b);
44729         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44730         b_conv.is_owned = false;
44731         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
44732         return ret_conv;
44733 }
44734
44735 void  __attribute__((export_name("TS_TxRemoveOutput_free"))) TS_TxRemoveOutput_free(uint64_t this_obj) {
44736         LDKTxRemoveOutput this_obj_conv;
44737         this_obj_conv.inner = untag_ptr(this_obj);
44738         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44740         TxRemoveOutput_free(this_obj_conv);
44741 }
44742
44743 int8_tArray  __attribute__((export_name("TS_TxRemoveOutput_get_channel_id"))) TS_TxRemoveOutput_get_channel_id(uint64_t this_ptr) {
44744         LDKTxRemoveOutput this_ptr_conv;
44745         this_ptr_conv.inner = untag_ptr(this_ptr);
44746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44748         this_ptr_conv.is_owned = false;
44749         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44750         memcpy(ret_arr->elems, *TxRemoveOutput_get_channel_id(&this_ptr_conv), 32);
44751         return ret_arr;
44752 }
44753
44754 void  __attribute__((export_name("TS_TxRemoveOutput_set_channel_id"))) TS_TxRemoveOutput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
44755         LDKTxRemoveOutput this_ptr_conv;
44756         this_ptr_conv.inner = untag_ptr(this_ptr);
44757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44759         this_ptr_conv.is_owned = false;
44760         LDKThirtyTwoBytes val_ref;
44761         CHECK(val->arr_len == 32);
44762         memcpy(val_ref.data, val->elems, 32); FREE(val);
44763         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_ref);
44764 }
44765
44766 int64_t  __attribute__((export_name("TS_TxRemoveOutput_get_serial_id"))) TS_TxRemoveOutput_get_serial_id(uint64_t this_ptr) {
44767         LDKTxRemoveOutput this_ptr_conv;
44768         this_ptr_conv.inner = untag_ptr(this_ptr);
44769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44771         this_ptr_conv.is_owned = false;
44772         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
44773         return ret_conv;
44774 }
44775
44776 void  __attribute__((export_name("TS_TxRemoveOutput_set_serial_id"))) TS_TxRemoveOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
44777         LDKTxRemoveOutput this_ptr_conv;
44778         this_ptr_conv.inner = untag_ptr(this_ptr);
44779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44781         this_ptr_conv.is_owned = false;
44782         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
44783 }
44784
44785 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_new"))) TS_TxRemoveOutput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
44786         LDKThirtyTwoBytes channel_id_arg_ref;
44787         CHECK(channel_id_arg->arr_len == 32);
44788         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44789         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_ref, serial_id_arg);
44790         uint64_t ret_ref = 0;
44791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44793         return ret_ref;
44794 }
44795
44796 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
44797         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
44798         uint64_t ret_ref = 0;
44799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44801         return ret_ref;
44802 }
44803 int64_t  __attribute__((export_name("TS_TxRemoveOutput_clone_ptr"))) TS_TxRemoveOutput_clone_ptr(uint64_t arg) {
44804         LDKTxRemoveOutput arg_conv;
44805         arg_conv.inner = untag_ptr(arg);
44806         arg_conv.is_owned = ptr_is_owned(arg);
44807         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44808         arg_conv.is_owned = false;
44809         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
44810         return ret_conv;
44811 }
44812
44813 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_clone"))) TS_TxRemoveOutput_clone(uint64_t orig) {
44814         LDKTxRemoveOutput orig_conv;
44815         orig_conv.inner = untag_ptr(orig);
44816         orig_conv.is_owned = ptr_is_owned(orig);
44817         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44818         orig_conv.is_owned = false;
44819         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
44820         uint64_t ret_ref = 0;
44821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44823         return ret_ref;
44824 }
44825
44826 int64_t  __attribute__((export_name("TS_TxRemoveOutput_hash"))) TS_TxRemoveOutput_hash(uint64_t o) {
44827         LDKTxRemoveOutput o_conv;
44828         o_conv.inner = untag_ptr(o);
44829         o_conv.is_owned = ptr_is_owned(o);
44830         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44831         o_conv.is_owned = false;
44832         int64_t ret_conv = TxRemoveOutput_hash(&o_conv);
44833         return ret_conv;
44834 }
44835
44836 jboolean  __attribute__((export_name("TS_TxRemoveOutput_eq"))) TS_TxRemoveOutput_eq(uint64_t a, uint64_t b) {
44837         LDKTxRemoveOutput a_conv;
44838         a_conv.inner = untag_ptr(a);
44839         a_conv.is_owned = ptr_is_owned(a);
44840         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44841         a_conv.is_owned = false;
44842         LDKTxRemoveOutput b_conv;
44843         b_conv.inner = untag_ptr(b);
44844         b_conv.is_owned = ptr_is_owned(b);
44845         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44846         b_conv.is_owned = false;
44847         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
44848         return ret_conv;
44849 }
44850
44851 void  __attribute__((export_name("TS_TxComplete_free"))) TS_TxComplete_free(uint64_t this_obj) {
44852         LDKTxComplete this_obj_conv;
44853         this_obj_conv.inner = untag_ptr(this_obj);
44854         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44856         TxComplete_free(this_obj_conv);
44857 }
44858
44859 int8_tArray  __attribute__((export_name("TS_TxComplete_get_channel_id"))) TS_TxComplete_get_channel_id(uint64_t this_ptr) {
44860         LDKTxComplete this_ptr_conv;
44861         this_ptr_conv.inner = untag_ptr(this_ptr);
44862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44864         this_ptr_conv.is_owned = false;
44865         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44866         memcpy(ret_arr->elems, *TxComplete_get_channel_id(&this_ptr_conv), 32);
44867         return ret_arr;
44868 }
44869
44870 void  __attribute__((export_name("TS_TxComplete_set_channel_id"))) TS_TxComplete_set_channel_id(uint64_t this_ptr, int8_tArray val) {
44871         LDKTxComplete this_ptr_conv;
44872         this_ptr_conv.inner = untag_ptr(this_ptr);
44873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44875         this_ptr_conv.is_owned = false;
44876         LDKThirtyTwoBytes val_ref;
44877         CHECK(val->arr_len == 32);
44878         memcpy(val_ref.data, val->elems, 32); FREE(val);
44879         TxComplete_set_channel_id(&this_ptr_conv, val_ref);
44880 }
44881
44882 uint64_t  __attribute__((export_name("TS_TxComplete_new"))) TS_TxComplete_new(int8_tArray channel_id_arg) {
44883         LDKThirtyTwoBytes channel_id_arg_ref;
44884         CHECK(channel_id_arg->arr_len == 32);
44885         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44886         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_ref);
44887         uint64_t ret_ref = 0;
44888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44890         return ret_ref;
44891 }
44892
44893 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
44894         LDKTxComplete ret_var = TxComplete_clone(arg);
44895         uint64_t ret_ref = 0;
44896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44898         return ret_ref;
44899 }
44900 int64_t  __attribute__((export_name("TS_TxComplete_clone_ptr"))) TS_TxComplete_clone_ptr(uint64_t arg) {
44901         LDKTxComplete arg_conv;
44902         arg_conv.inner = untag_ptr(arg);
44903         arg_conv.is_owned = ptr_is_owned(arg);
44904         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44905         arg_conv.is_owned = false;
44906         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
44907         return ret_conv;
44908 }
44909
44910 uint64_t  __attribute__((export_name("TS_TxComplete_clone"))) TS_TxComplete_clone(uint64_t orig) {
44911         LDKTxComplete orig_conv;
44912         orig_conv.inner = untag_ptr(orig);
44913         orig_conv.is_owned = ptr_is_owned(orig);
44914         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44915         orig_conv.is_owned = false;
44916         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
44917         uint64_t ret_ref = 0;
44918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44920         return ret_ref;
44921 }
44922
44923 int64_t  __attribute__((export_name("TS_TxComplete_hash"))) TS_TxComplete_hash(uint64_t o) {
44924         LDKTxComplete o_conv;
44925         o_conv.inner = untag_ptr(o);
44926         o_conv.is_owned = ptr_is_owned(o);
44927         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44928         o_conv.is_owned = false;
44929         int64_t ret_conv = TxComplete_hash(&o_conv);
44930         return ret_conv;
44931 }
44932
44933 jboolean  __attribute__((export_name("TS_TxComplete_eq"))) TS_TxComplete_eq(uint64_t a, uint64_t b) {
44934         LDKTxComplete a_conv;
44935         a_conv.inner = untag_ptr(a);
44936         a_conv.is_owned = ptr_is_owned(a);
44937         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44938         a_conv.is_owned = false;
44939         LDKTxComplete b_conv;
44940         b_conv.inner = untag_ptr(b);
44941         b_conv.is_owned = ptr_is_owned(b);
44942         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44943         b_conv.is_owned = false;
44944         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
44945         return ret_conv;
44946 }
44947
44948 void  __attribute__((export_name("TS_TxSignatures_free"))) TS_TxSignatures_free(uint64_t this_obj) {
44949         LDKTxSignatures this_obj_conv;
44950         this_obj_conv.inner = untag_ptr(this_obj);
44951         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44953         TxSignatures_free(this_obj_conv);
44954 }
44955
44956 int8_tArray  __attribute__((export_name("TS_TxSignatures_get_channel_id"))) TS_TxSignatures_get_channel_id(uint64_t this_ptr) {
44957         LDKTxSignatures this_ptr_conv;
44958         this_ptr_conv.inner = untag_ptr(this_ptr);
44959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44961         this_ptr_conv.is_owned = false;
44962         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44963         memcpy(ret_arr->elems, *TxSignatures_get_channel_id(&this_ptr_conv), 32);
44964         return ret_arr;
44965 }
44966
44967 void  __attribute__((export_name("TS_TxSignatures_set_channel_id"))) TS_TxSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
44968         LDKTxSignatures this_ptr_conv;
44969         this_ptr_conv.inner = untag_ptr(this_ptr);
44970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44972         this_ptr_conv.is_owned = false;
44973         LDKThirtyTwoBytes val_ref;
44974         CHECK(val->arr_len == 32);
44975         memcpy(val_ref.data, val->elems, 32); FREE(val);
44976         TxSignatures_set_channel_id(&this_ptr_conv, val_ref);
44977 }
44978
44979 int8_tArray  __attribute__((export_name("TS_TxSignatures_get_tx_hash"))) TS_TxSignatures_get_tx_hash(uint64_t this_ptr) {
44980         LDKTxSignatures this_ptr_conv;
44981         this_ptr_conv.inner = untag_ptr(this_ptr);
44982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44984         this_ptr_conv.is_owned = false;
44985         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44986         memcpy(ret_arr->elems, *TxSignatures_get_tx_hash(&this_ptr_conv), 32);
44987         return ret_arr;
44988 }
44989
44990 void  __attribute__((export_name("TS_TxSignatures_set_tx_hash"))) TS_TxSignatures_set_tx_hash(uint64_t this_ptr, int8_tArray val) {
44991         LDKTxSignatures this_ptr_conv;
44992         this_ptr_conv.inner = untag_ptr(this_ptr);
44993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44995         this_ptr_conv.is_owned = false;
44996         LDKThirtyTwoBytes val_ref;
44997         CHECK(val->arr_len == 32);
44998         memcpy(val_ref.data, val->elems, 32); FREE(val);
44999         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
45000 }
45001
45002 ptrArray  __attribute__((export_name("TS_TxSignatures_get_witnesses"))) TS_TxSignatures_get_witnesses(uint64_t this_ptr) {
45003         LDKTxSignatures this_ptr_conv;
45004         this_ptr_conv.inner = untag_ptr(this_ptr);
45005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45007         this_ptr_conv.is_owned = false;
45008         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
45009         ptrArray ret_arr = NULL;
45010         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
45011         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
45012         for (size_t m = 0; m < ret_var.datalen; m++) {
45013                 LDKWitness ret_conv_12_var = ret_var.data[m];
45014                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
45015                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
45016                 Witness_free(ret_conv_12_var);
45017                 ret_arr_ptr[m] = ret_conv_12_arr;
45018         }
45019         
45020         FREE(ret_var.data);
45021         return ret_arr;
45022 }
45023
45024 void  __attribute__((export_name("TS_TxSignatures_set_witnesses"))) TS_TxSignatures_set_witnesses(uint64_t this_ptr, ptrArray val) {
45025         LDKTxSignatures this_ptr_conv;
45026         this_ptr_conv.inner = untag_ptr(this_ptr);
45027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45029         this_ptr_conv.is_owned = false;
45030         LDKCVec_WitnessZ val_constr;
45031         val_constr.datalen = val->arr_len;
45032         if (val_constr.datalen > 0)
45033                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
45034         else
45035                 val_constr.data = NULL;
45036         int8_tArray* val_vals = (void*) val->elems;
45037         for (size_t m = 0; m < val_constr.datalen; m++) {
45038                 int8_tArray val_conv_12 = val_vals[m];
45039                 LDKWitness val_conv_12_ref;
45040                 val_conv_12_ref.datalen = val_conv_12->arr_len;
45041                 val_conv_12_ref.data = MALLOC(val_conv_12_ref.datalen, "LDKWitness Bytes");
45042                 memcpy(val_conv_12_ref.data, val_conv_12->elems, val_conv_12_ref.datalen); FREE(val_conv_12);
45043                 val_conv_12_ref.data_is_owned = true;
45044                 val_constr.data[m] = val_conv_12_ref;
45045         }
45046         FREE(val);
45047         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
45048 }
45049
45050 uint64_t  __attribute__((export_name("TS_TxSignatures_new"))) TS_TxSignatures_new(int8_tArray channel_id_arg, int8_tArray tx_hash_arg, ptrArray witnesses_arg) {
45051         LDKThirtyTwoBytes channel_id_arg_ref;
45052         CHECK(channel_id_arg->arr_len == 32);
45053         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45054         LDKThirtyTwoBytes tx_hash_arg_ref;
45055         CHECK(tx_hash_arg->arr_len == 32);
45056         memcpy(tx_hash_arg_ref.data, tx_hash_arg->elems, 32); FREE(tx_hash_arg);
45057         LDKCVec_WitnessZ witnesses_arg_constr;
45058         witnesses_arg_constr.datalen = witnesses_arg->arr_len;
45059         if (witnesses_arg_constr.datalen > 0)
45060                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
45061         else
45062                 witnesses_arg_constr.data = NULL;
45063         int8_tArray* witnesses_arg_vals = (void*) witnesses_arg->elems;
45064         for (size_t m = 0; m < witnesses_arg_constr.datalen; m++) {
45065                 int8_tArray witnesses_arg_conv_12 = witnesses_arg_vals[m];
45066                 LDKWitness witnesses_arg_conv_12_ref;
45067                 witnesses_arg_conv_12_ref.datalen = witnesses_arg_conv_12->arr_len;
45068                 witnesses_arg_conv_12_ref.data = MALLOC(witnesses_arg_conv_12_ref.datalen, "LDKWitness Bytes");
45069                 memcpy(witnesses_arg_conv_12_ref.data, witnesses_arg_conv_12->elems, witnesses_arg_conv_12_ref.datalen); FREE(witnesses_arg_conv_12);
45070                 witnesses_arg_conv_12_ref.data_is_owned = true;
45071                 witnesses_arg_constr.data[m] = witnesses_arg_conv_12_ref;
45072         }
45073         FREE(witnesses_arg);
45074         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_ref, tx_hash_arg_ref, witnesses_arg_constr);
45075         uint64_t ret_ref = 0;
45076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45078         return ret_ref;
45079 }
45080
45081 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
45082         LDKTxSignatures ret_var = TxSignatures_clone(arg);
45083         uint64_t ret_ref = 0;
45084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45086         return ret_ref;
45087 }
45088 int64_t  __attribute__((export_name("TS_TxSignatures_clone_ptr"))) TS_TxSignatures_clone_ptr(uint64_t arg) {
45089         LDKTxSignatures arg_conv;
45090         arg_conv.inner = untag_ptr(arg);
45091         arg_conv.is_owned = ptr_is_owned(arg);
45092         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45093         arg_conv.is_owned = false;
45094         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
45095         return ret_conv;
45096 }
45097
45098 uint64_t  __attribute__((export_name("TS_TxSignatures_clone"))) TS_TxSignatures_clone(uint64_t orig) {
45099         LDKTxSignatures orig_conv;
45100         orig_conv.inner = untag_ptr(orig);
45101         orig_conv.is_owned = ptr_is_owned(orig);
45102         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45103         orig_conv.is_owned = false;
45104         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
45105         uint64_t ret_ref = 0;
45106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45108         return ret_ref;
45109 }
45110
45111 int64_t  __attribute__((export_name("TS_TxSignatures_hash"))) TS_TxSignatures_hash(uint64_t o) {
45112         LDKTxSignatures o_conv;
45113         o_conv.inner = untag_ptr(o);
45114         o_conv.is_owned = ptr_is_owned(o);
45115         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45116         o_conv.is_owned = false;
45117         int64_t ret_conv = TxSignatures_hash(&o_conv);
45118         return ret_conv;
45119 }
45120
45121 jboolean  __attribute__((export_name("TS_TxSignatures_eq"))) TS_TxSignatures_eq(uint64_t a, uint64_t b) {
45122         LDKTxSignatures a_conv;
45123         a_conv.inner = untag_ptr(a);
45124         a_conv.is_owned = ptr_is_owned(a);
45125         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45126         a_conv.is_owned = false;
45127         LDKTxSignatures b_conv;
45128         b_conv.inner = untag_ptr(b);
45129         b_conv.is_owned = ptr_is_owned(b);
45130         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45131         b_conv.is_owned = false;
45132         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
45133         return ret_conv;
45134 }
45135
45136 void  __attribute__((export_name("TS_TxInitRbf_free"))) TS_TxInitRbf_free(uint64_t this_obj) {
45137         LDKTxInitRbf this_obj_conv;
45138         this_obj_conv.inner = untag_ptr(this_obj);
45139         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45141         TxInitRbf_free(this_obj_conv);
45142 }
45143
45144 int8_tArray  __attribute__((export_name("TS_TxInitRbf_get_channel_id"))) TS_TxInitRbf_get_channel_id(uint64_t this_ptr) {
45145         LDKTxInitRbf this_ptr_conv;
45146         this_ptr_conv.inner = untag_ptr(this_ptr);
45147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45149         this_ptr_conv.is_owned = false;
45150         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45151         memcpy(ret_arr->elems, *TxInitRbf_get_channel_id(&this_ptr_conv), 32);
45152         return ret_arr;
45153 }
45154
45155 void  __attribute__((export_name("TS_TxInitRbf_set_channel_id"))) TS_TxInitRbf_set_channel_id(uint64_t this_ptr, int8_tArray val) {
45156         LDKTxInitRbf this_ptr_conv;
45157         this_ptr_conv.inner = untag_ptr(this_ptr);
45158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45160         this_ptr_conv.is_owned = false;
45161         LDKThirtyTwoBytes val_ref;
45162         CHECK(val->arr_len == 32);
45163         memcpy(val_ref.data, val->elems, 32); FREE(val);
45164         TxInitRbf_set_channel_id(&this_ptr_conv, val_ref);
45165 }
45166
45167 int32_t  __attribute__((export_name("TS_TxInitRbf_get_locktime"))) TS_TxInitRbf_get_locktime(uint64_t this_ptr) {
45168         LDKTxInitRbf this_ptr_conv;
45169         this_ptr_conv.inner = untag_ptr(this_ptr);
45170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45172         this_ptr_conv.is_owned = false;
45173         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
45174         return ret_conv;
45175 }
45176
45177 void  __attribute__((export_name("TS_TxInitRbf_set_locktime"))) TS_TxInitRbf_set_locktime(uint64_t this_ptr, int32_t val) {
45178         LDKTxInitRbf this_ptr_conv;
45179         this_ptr_conv.inner = untag_ptr(this_ptr);
45180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45182         this_ptr_conv.is_owned = false;
45183         TxInitRbf_set_locktime(&this_ptr_conv, val);
45184 }
45185
45186 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) {
45187         LDKTxInitRbf this_ptr_conv;
45188         this_ptr_conv.inner = untag_ptr(this_ptr);
45189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45191         this_ptr_conv.is_owned = false;
45192         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
45193         return ret_conv;
45194 }
45195
45196 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) {
45197         LDKTxInitRbf this_ptr_conv;
45198         this_ptr_conv.inner = untag_ptr(this_ptr);
45199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45201         this_ptr_conv.is_owned = false;
45202         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
45203 }
45204
45205 uint64_t  __attribute__((export_name("TS_TxInitRbf_get_funding_output_contribution"))) TS_TxInitRbf_get_funding_output_contribution(uint64_t this_ptr) {
45206         LDKTxInitRbf this_ptr_conv;
45207         this_ptr_conv.inner = untag_ptr(this_ptr);
45208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45210         this_ptr_conv.is_owned = false;
45211         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
45212         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
45213         uint64_t ret_ref = tag_ptr(ret_copy, true);
45214         return ret_ref;
45215 }
45216
45217 void  __attribute__((export_name("TS_TxInitRbf_set_funding_output_contribution"))) TS_TxInitRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
45218         LDKTxInitRbf 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         void* val_ptr = untag_ptr(val);
45224         CHECK_ACCESS(val_ptr);
45225         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
45226         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
45227         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
45228 }
45229
45230 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) {
45231         LDKThirtyTwoBytes channel_id_arg_ref;
45232         CHECK(channel_id_arg->arr_len == 32);
45233         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45234         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
45235         CHECK_ACCESS(funding_output_contribution_arg_ptr);
45236         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
45237         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
45238         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_ref, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
45239         uint64_t ret_ref = 0;
45240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45242         return ret_ref;
45243 }
45244
45245 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
45246         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
45247         uint64_t ret_ref = 0;
45248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45250         return ret_ref;
45251 }
45252 int64_t  __attribute__((export_name("TS_TxInitRbf_clone_ptr"))) TS_TxInitRbf_clone_ptr(uint64_t arg) {
45253         LDKTxInitRbf arg_conv;
45254         arg_conv.inner = untag_ptr(arg);
45255         arg_conv.is_owned = ptr_is_owned(arg);
45256         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45257         arg_conv.is_owned = false;
45258         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
45259         return ret_conv;
45260 }
45261
45262 uint64_t  __attribute__((export_name("TS_TxInitRbf_clone"))) TS_TxInitRbf_clone(uint64_t orig) {
45263         LDKTxInitRbf orig_conv;
45264         orig_conv.inner = untag_ptr(orig);
45265         orig_conv.is_owned = ptr_is_owned(orig);
45266         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45267         orig_conv.is_owned = false;
45268         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
45269         uint64_t ret_ref = 0;
45270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45272         return ret_ref;
45273 }
45274
45275 int64_t  __attribute__((export_name("TS_TxInitRbf_hash"))) TS_TxInitRbf_hash(uint64_t o) {
45276         LDKTxInitRbf o_conv;
45277         o_conv.inner = untag_ptr(o);
45278         o_conv.is_owned = ptr_is_owned(o);
45279         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45280         o_conv.is_owned = false;
45281         int64_t ret_conv = TxInitRbf_hash(&o_conv);
45282         return ret_conv;
45283 }
45284
45285 jboolean  __attribute__((export_name("TS_TxInitRbf_eq"))) TS_TxInitRbf_eq(uint64_t a, uint64_t b) {
45286         LDKTxInitRbf a_conv;
45287         a_conv.inner = untag_ptr(a);
45288         a_conv.is_owned = ptr_is_owned(a);
45289         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45290         a_conv.is_owned = false;
45291         LDKTxInitRbf b_conv;
45292         b_conv.inner = untag_ptr(b);
45293         b_conv.is_owned = ptr_is_owned(b);
45294         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45295         b_conv.is_owned = false;
45296         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
45297         return ret_conv;
45298 }
45299
45300 void  __attribute__((export_name("TS_TxAckRbf_free"))) TS_TxAckRbf_free(uint64_t this_obj) {
45301         LDKTxAckRbf this_obj_conv;
45302         this_obj_conv.inner = untag_ptr(this_obj);
45303         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45305         TxAckRbf_free(this_obj_conv);
45306 }
45307
45308 int8_tArray  __attribute__((export_name("TS_TxAckRbf_get_channel_id"))) TS_TxAckRbf_get_channel_id(uint64_t this_ptr) {
45309         LDKTxAckRbf this_ptr_conv;
45310         this_ptr_conv.inner = untag_ptr(this_ptr);
45311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45313         this_ptr_conv.is_owned = false;
45314         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45315         memcpy(ret_arr->elems, *TxAckRbf_get_channel_id(&this_ptr_conv), 32);
45316         return ret_arr;
45317 }
45318
45319 void  __attribute__((export_name("TS_TxAckRbf_set_channel_id"))) TS_TxAckRbf_set_channel_id(uint64_t this_ptr, int8_tArray val) {
45320         LDKTxAckRbf this_ptr_conv;
45321         this_ptr_conv.inner = untag_ptr(this_ptr);
45322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45324         this_ptr_conv.is_owned = false;
45325         LDKThirtyTwoBytes val_ref;
45326         CHECK(val->arr_len == 32);
45327         memcpy(val_ref.data, val->elems, 32); FREE(val);
45328         TxAckRbf_set_channel_id(&this_ptr_conv, val_ref);
45329 }
45330
45331 uint64_t  __attribute__((export_name("TS_TxAckRbf_get_funding_output_contribution"))) TS_TxAckRbf_get_funding_output_contribution(uint64_t this_ptr) {
45332         LDKTxAckRbf this_ptr_conv;
45333         this_ptr_conv.inner = untag_ptr(this_ptr);
45334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45336         this_ptr_conv.is_owned = false;
45337         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
45338         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
45339         uint64_t ret_ref = tag_ptr(ret_copy, true);
45340         return ret_ref;
45341 }
45342
45343 void  __attribute__((export_name("TS_TxAckRbf_set_funding_output_contribution"))) TS_TxAckRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
45344         LDKTxAckRbf this_ptr_conv;
45345         this_ptr_conv.inner = untag_ptr(this_ptr);
45346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45348         this_ptr_conv.is_owned = false;
45349         void* val_ptr = untag_ptr(val);
45350         CHECK_ACCESS(val_ptr);
45351         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
45352         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
45353         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
45354 }
45355
45356 uint64_t  __attribute__((export_name("TS_TxAckRbf_new"))) TS_TxAckRbf_new(int8_tArray channel_id_arg, uint64_t funding_output_contribution_arg) {
45357         LDKThirtyTwoBytes channel_id_arg_ref;
45358         CHECK(channel_id_arg->arr_len == 32);
45359         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45360         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
45361         CHECK_ACCESS(funding_output_contribution_arg_ptr);
45362         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
45363         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
45364         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_ref, funding_output_contribution_arg_conv);
45365         uint64_t ret_ref = 0;
45366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45368         return ret_ref;
45369 }
45370
45371 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
45372         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
45373         uint64_t ret_ref = 0;
45374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45376         return ret_ref;
45377 }
45378 int64_t  __attribute__((export_name("TS_TxAckRbf_clone_ptr"))) TS_TxAckRbf_clone_ptr(uint64_t arg) {
45379         LDKTxAckRbf arg_conv;
45380         arg_conv.inner = untag_ptr(arg);
45381         arg_conv.is_owned = ptr_is_owned(arg);
45382         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45383         arg_conv.is_owned = false;
45384         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
45385         return ret_conv;
45386 }
45387
45388 uint64_t  __attribute__((export_name("TS_TxAckRbf_clone"))) TS_TxAckRbf_clone(uint64_t orig) {
45389         LDKTxAckRbf orig_conv;
45390         orig_conv.inner = untag_ptr(orig);
45391         orig_conv.is_owned = ptr_is_owned(orig);
45392         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45393         orig_conv.is_owned = false;
45394         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
45395         uint64_t ret_ref = 0;
45396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45398         return ret_ref;
45399 }
45400
45401 int64_t  __attribute__((export_name("TS_TxAckRbf_hash"))) TS_TxAckRbf_hash(uint64_t o) {
45402         LDKTxAckRbf o_conv;
45403         o_conv.inner = untag_ptr(o);
45404         o_conv.is_owned = ptr_is_owned(o);
45405         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45406         o_conv.is_owned = false;
45407         int64_t ret_conv = TxAckRbf_hash(&o_conv);
45408         return ret_conv;
45409 }
45410
45411 jboolean  __attribute__((export_name("TS_TxAckRbf_eq"))) TS_TxAckRbf_eq(uint64_t a, uint64_t b) {
45412         LDKTxAckRbf a_conv;
45413         a_conv.inner = untag_ptr(a);
45414         a_conv.is_owned = ptr_is_owned(a);
45415         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45416         a_conv.is_owned = false;
45417         LDKTxAckRbf b_conv;
45418         b_conv.inner = untag_ptr(b);
45419         b_conv.is_owned = ptr_is_owned(b);
45420         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45421         b_conv.is_owned = false;
45422         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
45423         return ret_conv;
45424 }
45425
45426 void  __attribute__((export_name("TS_TxAbort_free"))) TS_TxAbort_free(uint64_t this_obj) {
45427         LDKTxAbort this_obj_conv;
45428         this_obj_conv.inner = untag_ptr(this_obj);
45429         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45431         TxAbort_free(this_obj_conv);
45432 }
45433
45434 int8_tArray  __attribute__((export_name("TS_TxAbort_get_channel_id"))) TS_TxAbort_get_channel_id(uint64_t this_ptr) {
45435         LDKTxAbort this_ptr_conv;
45436         this_ptr_conv.inner = untag_ptr(this_ptr);
45437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45439         this_ptr_conv.is_owned = false;
45440         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45441         memcpy(ret_arr->elems, *TxAbort_get_channel_id(&this_ptr_conv), 32);
45442         return ret_arr;
45443 }
45444
45445 void  __attribute__((export_name("TS_TxAbort_set_channel_id"))) TS_TxAbort_set_channel_id(uint64_t this_ptr, int8_tArray val) {
45446         LDKTxAbort this_ptr_conv;
45447         this_ptr_conv.inner = untag_ptr(this_ptr);
45448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45450         this_ptr_conv.is_owned = false;
45451         LDKThirtyTwoBytes val_ref;
45452         CHECK(val->arr_len == 32);
45453         memcpy(val_ref.data, val->elems, 32); FREE(val);
45454         TxAbort_set_channel_id(&this_ptr_conv, val_ref);
45455 }
45456
45457 int8_tArray  __attribute__((export_name("TS_TxAbort_get_data"))) TS_TxAbort_get_data(uint64_t this_ptr) {
45458         LDKTxAbort this_ptr_conv;
45459         this_ptr_conv.inner = untag_ptr(this_ptr);
45460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45462         this_ptr_conv.is_owned = false;
45463         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
45464         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45465         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45466         CVec_u8Z_free(ret_var);
45467         return ret_arr;
45468 }
45469
45470 void  __attribute__((export_name("TS_TxAbort_set_data"))) TS_TxAbort_set_data(uint64_t this_ptr, int8_tArray val) {
45471         LDKTxAbort this_ptr_conv;
45472         this_ptr_conv.inner = untag_ptr(this_ptr);
45473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45475         this_ptr_conv.is_owned = false;
45476         LDKCVec_u8Z val_ref;
45477         val_ref.datalen = val->arr_len;
45478         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
45479         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
45480         TxAbort_set_data(&this_ptr_conv, val_ref);
45481 }
45482
45483 uint64_t  __attribute__((export_name("TS_TxAbort_new"))) TS_TxAbort_new(int8_tArray channel_id_arg, int8_tArray data_arg) {
45484         LDKThirtyTwoBytes channel_id_arg_ref;
45485         CHECK(channel_id_arg->arr_len == 32);
45486         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45487         LDKCVec_u8Z data_arg_ref;
45488         data_arg_ref.datalen = data_arg->arr_len;
45489         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
45490         memcpy(data_arg_ref.data, data_arg->elems, data_arg_ref.datalen); FREE(data_arg);
45491         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_ref, data_arg_ref);
45492         uint64_t ret_ref = 0;
45493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45495         return ret_ref;
45496 }
45497
45498 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
45499         LDKTxAbort ret_var = TxAbort_clone(arg);
45500         uint64_t ret_ref = 0;
45501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45503         return ret_ref;
45504 }
45505 int64_t  __attribute__((export_name("TS_TxAbort_clone_ptr"))) TS_TxAbort_clone_ptr(uint64_t arg) {
45506         LDKTxAbort arg_conv;
45507         arg_conv.inner = untag_ptr(arg);
45508         arg_conv.is_owned = ptr_is_owned(arg);
45509         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45510         arg_conv.is_owned = false;
45511         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
45512         return ret_conv;
45513 }
45514
45515 uint64_t  __attribute__((export_name("TS_TxAbort_clone"))) TS_TxAbort_clone(uint64_t orig) {
45516         LDKTxAbort orig_conv;
45517         orig_conv.inner = untag_ptr(orig);
45518         orig_conv.is_owned = ptr_is_owned(orig);
45519         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45520         orig_conv.is_owned = false;
45521         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
45522         uint64_t ret_ref = 0;
45523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45525         return ret_ref;
45526 }
45527
45528 int64_t  __attribute__((export_name("TS_TxAbort_hash"))) TS_TxAbort_hash(uint64_t o) {
45529         LDKTxAbort o_conv;
45530         o_conv.inner = untag_ptr(o);
45531         o_conv.is_owned = ptr_is_owned(o);
45532         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45533         o_conv.is_owned = false;
45534         int64_t ret_conv = TxAbort_hash(&o_conv);
45535         return ret_conv;
45536 }
45537
45538 jboolean  __attribute__((export_name("TS_TxAbort_eq"))) TS_TxAbort_eq(uint64_t a, uint64_t b) {
45539         LDKTxAbort a_conv;
45540         a_conv.inner = untag_ptr(a);
45541         a_conv.is_owned = ptr_is_owned(a);
45542         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45543         a_conv.is_owned = false;
45544         LDKTxAbort b_conv;
45545         b_conv.inner = untag_ptr(b);
45546         b_conv.is_owned = ptr_is_owned(b);
45547         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45548         b_conv.is_owned = false;
45549         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
45550         return ret_conv;
45551 }
45552
45553 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
45554         LDKShutdown this_obj_conv;
45555         this_obj_conv.inner = untag_ptr(this_obj);
45556         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45558         Shutdown_free(this_obj_conv);
45559 }
45560
45561 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
45562         LDKShutdown this_ptr_conv;
45563         this_ptr_conv.inner = untag_ptr(this_ptr);
45564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45566         this_ptr_conv.is_owned = false;
45567         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45568         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
45569         return ret_arr;
45570 }
45571
45572 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
45573         LDKShutdown this_ptr_conv;
45574         this_ptr_conv.inner = untag_ptr(this_ptr);
45575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45577         this_ptr_conv.is_owned = false;
45578         LDKThirtyTwoBytes val_ref;
45579         CHECK(val->arr_len == 32);
45580         memcpy(val_ref.data, val->elems, 32); FREE(val);
45581         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
45582 }
45583
45584 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
45585         LDKShutdown this_ptr_conv;
45586         this_ptr_conv.inner = untag_ptr(this_ptr);
45587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45589         this_ptr_conv.is_owned = false;
45590         LDKCVec_u8Z ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
45591         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45592         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45593         CVec_u8Z_free(ret_var);
45594         return ret_arr;
45595 }
45596
45597 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
45598         LDKShutdown this_ptr_conv;
45599         this_ptr_conv.inner = untag_ptr(this_ptr);
45600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45602         this_ptr_conv.is_owned = false;
45603         LDKCVec_u8Z val_ref;
45604         val_ref.datalen = val->arr_len;
45605         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
45606         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
45607         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
45608 }
45609
45610 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
45611         LDKThirtyTwoBytes channel_id_arg_ref;
45612         CHECK(channel_id_arg->arr_len == 32);
45613         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45614         LDKCVec_u8Z scriptpubkey_arg_ref;
45615         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
45616         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
45617         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
45618         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
45619         uint64_t ret_ref = 0;
45620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45622         return ret_ref;
45623 }
45624
45625 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
45626         LDKShutdown ret_var = Shutdown_clone(arg);
45627         uint64_t ret_ref = 0;
45628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45630         return ret_ref;
45631 }
45632 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
45633         LDKShutdown arg_conv;
45634         arg_conv.inner = untag_ptr(arg);
45635         arg_conv.is_owned = ptr_is_owned(arg);
45636         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45637         arg_conv.is_owned = false;
45638         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
45639         return ret_conv;
45640 }
45641
45642 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
45643         LDKShutdown orig_conv;
45644         orig_conv.inner = untag_ptr(orig);
45645         orig_conv.is_owned = ptr_is_owned(orig);
45646         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45647         orig_conv.is_owned = false;
45648         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
45649         uint64_t ret_ref = 0;
45650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45652         return ret_ref;
45653 }
45654
45655 int64_t  __attribute__((export_name("TS_Shutdown_hash"))) TS_Shutdown_hash(uint64_t o) {
45656         LDKShutdown o_conv;
45657         o_conv.inner = untag_ptr(o);
45658         o_conv.is_owned = ptr_is_owned(o);
45659         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45660         o_conv.is_owned = false;
45661         int64_t ret_conv = Shutdown_hash(&o_conv);
45662         return ret_conv;
45663 }
45664
45665 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
45666         LDKShutdown a_conv;
45667         a_conv.inner = untag_ptr(a);
45668         a_conv.is_owned = ptr_is_owned(a);
45669         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45670         a_conv.is_owned = false;
45671         LDKShutdown b_conv;
45672         b_conv.inner = untag_ptr(b);
45673         b_conv.is_owned = ptr_is_owned(b);
45674         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45675         b_conv.is_owned = false;
45676         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
45677         return ret_conv;
45678 }
45679
45680 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
45681         LDKClosingSignedFeeRange this_obj_conv;
45682         this_obj_conv.inner = untag_ptr(this_obj);
45683         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45685         ClosingSignedFeeRange_free(this_obj_conv);
45686 }
45687
45688 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
45689         LDKClosingSignedFeeRange this_ptr_conv;
45690         this_ptr_conv.inner = untag_ptr(this_ptr);
45691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45693         this_ptr_conv.is_owned = false;
45694         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
45695         return ret_conv;
45696 }
45697
45698 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
45699         LDKClosingSignedFeeRange this_ptr_conv;
45700         this_ptr_conv.inner = untag_ptr(this_ptr);
45701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45703         this_ptr_conv.is_owned = false;
45704         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
45705 }
45706
45707 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
45708         LDKClosingSignedFeeRange this_ptr_conv;
45709         this_ptr_conv.inner = untag_ptr(this_ptr);
45710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45712         this_ptr_conv.is_owned = false;
45713         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
45714         return ret_conv;
45715 }
45716
45717 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
45718         LDKClosingSignedFeeRange this_ptr_conv;
45719         this_ptr_conv.inner = untag_ptr(this_ptr);
45720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45722         this_ptr_conv.is_owned = false;
45723         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
45724 }
45725
45726 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
45727         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
45728         uint64_t ret_ref = 0;
45729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45731         return ret_ref;
45732 }
45733
45734 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
45735         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
45736         uint64_t ret_ref = 0;
45737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45739         return ret_ref;
45740 }
45741 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
45742         LDKClosingSignedFeeRange arg_conv;
45743         arg_conv.inner = untag_ptr(arg);
45744         arg_conv.is_owned = ptr_is_owned(arg);
45745         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45746         arg_conv.is_owned = false;
45747         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
45748         return ret_conv;
45749 }
45750
45751 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
45752         LDKClosingSignedFeeRange orig_conv;
45753         orig_conv.inner = untag_ptr(orig);
45754         orig_conv.is_owned = ptr_is_owned(orig);
45755         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45756         orig_conv.is_owned = false;
45757         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
45758         uint64_t ret_ref = 0;
45759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45761         return ret_ref;
45762 }
45763
45764 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_hash"))) TS_ClosingSignedFeeRange_hash(uint64_t o) {
45765         LDKClosingSignedFeeRange o_conv;
45766         o_conv.inner = untag_ptr(o);
45767         o_conv.is_owned = ptr_is_owned(o);
45768         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45769         o_conv.is_owned = false;
45770         int64_t ret_conv = ClosingSignedFeeRange_hash(&o_conv);
45771         return ret_conv;
45772 }
45773
45774 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
45775         LDKClosingSignedFeeRange a_conv;
45776         a_conv.inner = untag_ptr(a);
45777         a_conv.is_owned = ptr_is_owned(a);
45778         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45779         a_conv.is_owned = false;
45780         LDKClosingSignedFeeRange b_conv;
45781         b_conv.inner = untag_ptr(b);
45782         b_conv.is_owned = ptr_is_owned(b);
45783         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45784         b_conv.is_owned = false;
45785         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
45786         return ret_conv;
45787 }
45788
45789 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
45790         LDKClosingSigned this_obj_conv;
45791         this_obj_conv.inner = untag_ptr(this_obj);
45792         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45794         ClosingSigned_free(this_obj_conv);
45795 }
45796
45797 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
45798         LDKClosingSigned this_ptr_conv;
45799         this_ptr_conv.inner = untag_ptr(this_ptr);
45800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45802         this_ptr_conv.is_owned = false;
45803         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45804         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
45805         return ret_arr;
45806 }
45807
45808 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
45809         LDKClosingSigned this_ptr_conv;
45810         this_ptr_conv.inner = untag_ptr(this_ptr);
45811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45813         this_ptr_conv.is_owned = false;
45814         LDKThirtyTwoBytes val_ref;
45815         CHECK(val->arr_len == 32);
45816         memcpy(val_ref.data, val->elems, 32); FREE(val);
45817         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
45818 }
45819
45820 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
45821         LDKClosingSigned this_ptr_conv;
45822         this_ptr_conv.inner = untag_ptr(this_ptr);
45823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45825         this_ptr_conv.is_owned = false;
45826         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
45827         return ret_conv;
45828 }
45829
45830 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
45831         LDKClosingSigned this_ptr_conv;
45832         this_ptr_conv.inner = untag_ptr(this_ptr);
45833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45835         this_ptr_conv.is_owned = false;
45836         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
45837 }
45838
45839 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
45840         LDKClosingSigned this_ptr_conv;
45841         this_ptr_conv.inner = untag_ptr(this_ptr);
45842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45844         this_ptr_conv.is_owned = false;
45845         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
45846         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
45847         return ret_arr;
45848 }
45849
45850 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
45851         LDKClosingSigned this_ptr_conv;
45852         this_ptr_conv.inner = untag_ptr(this_ptr);
45853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45855         this_ptr_conv.is_owned = false;
45856         LDKECDSASignature val_ref;
45857         CHECK(val->arr_len == 64);
45858         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
45859         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
45860 }
45861
45862 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
45863         LDKClosingSigned this_ptr_conv;
45864         this_ptr_conv.inner = untag_ptr(this_ptr);
45865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45867         this_ptr_conv.is_owned = false;
45868         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
45869         uint64_t ret_ref = 0;
45870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45872         return ret_ref;
45873 }
45874
45875 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
45876         LDKClosingSigned this_ptr_conv;
45877         this_ptr_conv.inner = untag_ptr(this_ptr);
45878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45880         this_ptr_conv.is_owned = false;
45881         LDKClosingSignedFeeRange val_conv;
45882         val_conv.inner = untag_ptr(val);
45883         val_conv.is_owned = ptr_is_owned(val);
45884         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45885         val_conv = ClosingSignedFeeRange_clone(&val_conv);
45886         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
45887 }
45888
45889 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) {
45890         LDKThirtyTwoBytes channel_id_arg_ref;
45891         CHECK(channel_id_arg->arr_len == 32);
45892         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45893         LDKECDSASignature signature_arg_ref;
45894         CHECK(signature_arg->arr_len == 64);
45895         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
45896         LDKClosingSignedFeeRange fee_range_arg_conv;
45897         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
45898         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
45899         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
45900         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
45901         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
45902         uint64_t ret_ref = 0;
45903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45905         return ret_ref;
45906 }
45907
45908 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
45909         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
45910         uint64_t ret_ref = 0;
45911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45913         return ret_ref;
45914 }
45915 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
45916         LDKClosingSigned arg_conv;
45917         arg_conv.inner = untag_ptr(arg);
45918         arg_conv.is_owned = ptr_is_owned(arg);
45919         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45920         arg_conv.is_owned = false;
45921         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
45922         return ret_conv;
45923 }
45924
45925 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
45926         LDKClosingSigned orig_conv;
45927         orig_conv.inner = untag_ptr(orig);
45928         orig_conv.is_owned = ptr_is_owned(orig);
45929         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45930         orig_conv.is_owned = false;
45931         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
45932         uint64_t ret_ref = 0;
45933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45935         return ret_ref;
45936 }
45937
45938 int64_t  __attribute__((export_name("TS_ClosingSigned_hash"))) TS_ClosingSigned_hash(uint64_t o) {
45939         LDKClosingSigned o_conv;
45940         o_conv.inner = untag_ptr(o);
45941         o_conv.is_owned = ptr_is_owned(o);
45942         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45943         o_conv.is_owned = false;
45944         int64_t ret_conv = ClosingSigned_hash(&o_conv);
45945         return ret_conv;
45946 }
45947
45948 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
45949         LDKClosingSigned a_conv;
45950         a_conv.inner = untag_ptr(a);
45951         a_conv.is_owned = ptr_is_owned(a);
45952         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45953         a_conv.is_owned = false;
45954         LDKClosingSigned b_conv;
45955         b_conv.inner = untag_ptr(b);
45956         b_conv.is_owned = ptr_is_owned(b);
45957         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45958         b_conv.is_owned = false;
45959         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
45960         return ret_conv;
45961 }
45962
45963 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
45964         LDKUpdateAddHTLC this_obj_conv;
45965         this_obj_conv.inner = untag_ptr(this_obj);
45966         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45968         UpdateAddHTLC_free(this_obj_conv);
45969 }
45970
45971 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
45972         LDKUpdateAddHTLC this_ptr_conv;
45973         this_ptr_conv.inner = untag_ptr(this_ptr);
45974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45976         this_ptr_conv.is_owned = false;
45977         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45978         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
45979         return ret_arr;
45980 }
45981
45982 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
45983         LDKUpdateAddHTLC this_ptr_conv;
45984         this_ptr_conv.inner = untag_ptr(this_ptr);
45985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45987         this_ptr_conv.is_owned = false;
45988         LDKThirtyTwoBytes val_ref;
45989         CHECK(val->arr_len == 32);
45990         memcpy(val_ref.data, val->elems, 32); FREE(val);
45991         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
45992 }
45993
45994 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
45995         LDKUpdateAddHTLC this_ptr_conv;
45996         this_ptr_conv.inner = untag_ptr(this_ptr);
45997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45999         this_ptr_conv.is_owned = false;
46000         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
46001         return ret_conv;
46002 }
46003
46004 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
46005         LDKUpdateAddHTLC this_ptr_conv;
46006         this_ptr_conv.inner = untag_ptr(this_ptr);
46007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46009         this_ptr_conv.is_owned = false;
46010         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
46011 }
46012
46013 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
46014         LDKUpdateAddHTLC this_ptr_conv;
46015         this_ptr_conv.inner = untag_ptr(this_ptr);
46016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46018         this_ptr_conv.is_owned = false;
46019         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
46020         return ret_conv;
46021 }
46022
46023 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
46024         LDKUpdateAddHTLC 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         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
46030 }
46031
46032 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
46033         LDKUpdateAddHTLC this_ptr_conv;
46034         this_ptr_conv.inner = untag_ptr(this_ptr);
46035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46037         this_ptr_conv.is_owned = false;
46038         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46039         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
46040         return ret_arr;
46041 }
46042
46043 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
46044         LDKUpdateAddHTLC this_ptr_conv;
46045         this_ptr_conv.inner = untag_ptr(this_ptr);
46046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46048         this_ptr_conv.is_owned = false;
46049         LDKThirtyTwoBytes val_ref;
46050         CHECK(val->arr_len == 32);
46051         memcpy(val_ref.data, val->elems, 32); FREE(val);
46052         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
46053 }
46054
46055 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
46056         LDKUpdateAddHTLC this_ptr_conv;
46057         this_ptr_conv.inner = untag_ptr(this_ptr);
46058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46060         this_ptr_conv.is_owned = false;
46061         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
46062         return ret_conv;
46063 }
46064
46065 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
46066         LDKUpdateAddHTLC this_ptr_conv;
46067         this_ptr_conv.inner = untag_ptr(this_ptr);
46068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46070         this_ptr_conv.is_owned = false;
46071         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
46072 }
46073
46074 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_skimmed_fee_msat"))) TS_UpdateAddHTLC_get_skimmed_fee_msat(uint64_t this_ptr) {
46075         LDKUpdateAddHTLC this_ptr_conv;
46076         this_ptr_conv.inner = untag_ptr(this_ptr);
46077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46079         this_ptr_conv.is_owned = false;
46080         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46081         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
46082         uint64_t ret_ref = tag_ptr(ret_copy, true);
46083         return ret_ref;
46084 }
46085
46086 void  __attribute__((export_name("TS_UpdateAddHTLC_set_skimmed_fee_msat"))) TS_UpdateAddHTLC_set_skimmed_fee_msat(uint64_t this_ptr, uint64_t val) {
46087         LDKUpdateAddHTLC this_ptr_conv;
46088         this_ptr_conv.inner = untag_ptr(this_ptr);
46089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46091         this_ptr_conv.is_owned = false;
46092         void* val_ptr = untag_ptr(val);
46093         CHECK_ACCESS(val_ptr);
46094         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46095         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46096         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
46097 }
46098
46099 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_onion_routing_packet"))) TS_UpdateAddHTLC_get_onion_routing_packet(uint64_t this_ptr) {
46100         LDKUpdateAddHTLC this_ptr_conv;
46101         this_ptr_conv.inner = untag_ptr(this_ptr);
46102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46104         this_ptr_conv.is_owned = false;
46105         LDKOnionPacket ret_var = UpdateAddHTLC_get_onion_routing_packet(&this_ptr_conv);
46106         uint64_t ret_ref = 0;
46107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46109         return ret_ref;
46110 }
46111
46112 void  __attribute__((export_name("TS_UpdateAddHTLC_set_onion_routing_packet"))) TS_UpdateAddHTLC_set_onion_routing_packet(uint64_t this_ptr, uint64_t val) {
46113         LDKUpdateAddHTLC this_ptr_conv;
46114         this_ptr_conv.inner = untag_ptr(this_ptr);
46115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46117         this_ptr_conv.is_owned = false;
46118         LDKOnionPacket val_conv;
46119         val_conv.inner = untag_ptr(val);
46120         val_conv.is_owned = ptr_is_owned(val);
46121         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46122         val_conv = OnionPacket_clone(&val_conv);
46123         UpdateAddHTLC_set_onion_routing_packet(&this_ptr_conv, val_conv);
46124 }
46125
46126 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_blinding_point"))) TS_UpdateAddHTLC_get_blinding_point(uint64_t this_ptr) {
46127         LDKUpdateAddHTLC this_ptr_conv;
46128         this_ptr_conv.inner = untag_ptr(this_ptr);
46129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46131         this_ptr_conv.is_owned = false;
46132         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46133         memcpy(ret_arr->elems, UpdateAddHTLC_get_blinding_point(&this_ptr_conv).compressed_form, 33);
46134         return ret_arr;
46135 }
46136
46137 void  __attribute__((export_name("TS_UpdateAddHTLC_set_blinding_point"))) TS_UpdateAddHTLC_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
46138         LDKUpdateAddHTLC this_ptr_conv;
46139         this_ptr_conv.inner = untag_ptr(this_ptr);
46140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46142         this_ptr_conv.is_owned = false;
46143         LDKPublicKey val_ref;
46144         CHECK(val->arr_len == 33);
46145         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46146         UpdateAddHTLC_set_blinding_point(&this_ptr_conv, val_ref);
46147 }
46148
46149 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_new"))) TS_UpdateAddHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int64_t amount_msat_arg, int8_tArray payment_hash_arg, int32_t cltv_expiry_arg, uint64_t skimmed_fee_msat_arg, uint64_t onion_routing_packet_arg, int8_tArray blinding_point_arg) {
46150         LDKThirtyTwoBytes channel_id_arg_ref;
46151         CHECK(channel_id_arg->arr_len == 32);
46152         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
46153         LDKThirtyTwoBytes payment_hash_arg_ref;
46154         CHECK(payment_hash_arg->arr_len == 32);
46155         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
46156         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
46157         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
46158         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
46159         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
46160         LDKOnionPacket onion_routing_packet_arg_conv;
46161         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
46162         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
46163         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
46164         onion_routing_packet_arg_conv = OnionPacket_clone(&onion_routing_packet_arg_conv);
46165         LDKPublicKey blinding_point_arg_ref;
46166         CHECK(blinding_point_arg->arr_len == 33);
46167         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
46168         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_new(channel_id_arg_ref, htlc_id_arg, amount_msat_arg, payment_hash_arg_ref, cltv_expiry_arg, skimmed_fee_msat_arg_conv, onion_routing_packet_arg_conv, blinding_point_arg_ref);
46169         uint64_t ret_ref = 0;
46170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46172         return ret_ref;
46173 }
46174
46175 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
46176         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
46177         uint64_t ret_ref = 0;
46178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46180         return ret_ref;
46181 }
46182 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
46183         LDKUpdateAddHTLC arg_conv;
46184         arg_conv.inner = untag_ptr(arg);
46185         arg_conv.is_owned = ptr_is_owned(arg);
46186         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46187         arg_conv.is_owned = false;
46188         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
46189         return ret_conv;
46190 }
46191
46192 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
46193         LDKUpdateAddHTLC orig_conv;
46194         orig_conv.inner = untag_ptr(orig);
46195         orig_conv.is_owned = ptr_is_owned(orig);
46196         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46197         orig_conv.is_owned = false;
46198         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
46199         uint64_t ret_ref = 0;
46200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46202         return ret_ref;
46203 }
46204
46205 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_hash"))) TS_UpdateAddHTLC_hash(uint64_t o) {
46206         LDKUpdateAddHTLC o_conv;
46207         o_conv.inner = untag_ptr(o);
46208         o_conv.is_owned = ptr_is_owned(o);
46209         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46210         o_conv.is_owned = false;
46211         int64_t ret_conv = UpdateAddHTLC_hash(&o_conv);
46212         return ret_conv;
46213 }
46214
46215 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
46216         LDKUpdateAddHTLC a_conv;
46217         a_conv.inner = untag_ptr(a);
46218         a_conv.is_owned = ptr_is_owned(a);
46219         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46220         a_conv.is_owned = false;
46221         LDKUpdateAddHTLC b_conv;
46222         b_conv.inner = untag_ptr(b);
46223         b_conv.is_owned = ptr_is_owned(b);
46224         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46225         b_conv.is_owned = false;
46226         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
46227         return ret_conv;
46228 }
46229
46230 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
46231         LDKOnionMessage this_obj_conv;
46232         this_obj_conv.inner = untag_ptr(this_obj);
46233         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46235         OnionMessage_free(this_obj_conv);
46236 }
46237
46238 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
46239         LDKOnionMessage this_ptr_conv;
46240         this_ptr_conv.inner = untag_ptr(this_ptr);
46241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46243         this_ptr_conv.is_owned = false;
46244         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46245         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
46246         return ret_arr;
46247 }
46248
46249 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
46250         LDKOnionMessage this_ptr_conv;
46251         this_ptr_conv.inner = untag_ptr(this_ptr);
46252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46254         this_ptr_conv.is_owned = false;
46255         LDKPublicKey val_ref;
46256         CHECK(val->arr_len == 33);
46257         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46258         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
46259 }
46260
46261 uint64_t  __attribute__((export_name("TS_OnionMessage_get_onion_routing_packet"))) TS_OnionMessage_get_onion_routing_packet(uint64_t this_ptr) {
46262         LDKOnionMessage this_ptr_conv;
46263         this_ptr_conv.inner = untag_ptr(this_ptr);
46264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46266         this_ptr_conv.is_owned = false;
46267         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
46268         uint64_t ret_ref = 0;
46269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46271         return ret_ref;
46272 }
46273
46274 void  __attribute__((export_name("TS_OnionMessage_set_onion_routing_packet"))) TS_OnionMessage_set_onion_routing_packet(uint64_t this_ptr, uint64_t val) {
46275         LDKOnionMessage this_ptr_conv;
46276         this_ptr_conv.inner = untag_ptr(this_ptr);
46277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46279         this_ptr_conv.is_owned = false;
46280         LDKPacket val_conv;
46281         val_conv.inner = untag_ptr(val);
46282         val_conv.is_owned = ptr_is_owned(val);
46283         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46284         val_conv = Packet_clone(&val_conv);
46285         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
46286 }
46287
46288 uint64_t  __attribute__((export_name("TS_OnionMessage_new"))) TS_OnionMessage_new(int8_tArray blinding_point_arg, uint64_t onion_routing_packet_arg) {
46289         LDKPublicKey blinding_point_arg_ref;
46290         CHECK(blinding_point_arg->arr_len == 33);
46291         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
46292         LDKPacket onion_routing_packet_arg_conv;
46293         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
46294         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
46295         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
46296         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
46297         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
46298         uint64_t ret_ref = 0;
46299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46301         return ret_ref;
46302 }
46303
46304 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
46305         LDKOnionMessage ret_var = OnionMessage_clone(arg);
46306         uint64_t ret_ref = 0;
46307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46309         return ret_ref;
46310 }
46311 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
46312         LDKOnionMessage arg_conv;
46313         arg_conv.inner = untag_ptr(arg);
46314         arg_conv.is_owned = ptr_is_owned(arg);
46315         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46316         arg_conv.is_owned = false;
46317         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
46318         return ret_conv;
46319 }
46320
46321 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
46322         LDKOnionMessage orig_conv;
46323         orig_conv.inner = untag_ptr(orig);
46324         orig_conv.is_owned = ptr_is_owned(orig);
46325         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46326         orig_conv.is_owned = false;
46327         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
46328         uint64_t ret_ref = 0;
46329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46331         return ret_ref;
46332 }
46333
46334 int64_t  __attribute__((export_name("TS_OnionMessage_hash"))) TS_OnionMessage_hash(uint64_t o) {
46335         LDKOnionMessage o_conv;
46336         o_conv.inner = untag_ptr(o);
46337         o_conv.is_owned = ptr_is_owned(o);
46338         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46339         o_conv.is_owned = false;
46340         int64_t ret_conv = OnionMessage_hash(&o_conv);
46341         return ret_conv;
46342 }
46343
46344 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
46345         LDKOnionMessage a_conv;
46346         a_conv.inner = untag_ptr(a);
46347         a_conv.is_owned = ptr_is_owned(a);
46348         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46349         a_conv.is_owned = false;
46350         LDKOnionMessage b_conv;
46351         b_conv.inner = untag_ptr(b);
46352         b_conv.is_owned = ptr_is_owned(b);
46353         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46354         b_conv.is_owned = false;
46355         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
46356         return ret_conv;
46357 }
46358
46359 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
46360         LDKUpdateFulfillHTLC this_obj_conv;
46361         this_obj_conv.inner = untag_ptr(this_obj);
46362         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46364         UpdateFulfillHTLC_free(this_obj_conv);
46365 }
46366
46367 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
46368         LDKUpdateFulfillHTLC this_ptr_conv;
46369         this_ptr_conv.inner = untag_ptr(this_ptr);
46370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46372         this_ptr_conv.is_owned = false;
46373         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46374         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
46375         return ret_arr;
46376 }
46377
46378 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
46379         LDKUpdateFulfillHTLC this_ptr_conv;
46380         this_ptr_conv.inner = untag_ptr(this_ptr);
46381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46383         this_ptr_conv.is_owned = false;
46384         LDKThirtyTwoBytes val_ref;
46385         CHECK(val->arr_len == 32);
46386         memcpy(val_ref.data, val->elems, 32); FREE(val);
46387         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
46388 }
46389
46390 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
46391         LDKUpdateFulfillHTLC this_ptr_conv;
46392         this_ptr_conv.inner = untag_ptr(this_ptr);
46393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46395         this_ptr_conv.is_owned = false;
46396         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
46397         return ret_conv;
46398 }
46399
46400 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
46401         LDKUpdateFulfillHTLC this_ptr_conv;
46402         this_ptr_conv.inner = untag_ptr(this_ptr);
46403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46405         this_ptr_conv.is_owned = false;
46406         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
46407 }
46408
46409 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
46410         LDKUpdateFulfillHTLC this_ptr_conv;
46411         this_ptr_conv.inner = untag_ptr(this_ptr);
46412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46414         this_ptr_conv.is_owned = false;
46415         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46416         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
46417         return ret_arr;
46418 }
46419
46420 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
46421         LDKUpdateFulfillHTLC this_ptr_conv;
46422         this_ptr_conv.inner = untag_ptr(this_ptr);
46423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46425         this_ptr_conv.is_owned = false;
46426         LDKThirtyTwoBytes val_ref;
46427         CHECK(val->arr_len == 32);
46428         memcpy(val_ref.data, val->elems, 32); FREE(val);
46429         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
46430 }
46431
46432 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) {
46433         LDKThirtyTwoBytes channel_id_arg_ref;
46434         CHECK(channel_id_arg->arr_len == 32);
46435         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
46436         LDKThirtyTwoBytes payment_preimage_arg_ref;
46437         CHECK(payment_preimage_arg->arr_len == 32);
46438         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
46439         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
46440         uint64_t ret_ref = 0;
46441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46443         return ret_ref;
46444 }
46445
46446 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
46447         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
46448         uint64_t ret_ref = 0;
46449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46451         return ret_ref;
46452 }
46453 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
46454         LDKUpdateFulfillHTLC arg_conv;
46455         arg_conv.inner = untag_ptr(arg);
46456         arg_conv.is_owned = ptr_is_owned(arg);
46457         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46458         arg_conv.is_owned = false;
46459         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
46460         return ret_conv;
46461 }
46462
46463 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
46464         LDKUpdateFulfillHTLC orig_conv;
46465         orig_conv.inner = untag_ptr(orig);
46466         orig_conv.is_owned = ptr_is_owned(orig);
46467         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46468         orig_conv.is_owned = false;
46469         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
46470         uint64_t ret_ref = 0;
46471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46473         return ret_ref;
46474 }
46475
46476 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_hash"))) TS_UpdateFulfillHTLC_hash(uint64_t o) {
46477         LDKUpdateFulfillHTLC o_conv;
46478         o_conv.inner = untag_ptr(o);
46479         o_conv.is_owned = ptr_is_owned(o);
46480         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46481         o_conv.is_owned = false;
46482         int64_t ret_conv = UpdateFulfillHTLC_hash(&o_conv);
46483         return ret_conv;
46484 }
46485
46486 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
46487         LDKUpdateFulfillHTLC a_conv;
46488         a_conv.inner = untag_ptr(a);
46489         a_conv.is_owned = ptr_is_owned(a);
46490         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46491         a_conv.is_owned = false;
46492         LDKUpdateFulfillHTLC b_conv;
46493         b_conv.inner = untag_ptr(b);
46494         b_conv.is_owned = ptr_is_owned(b);
46495         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46496         b_conv.is_owned = false;
46497         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
46498         return ret_conv;
46499 }
46500
46501 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
46502         LDKUpdateFailHTLC this_obj_conv;
46503         this_obj_conv.inner = untag_ptr(this_obj);
46504         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46506         UpdateFailHTLC_free(this_obj_conv);
46507 }
46508
46509 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
46510         LDKUpdateFailHTLC this_ptr_conv;
46511         this_ptr_conv.inner = untag_ptr(this_ptr);
46512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46514         this_ptr_conv.is_owned = false;
46515         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46516         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
46517         return ret_arr;
46518 }
46519
46520 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
46521         LDKUpdateFailHTLC this_ptr_conv;
46522         this_ptr_conv.inner = untag_ptr(this_ptr);
46523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46525         this_ptr_conv.is_owned = false;
46526         LDKThirtyTwoBytes val_ref;
46527         CHECK(val->arr_len == 32);
46528         memcpy(val_ref.data, val->elems, 32); FREE(val);
46529         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
46530 }
46531
46532 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
46533         LDKUpdateFailHTLC this_ptr_conv;
46534         this_ptr_conv.inner = untag_ptr(this_ptr);
46535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46537         this_ptr_conv.is_owned = false;
46538         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
46539         return ret_conv;
46540 }
46541
46542 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
46543         LDKUpdateFailHTLC this_ptr_conv;
46544         this_ptr_conv.inner = untag_ptr(this_ptr);
46545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46547         this_ptr_conv.is_owned = false;
46548         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
46549 }
46550
46551 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
46552         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
46553         uint64_t ret_ref = 0;
46554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46556         return ret_ref;
46557 }
46558 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
46559         LDKUpdateFailHTLC arg_conv;
46560         arg_conv.inner = untag_ptr(arg);
46561         arg_conv.is_owned = ptr_is_owned(arg);
46562         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46563         arg_conv.is_owned = false;
46564         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
46565         return ret_conv;
46566 }
46567
46568 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
46569         LDKUpdateFailHTLC orig_conv;
46570         orig_conv.inner = untag_ptr(orig);
46571         orig_conv.is_owned = ptr_is_owned(orig);
46572         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46573         orig_conv.is_owned = false;
46574         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
46575         uint64_t ret_ref = 0;
46576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46578         return ret_ref;
46579 }
46580
46581 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_hash"))) TS_UpdateFailHTLC_hash(uint64_t o) {
46582         LDKUpdateFailHTLC o_conv;
46583         o_conv.inner = untag_ptr(o);
46584         o_conv.is_owned = ptr_is_owned(o);
46585         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46586         o_conv.is_owned = false;
46587         int64_t ret_conv = UpdateFailHTLC_hash(&o_conv);
46588         return ret_conv;
46589 }
46590
46591 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
46592         LDKUpdateFailHTLC a_conv;
46593         a_conv.inner = untag_ptr(a);
46594         a_conv.is_owned = ptr_is_owned(a);
46595         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46596         a_conv.is_owned = false;
46597         LDKUpdateFailHTLC b_conv;
46598         b_conv.inner = untag_ptr(b);
46599         b_conv.is_owned = ptr_is_owned(b);
46600         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46601         b_conv.is_owned = false;
46602         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
46603         return ret_conv;
46604 }
46605
46606 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
46607         LDKUpdateFailMalformedHTLC this_obj_conv;
46608         this_obj_conv.inner = untag_ptr(this_obj);
46609         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46611         UpdateFailMalformedHTLC_free(this_obj_conv);
46612 }
46613
46614 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
46615         LDKUpdateFailMalformedHTLC this_ptr_conv;
46616         this_ptr_conv.inner = untag_ptr(this_ptr);
46617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46619         this_ptr_conv.is_owned = false;
46620         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46621         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
46622         return ret_arr;
46623 }
46624
46625 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
46626         LDKUpdateFailMalformedHTLC this_ptr_conv;
46627         this_ptr_conv.inner = untag_ptr(this_ptr);
46628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46630         this_ptr_conv.is_owned = false;
46631         LDKThirtyTwoBytes val_ref;
46632         CHECK(val->arr_len == 32);
46633         memcpy(val_ref.data, val->elems, 32); FREE(val);
46634         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
46635 }
46636
46637 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
46638         LDKUpdateFailMalformedHTLC this_ptr_conv;
46639         this_ptr_conv.inner = untag_ptr(this_ptr);
46640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46642         this_ptr_conv.is_owned = false;
46643         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
46644         return ret_conv;
46645 }
46646
46647 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
46648         LDKUpdateFailMalformedHTLC this_ptr_conv;
46649         this_ptr_conv.inner = untag_ptr(this_ptr);
46650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46652         this_ptr_conv.is_owned = false;
46653         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
46654 }
46655
46656 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
46657         LDKUpdateFailMalformedHTLC this_ptr_conv;
46658         this_ptr_conv.inner = untag_ptr(this_ptr);
46659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46661         this_ptr_conv.is_owned = false;
46662         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
46663         return ret_conv;
46664 }
46665
46666 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
46667         LDKUpdateFailMalformedHTLC this_ptr_conv;
46668         this_ptr_conv.inner = untag_ptr(this_ptr);
46669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46671         this_ptr_conv.is_owned = false;
46672         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
46673 }
46674
46675 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
46676         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
46677         uint64_t ret_ref = 0;
46678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46680         return ret_ref;
46681 }
46682 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
46683         LDKUpdateFailMalformedHTLC arg_conv;
46684         arg_conv.inner = untag_ptr(arg);
46685         arg_conv.is_owned = ptr_is_owned(arg);
46686         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46687         arg_conv.is_owned = false;
46688         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
46689         return ret_conv;
46690 }
46691
46692 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
46693         LDKUpdateFailMalformedHTLC orig_conv;
46694         orig_conv.inner = untag_ptr(orig);
46695         orig_conv.is_owned = ptr_is_owned(orig);
46696         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46697         orig_conv.is_owned = false;
46698         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
46699         uint64_t ret_ref = 0;
46700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46702         return ret_ref;
46703 }
46704
46705 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_hash"))) TS_UpdateFailMalformedHTLC_hash(uint64_t o) {
46706         LDKUpdateFailMalformedHTLC o_conv;
46707         o_conv.inner = untag_ptr(o);
46708         o_conv.is_owned = ptr_is_owned(o);
46709         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46710         o_conv.is_owned = false;
46711         int64_t ret_conv = UpdateFailMalformedHTLC_hash(&o_conv);
46712         return ret_conv;
46713 }
46714
46715 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
46716         LDKUpdateFailMalformedHTLC a_conv;
46717         a_conv.inner = untag_ptr(a);
46718         a_conv.is_owned = ptr_is_owned(a);
46719         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46720         a_conv.is_owned = false;
46721         LDKUpdateFailMalformedHTLC b_conv;
46722         b_conv.inner = untag_ptr(b);
46723         b_conv.is_owned = ptr_is_owned(b);
46724         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46725         b_conv.is_owned = false;
46726         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
46727         return ret_conv;
46728 }
46729
46730 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
46731         LDKCommitmentSigned this_obj_conv;
46732         this_obj_conv.inner = untag_ptr(this_obj);
46733         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46735         CommitmentSigned_free(this_obj_conv);
46736 }
46737
46738 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
46739         LDKCommitmentSigned this_ptr_conv;
46740         this_ptr_conv.inner = untag_ptr(this_ptr);
46741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46743         this_ptr_conv.is_owned = false;
46744         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46745         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
46746         return ret_arr;
46747 }
46748
46749 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
46750         LDKCommitmentSigned this_ptr_conv;
46751         this_ptr_conv.inner = untag_ptr(this_ptr);
46752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46754         this_ptr_conv.is_owned = false;
46755         LDKThirtyTwoBytes val_ref;
46756         CHECK(val->arr_len == 32);
46757         memcpy(val_ref.data, val->elems, 32); FREE(val);
46758         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
46759 }
46760
46761 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
46762         LDKCommitmentSigned this_ptr_conv;
46763         this_ptr_conv.inner = untag_ptr(this_ptr);
46764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46766         this_ptr_conv.is_owned = false;
46767         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
46768         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
46769         return ret_arr;
46770 }
46771
46772 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
46773         LDKCommitmentSigned this_ptr_conv;
46774         this_ptr_conv.inner = untag_ptr(this_ptr);
46775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46777         this_ptr_conv.is_owned = false;
46778         LDKECDSASignature val_ref;
46779         CHECK(val->arr_len == 64);
46780         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
46781         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
46782 }
46783
46784 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
46785         LDKCommitmentSigned this_ptr_conv;
46786         this_ptr_conv.inner = untag_ptr(this_ptr);
46787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46789         this_ptr_conv.is_owned = false;
46790         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
46791         ptrArray ret_arr = NULL;
46792         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
46793         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
46794         for (size_t m = 0; m < ret_var.datalen; m++) {
46795                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
46796                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
46797                 ret_arr_ptr[m] = ret_conv_12_arr;
46798         }
46799         
46800         FREE(ret_var.data);
46801         return ret_arr;
46802 }
46803
46804 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
46805         LDKCommitmentSigned this_ptr_conv;
46806         this_ptr_conv.inner = untag_ptr(this_ptr);
46807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46809         this_ptr_conv.is_owned = false;
46810         LDKCVec_ECDSASignatureZ val_constr;
46811         val_constr.datalen = val->arr_len;
46812         if (val_constr.datalen > 0)
46813                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
46814         else
46815                 val_constr.data = NULL;
46816         int8_tArray* val_vals = (void*) val->elems;
46817         for (size_t m = 0; m < val_constr.datalen; m++) {
46818                 int8_tArray val_conv_12 = val_vals[m];
46819                 LDKECDSASignature val_conv_12_ref;
46820                 CHECK(val_conv_12->arr_len == 64);
46821                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
46822                 val_constr.data[m] = val_conv_12_ref;
46823         }
46824         FREE(val);
46825         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
46826 }
46827
46828 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
46829         LDKThirtyTwoBytes channel_id_arg_ref;
46830         CHECK(channel_id_arg->arr_len == 32);
46831         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
46832         LDKECDSASignature signature_arg_ref;
46833         CHECK(signature_arg->arr_len == 64);
46834         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
46835         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
46836         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
46837         if (htlc_signatures_arg_constr.datalen > 0)
46838                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
46839         else
46840                 htlc_signatures_arg_constr.data = NULL;
46841         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
46842         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
46843                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
46844                 LDKECDSASignature htlc_signatures_arg_conv_12_ref;
46845                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
46846                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
46847                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
46848         }
46849         FREE(htlc_signatures_arg);
46850         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
46851         uint64_t ret_ref = 0;
46852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46854         return ret_ref;
46855 }
46856
46857 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
46858         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
46859         uint64_t ret_ref = 0;
46860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46862         return ret_ref;
46863 }
46864 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
46865         LDKCommitmentSigned arg_conv;
46866         arg_conv.inner = untag_ptr(arg);
46867         arg_conv.is_owned = ptr_is_owned(arg);
46868         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46869         arg_conv.is_owned = false;
46870         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
46871         return ret_conv;
46872 }
46873
46874 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
46875         LDKCommitmentSigned orig_conv;
46876         orig_conv.inner = untag_ptr(orig);
46877         orig_conv.is_owned = ptr_is_owned(orig);
46878         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46879         orig_conv.is_owned = false;
46880         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
46881         uint64_t ret_ref = 0;
46882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46884         return ret_ref;
46885 }
46886
46887 int64_t  __attribute__((export_name("TS_CommitmentSigned_hash"))) TS_CommitmentSigned_hash(uint64_t o) {
46888         LDKCommitmentSigned o_conv;
46889         o_conv.inner = untag_ptr(o);
46890         o_conv.is_owned = ptr_is_owned(o);
46891         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46892         o_conv.is_owned = false;
46893         int64_t ret_conv = CommitmentSigned_hash(&o_conv);
46894         return ret_conv;
46895 }
46896
46897 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
46898         LDKCommitmentSigned 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         LDKCommitmentSigned 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 = CommitmentSigned_eq(&a_conv, &b_conv);
46909         return ret_conv;
46910 }
46911
46912 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
46913         LDKRevokeAndACK this_obj_conv;
46914         this_obj_conv.inner = untag_ptr(this_obj);
46915         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46917         RevokeAndACK_free(this_obj_conv);
46918 }
46919
46920 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
46921         LDKRevokeAndACK this_ptr_conv;
46922         this_ptr_conv.inner = untag_ptr(this_ptr);
46923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46925         this_ptr_conv.is_owned = false;
46926         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46927         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
46928         return ret_arr;
46929 }
46930
46931 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
46932         LDKRevokeAndACK this_ptr_conv;
46933         this_ptr_conv.inner = untag_ptr(this_ptr);
46934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46936         this_ptr_conv.is_owned = false;
46937         LDKThirtyTwoBytes val_ref;
46938         CHECK(val->arr_len == 32);
46939         memcpy(val_ref.data, val->elems, 32); FREE(val);
46940         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
46941 }
46942
46943 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
46944         LDKRevokeAndACK this_ptr_conv;
46945         this_ptr_conv.inner = untag_ptr(this_ptr);
46946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46948         this_ptr_conv.is_owned = false;
46949         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46950         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
46951         return ret_arr;
46952 }
46953
46954 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
46955         LDKRevokeAndACK this_ptr_conv;
46956         this_ptr_conv.inner = untag_ptr(this_ptr);
46957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46959         this_ptr_conv.is_owned = false;
46960         LDKThirtyTwoBytes val_ref;
46961         CHECK(val->arr_len == 32);
46962         memcpy(val_ref.data, val->elems, 32); FREE(val);
46963         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
46964 }
46965
46966 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
46967         LDKRevokeAndACK this_ptr_conv;
46968         this_ptr_conv.inner = untag_ptr(this_ptr);
46969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46971         this_ptr_conv.is_owned = false;
46972         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46973         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
46974         return ret_arr;
46975 }
46976
46977 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) {
46978         LDKRevokeAndACK this_ptr_conv;
46979         this_ptr_conv.inner = untag_ptr(this_ptr);
46980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46982         this_ptr_conv.is_owned = false;
46983         LDKPublicKey val_ref;
46984         CHECK(val->arr_len == 33);
46985         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46986         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
46987 }
46988
46989 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) {
46990         LDKThirtyTwoBytes channel_id_arg_ref;
46991         CHECK(channel_id_arg->arr_len == 32);
46992         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
46993         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
46994         CHECK(per_commitment_secret_arg->arr_len == 32);
46995         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
46996         LDKPublicKey next_per_commitment_point_arg_ref;
46997         CHECK(next_per_commitment_point_arg->arr_len == 33);
46998         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
46999         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
47000         uint64_t ret_ref = 0;
47001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47003         return ret_ref;
47004 }
47005
47006 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
47007         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
47008         uint64_t ret_ref = 0;
47009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47011         return ret_ref;
47012 }
47013 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
47014         LDKRevokeAndACK arg_conv;
47015         arg_conv.inner = untag_ptr(arg);
47016         arg_conv.is_owned = ptr_is_owned(arg);
47017         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47018         arg_conv.is_owned = false;
47019         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
47020         return ret_conv;
47021 }
47022
47023 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
47024         LDKRevokeAndACK orig_conv;
47025         orig_conv.inner = untag_ptr(orig);
47026         orig_conv.is_owned = ptr_is_owned(orig);
47027         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47028         orig_conv.is_owned = false;
47029         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
47030         uint64_t ret_ref = 0;
47031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47033         return ret_ref;
47034 }
47035
47036 int64_t  __attribute__((export_name("TS_RevokeAndACK_hash"))) TS_RevokeAndACK_hash(uint64_t o) {
47037         LDKRevokeAndACK o_conv;
47038         o_conv.inner = untag_ptr(o);
47039         o_conv.is_owned = ptr_is_owned(o);
47040         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47041         o_conv.is_owned = false;
47042         int64_t ret_conv = RevokeAndACK_hash(&o_conv);
47043         return ret_conv;
47044 }
47045
47046 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
47047         LDKRevokeAndACK a_conv;
47048         a_conv.inner = untag_ptr(a);
47049         a_conv.is_owned = ptr_is_owned(a);
47050         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47051         a_conv.is_owned = false;
47052         LDKRevokeAndACK b_conv;
47053         b_conv.inner = untag_ptr(b);
47054         b_conv.is_owned = ptr_is_owned(b);
47055         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47056         b_conv.is_owned = false;
47057         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
47058         return ret_conv;
47059 }
47060
47061 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
47062         LDKUpdateFee this_obj_conv;
47063         this_obj_conv.inner = untag_ptr(this_obj);
47064         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47066         UpdateFee_free(this_obj_conv);
47067 }
47068
47069 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
47070         LDKUpdateFee this_ptr_conv;
47071         this_ptr_conv.inner = untag_ptr(this_ptr);
47072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47074         this_ptr_conv.is_owned = false;
47075         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47076         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
47077         return ret_arr;
47078 }
47079
47080 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
47081         LDKUpdateFee this_ptr_conv;
47082         this_ptr_conv.inner = untag_ptr(this_ptr);
47083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47085         this_ptr_conv.is_owned = false;
47086         LDKThirtyTwoBytes val_ref;
47087         CHECK(val->arr_len == 32);
47088         memcpy(val_ref.data, val->elems, 32); FREE(val);
47089         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
47090 }
47091
47092 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
47093         LDKUpdateFee this_ptr_conv;
47094         this_ptr_conv.inner = untag_ptr(this_ptr);
47095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47097         this_ptr_conv.is_owned = false;
47098         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
47099         return ret_conv;
47100 }
47101
47102 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
47103         LDKUpdateFee this_ptr_conv;
47104         this_ptr_conv.inner = untag_ptr(this_ptr);
47105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47107         this_ptr_conv.is_owned = false;
47108         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
47109 }
47110
47111 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
47112         LDKThirtyTwoBytes channel_id_arg_ref;
47113         CHECK(channel_id_arg->arr_len == 32);
47114         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
47115         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
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 UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
47123         LDKUpdateFee ret_var = UpdateFee_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_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
47130         LDKUpdateFee 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 = UpdateFee_clone_ptr(&arg_conv);
47136         return ret_conv;
47137 }
47138
47139 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
47140         LDKUpdateFee 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         LDKUpdateFee ret_var = UpdateFee_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 int64_t  __attribute__((export_name("TS_UpdateFee_hash"))) TS_UpdateFee_hash(uint64_t o) {
47153         LDKUpdateFee o_conv;
47154         o_conv.inner = untag_ptr(o);
47155         o_conv.is_owned = ptr_is_owned(o);
47156         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47157         o_conv.is_owned = false;
47158         int64_t ret_conv = UpdateFee_hash(&o_conv);
47159         return ret_conv;
47160 }
47161
47162 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
47163         LDKUpdateFee a_conv;
47164         a_conv.inner = untag_ptr(a);
47165         a_conv.is_owned = ptr_is_owned(a);
47166         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47167         a_conv.is_owned = false;
47168         LDKUpdateFee b_conv;
47169         b_conv.inner = untag_ptr(b);
47170         b_conv.is_owned = ptr_is_owned(b);
47171         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47172         b_conv.is_owned = false;
47173         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
47174         return ret_conv;
47175 }
47176
47177 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
47178         LDKChannelReestablish this_obj_conv;
47179         this_obj_conv.inner = untag_ptr(this_obj);
47180         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47182         ChannelReestablish_free(this_obj_conv);
47183 }
47184
47185 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
47186         LDKChannelReestablish this_ptr_conv;
47187         this_ptr_conv.inner = untag_ptr(this_ptr);
47188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47190         this_ptr_conv.is_owned = false;
47191         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47192         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
47193         return ret_arr;
47194 }
47195
47196 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
47197         LDKChannelReestablish this_ptr_conv;
47198         this_ptr_conv.inner = untag_ptr(this_ptr);
47199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47201         this_ptr_conv.is_owned = false;
47202         LDKThirtyTwoBytes val_ref;
47203         CHECK(val->arr_len == 32);
47204         memcpy(val_ref.data, val->elems, 32); FREE(val);
47205         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
47206 }
47207
47208 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
47209         LDKChannelReestablish this_ptr_conv;
47210         this_ptr_conv.inner = untag_ptr(this_ptr);
47211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47213         this_ptr_conv.is_owned = false;
47214         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
47215         return ret_conv;
47216 }
47217
47218 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) {
47219         LDKChannelReestablish this_ptr_conv;
47220         this_ptr_conv.inner = untag_ptr(this_ptr);
47221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47223         this_ptr_conv.is_owned = false;
47224         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
47225 }
47226
47227 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
47228         LDKChannelReestablish this_ptr_conv;
47229         this_ptr_conv.inner = untag_ptr(this_ptr);
47230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47232         this_ptr_conv.is_owned = false;
47233         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
47234         return ret_conv;
47235 }
47236
47237 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) {
47238         LDKChannelReestablish this_ptr_conv;
47239         this_ptr_conv.inner = untag_ptr(this_ptr);
47240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47242         this_ptr_conv.is_owned = false;
47243         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
47244 }
47245
47246 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) {
47247         LDKChannelReestablish this_ptr_conv;
47248         this_ptr_conv.inner = untag_ptr(this_ptr);
47249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47251         this_ptr_conv.is_owned = false;
47252         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47253         memcpy(ret_arr->elems, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
47254         return ret_arr;
47255 }
47256
47257 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) {
47258         LDKChannelReestablish this_ptr_conv;
47259         this_ptr_conv.inner = untag_ptr(this_ptr);
47260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47262         this_ptr_conv.is_owned = false;
47263         LDKThirtyTwoBytes val_ref;
47264         CHECK(val->arr_len == 32);
47265         memcpy(val_ref.data, val->elems, 32); FREE(val);
47266         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
47267 }
47268
47269 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) {
47270         LDKChannelReestablish this_ptr_conv;
47271         this_ptr_conv.inner = untag_ptr(this_ptr);
47272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47274         this_ptr_conv.is_owned = false;
47275         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47276         memcpy(ret_arr->elems, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
47277         return ret_arr;
47278 }
47279
47280 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) {
47281         LDKChannelReestablish this_ptr_conv;
47282         this_ptr_conv.inner = untag_ptr(this_ptr);
47283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47285         this_ptr_conv.is_owned = false;
47286         LDKPublicKey val_ref;
47287         CHECK(val->arr_len == 33);
47288         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47289         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
47290 }
47291
47292 uint64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_funding_txid"))) TS_ChannelReestablish_get_next_funding_txid(uint64_t this_ptr) {
47293         LDKChannelReestablish this_ptr_conv;
47294         this_ptr_conv.inner = untag_ptr(this_ptr);
47295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47297         this_ptr_conv.is_owned = false;
47298         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
47299         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
47300         uint64_t ret_ref = tag_ptr(ret_copy, true);
47301         return ret_ref;
47302 }
47303
47304 void  __attribute__((export_name("TS_ChannelReestablish_set_next_funding_txid"))) TS_ChannelReestablish_set_next_funding_txid(uint64_t this_ptr, uint64_t val) {
47305         LDKChannelReestablish this_ptr_conv;
47306         this_ptr_conv.inner = untag_ptr(this_ptr);
47307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47309         this_ptr_conv.is_owned = false;
47310         void* val_ptr = untag_ptr(val);
47311         CHECK_ACCESS(val_ptr);
47312         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
47313         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
47314         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
47315 }
47316
47317 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) {
47318         LDKThirtyTwoBytes channel_id_arg_ref;
47319         CHECK(channel_id_arg->arr_len == 32);
47320         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
47321         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
47322         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
47323         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
47324         LDKPublicKey my_current_per_commitment_point_arg_ref;
47325         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
47326         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);
47327         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
47328         CHECK_ACCESS(next_funding_txid_arg_ptr);
47329         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
47330         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
47331         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);
47332         uint64_t ret_ref = 0;
47333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47335         return ret_ref;
47336 }
47337
47338 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
47339         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
47340         uint64_t ret_ref = 0;
47341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47343         return ret_ref;
47344 }
47345 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
47346         LDKChannelReestablish arg_conv;
47347         arg_conv.inner = untag_ptr(arg);
47348         arg_conv.is_owned = ptr_is_owned(arg);
47349         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47350         arg_conv.is_owned = false;
47351         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
47352         return ret_conv;
47353 }
47354
47355 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
47356         LDKChannelReestablish orig_conv;
47357         orig_conv.inner = untag_ptr(orig);
47358         orig_conv.is_owned = ptr_is_owned(orig);
47359         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47360         orig_conv.is_owned = false;
47361         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
47362         uint64_t ret_ref = 0;
47363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47365         return ret_ref;
47366 }
47367
47368 int64_t  __attribute__((export_name("TS_ChannelReestablish_hash"))) TS_ChannelReestablish_hash(uint64_t o) {
47369         LDKChannelReestablish o_conv;
47370         o_conv.inner = untag_ptr(o);
47371         o_conv.is_owned = ptr_is_owned(o);
47372         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47373         o_conv.is_owned = false;
47374         int64_t ret_conv = ChannelReestablish_hash(&o_conv);
47375         return ret_conv;
47376 }
47377
47378 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
47379         LDKChannelReestablish a_conv;
47380         a_conv.inner = untag_ptr(a);
47381         a_conv.is_owned = ptr_is_owned(a);
47382         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47383         a_conv.is_owned = false;
47384         LDKChannelReestablish b_conv;
47385         b_conv.inner = untag_ptr(b);
47386         b_conv.is_owned = ptr_is_owned(b);
47387         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47388         b_conv.is_owned = false;
47389         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
47390         return ret_conv;
47391 }
47392
47393 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
47394         LDKAnnouncementSignatures this_obj_conv;
47395         this_obj_conv.inner = untag_ptr(this_obj);
47396         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47398         AnnouncementSignatures_free(this_obj_conv);
47399 }
47400
47401 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
47402         LDKAnnouncementSignatures this_ptr_conv;
47403         this_ptr_conv.inner = untag_ptr(this_ptr);
47404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47406         this_ptr_conv.is_owned = false;
47407         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47408         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
47409         return ret_arr;
47410 }
47411
47412 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
47413         LDKAnnouncementSignatures this_ptr_conv;
47414         this_ptr_conv.inner = untag_ptr(this_ptr);
47415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47417         this_ptr_conv.is_owned = false;
47418         LDKThirtyTwoBytes val_ref;
47419         CHECK(val->arr_len == 32);
47420         memcpy(val_ref.data, val->elems, 32); FREE(val);
47421         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
47422 }
47423
47424 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
47425         LDKAnnouncementSignatures this_ptr_conv;
47426         this_ptr_conv.inner = untag_ptr(this_ptr);
47427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47429         this_ptr_conv.is_owned = false;
47430         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
47431         return ret_conv;
47432 }
47433
47434 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
47435         LDKAnnouncementSignatures this_ptr_conv;
47436         this_ptr_conv.inner = untag_ptr(this_ptr);
47437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47439         this_ptr_conv.is_owned = false;
47440         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
47441 }
47442
47443 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
47444         LDKAnnouncementSignatures this_ptr_conv;
47445         this_ptr_conv.inner = untag_ptr(this_ptr);
47446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47448         this_ptr_conv.is_owned = false;
47449         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
47450         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
47451         return ret_arr;
47452 }
47453
47454 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
47455         LDKAnnouncementSignatures this_ptr_conv;
47456         this_ptr_conv.inner = untag_ptr(this_ptr);
47457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47459         this_ptr_conv.is_owned = false;
47460         LDKECDSASignature val_ref;
47461         CHECK(val->arr_len == 64);
47462         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
47463         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
47464 }
47465
47466 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
47467         LDKAnnouncementSignatures this_ptr_conv;
47468         this_ptr_conv.inner = untag_ptr(this_ptr);
47469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47471         this_ptr_conv.is_owned = false;
47472         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
47473         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
47474         return ret_arr;
47475 }
47476
47477 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
47478         LDKAnnouncementSignatures this_ptr_conv;
47479         this_ptr_conv.inner = untag_ptr(this_ptr);
47480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47482         this_ptr_conv.is_owned = false;
47483         LDKECDSASignature val_ref;
47484         CHECK(val->arr_len == 64);
47485         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
47486         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
47487 }
47488
47489 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) {
47490         LDKThirtyTwoBytes channel_id_arg_ref;
47491         CHECK(channel_id_arg->arr_len == 32);
47492         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
47493         LDKECDSASignature node_signature_arg_ref;
47494         CHECK(node_signature_arg->arr_len == 64);
47495         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
47496         LDKECDSASignature bitcoin_signature_arg_ref;
47497         CHECK(bitcoin_signature_arg->arr_len == 64);
47498         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
47499         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
47500         uint64_t ret_ref = 0;
47501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47503         return ret_ref;
47504 }
47505
47506 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
47507         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
47508         uint64_t ret_ref = 0;
47509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47511         return ret_ref;
47512 }
47513 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
47514         LDKAnnouncementSignatures arg_conv;
47515         arg_conv.inner = untag_ptr(arg);
47516         arg_conv.is_owned = ptr_is_owned(arg);
47517         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47518         arg_conv.is_owned = false;
47519         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
47520         return ret_conv;
47521 }
47522
47523 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
47524         LDKAnnouncementSignatures orig_conv;
47525         orig_conv.inner = untag_ptr(orig);
47526         orig_conv.is_owned = ptr_is_owned(orig);
47527         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47528         orig_conv.is_owned = false;
47529         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
47530         uint64_t ret_ref = 0;
47531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47533         return ret_ref;
47534 }
47535
47536 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_hash"))) TS_AnnouncementSignatures_hash(uint64_t o) {
47537         LDKAnnouncementSignatures o_conv;
47538         o_conv.inner = untag_ptr(o);
47539         o_conv.is_owned = ptr_is_owned(o);
47540         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47541         o_conv.is_owned = false;
47542         int64_t ret_conv = AnnouncementSignatures_hash(&o_conv);
47543         return ret_conv;
47544 }
47545
47546 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
47547         LDKAnnouncementSignatures a_conv;
47548         a_conv.inner = untag_ptr(a);
47549         a_conv.is_owned = ptr_is_owned(a);
47550         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47551         a_conv.is_owned = false;
47552         LDKAnnouncementSignatures b_conv;
47553         b_conv.inner = untag_ptr(b);
47554         b_conv.is_owned = ptr_is_owned(b);
47555         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47556         b_conv.is_owned = false;
47557         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
47558         return ret_conv;
47559 }
47560
47561 void  __attribute__((export_name("TS_SocketAddress_free"))) TS_SocketAddress_free(uint64_t this_ptr) {
47562         if (!ptr_is_owned(this_ptr)) return;
47563         void* this_ptr_ptr = untag_ptr(this_ptr);
47564         CHECK_ACCESS(this_ptr_ptr);
47565         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
47566         FREE(untag_ptr(this_ptr));
47567         SocketAddress_free(this_ptr_conv);
47568 }
47569
47570 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
47571         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47572         *ret_copy = SocketAddress_clone(arg);
47573         uint64_t ret_ref = tag_ptr(ret_copy, true);
47574         return ret_ref;
47575 }
47576 int64_t  __attribute__((export_name("TS_SocketAddress_clone_ptr"))) TS_SocketAddress_clone_ptr(uint64_t arg) {
47577         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
47578         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
47579         return ret_conv;
47580 }
47581
47582 uint64_t  __attribute__((export_name("TS_SocketAddress_clone"))) TS_SocketAddress_clone(uint64_t orig) {
47583         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
47584         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47585         *ret_copy = SocketAddress_clone(orig_conv);
47586         uint64_t ret_ref = tag_ptr(ret_copy, true);
47587         return ret_ref;
47588 }
47589
47590 uint64_t  __attribute__((export_name("TS_SocketAddress_tcp_ip_v4"))) TS_SocketAddress_tcp_ip_v4(int8_tArray addr, int16_t port) {
47591         LDKFourBytes addr_ref;
47592         CHECK(addr->arr_len == 4);
47593         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
47594         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47595         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
47596         uint64_t ret_ref = tag_ptr(ret_copy, true);
47597         return ret_ref;
47598 }
47599
47600 uint64_t  __attribute__((export_name("TS_SocketAddress_tcp_ip_v6"))) TS_SocketAddress_tcp_ip_v6(int8_tArray addr, int16_t port) {
47601         LDKSixteenBytes addr_ref;
47602         CHECK(addr->arr_len == 16);
47603         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
47604         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47605         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
47606         uint64_t ret_ref = tag_ptr(ret_copy, true);
47607         return ret_ref;
47608 }
47609
47610 uint64_t  __attribute__((export_name("TS_SocketAddress_onion_v2"))) TS_SocketAddress_onion_v2(int8_tArray a) {
47611         LDKTwelveBytes a_ref;
47612         CHECK(a->arr_len == 12);
47613         memcpy(a_ref.data, a->elems, 12); FREE(a);
47614         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47615         *ret_copy = SocketAddress_onion_v2(a_ref);
47616         uint64_t ret_ref = tag_ptr(ret_copy, true);
47617         return ret_ref;
47618 }
47619
47620 uint64_t  __attribute__((export_name("TS_SocketAddress_onion_v3"))) TS_SocketAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
47621         LDKThirtyTwoBytes ed25519_pubkey_ref;
47622         CHECK(ed25519_pubkey->arr_len == 32);
47623         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
47624         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47625         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
47626         uint64_t ret_ref = tag_ptr(ret_copy, true);
47627         return ret_ref;
47628 }
47629
47630 uint64_t  __attribute__((export_name("TS_SocketAddress_hostname"))) TS_SocketAddress_hostname(uint64_t hostname, int16_t port) {
47631         LDKHostname hostname_conv;
47632         hostname_conv.inner = untag_ptr(hostname);
47633         hostname_conv.is_owned = ptr_is_owned(hostname);
47634         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
47635         hostname_conv = Hostname_clone(&hostname_conv);
47636         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47637         *ret_copy = SocketAddress_hostname(hostname_conv, port);
47638         uint64_t ret_ref = tag_ptr(ret_copy, true);
47639         return ret_ref;
47640 }
47641
47642 int64_t  __attribute__((export_name("TS_SocketAddress_hash"))) TS_SocketAddress_hash(uint64_t o) {
47643         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
47644         int64_t ret_conv = SocketAddress_hash(o_conv);
47645         return ret_conv;
47646 }
47647
47648 jboolean  __attribute__((export_name("TS_SocketAddress_eq"))) TS_SocketAddress_eq(uint64_t a, uint64_t b) {
47649         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
47650         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
47651         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
47652         return ret_conv;
47653 }
47654
47655 int8_tArray  __attribute__((export_name("TS_SocketAddress_write"))) TS_SocketAddress_write(uint64_t obj) {
47656         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
47657         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
47658         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47659         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47660         CVec_u8Z_free(ret_var);
47661         return ret_arr;
47662 }
47663
47664 uint64_t  __attribute__((export_name("TS_SocketAddress_read"))) TS_SocketAddress_read(int8_tArray ser) {
47665         LDKu8slice ser_ref;
47666         ser_ref.datalen = ser->arr_len;
47667         ser_ref.data = ser->elems;
47668         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
47669         *ret_conv = SocketAddress_read(ser_ref);
47670         FREE(ser);
47671         return tag_ptr(ret_conv, true);
47672 }
47673
47674 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_clone"))) TS_SocketAddressParseError_clone(uint64_t orig) {
47675         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
47676         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_clone(orig_conv));
47677         return ret_conv;
47678 }
47679
47680 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_socket_addr_parse"))) TS_SocketAddressParseError_socket_addr_parse() {
47681         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_socket_addr_parse());
47682         return ret_conv;
47683 }
47684
47685 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_input"))) TS_SocketAddressParseError_invalid_input() {
47686         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_input());
47687         return ret_conv;
47688 }
47689
47690 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_port"))) TS_SocketAddressParseError_invalid_port() {
47691         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_port());
47692         return ret_conv;
47693 }
47694
47695 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_onion_v3"))) TS_SocketAddressParseError_invalid_onion_v3() {
47696         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_onion_v3());
47697         return ret_conv;
47698 }
47699
47700 int64_t  __attribute__((export_name("TS_SocketAddressParseError_hash"))) TS_SocketAddressParseError_hash(uint64_t o) {
47701         LDKSocketAddressParseError* o_conv = (LDKSocketAddressParseError*)untag_ptr(o);
47702         int64_t ret_conv = SocketAddressParseError_hash(o_conv);
47703         return ret_conv;
47704 }
47705
47706 jboolean  __attribute__((export_name("TS_SocketAddressParseError_eq"))) TS_SocketAddressParseError_eq(uint64_t a, uint64_t b) {
47707         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
47708         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
47709         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
47710         return ret_conv;
47711 }
47712
47713 uint64_t  __attribute__((export_name("TS_parse_onion_address"))) TS_parse_onion_address(jstring host, int16_t port) {
47714         LDKStr host_conv = str_ref_to_owned_c(host);
47715         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
47716         *ret_conv = parse_onion_address(host_conv, port);
47717         return tag_ptr(ret_conv, true);
47718 }
47719
47720 jstring  __attribute__((export_name("TS_SocketAddress_to_str"))) TS_SocketAddress_to_str(uint64_t o) {
47721         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
47722         LDKStr ret_str = SocketAddress_to_str(o_conv);
47723         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
47724         Str_free(ret_str);
47725         return ret_conv;
47726 }
47727
47728 void  __attribute__((export_name("TS_UnsignedGossipMessage_free"))) TS_UnsignedGossipMessage_free(uint64_t this_ptr) {
47729         if (!ptr_is_owned(this_ptr)) return;
47730         void* this_ptr_ptr = untag_ptr(this_ptr);
47731         CHECK_ACCESS(this_ptr_ptr);
47732         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
47733         FREE(untag_ptr(this_ptr));
47734         UnsignedGossipMessage_free(this_ptr_conv);
47735 }
47736
47737 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
47738         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47739         *ret_copy = UnsignedGossipMessage_clone(arg);
47740         uint64_t ret_ref = tag_ptr(ret_copy, true);
47741         return ret_ref;
47742 }
47743 int64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone_ptr"))) TS_UnsignedGossipMessage_clone_ptr(uint64_t arg) {
47744         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
47745         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
47746         return ret_conv;
47747 }
47748
47749 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone"))) TS_UnsignedGossipMessage_clone(uint64_t orig) {
47750         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
47751         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47752         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
47753         uint64_t ret_ref = tag_ptr(ret_copy, true);
47754         return ret_ref;
47755 }
47756
47757 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_announcement"))) TS_UnsignedGossipMessage_channel_announcement(uint64_t a) {
47758         LDKUnsignedChannelAnnouncement a_conv;
47759         a_conv.inner = untag_ptr(a);
47760         a_conv.is_owned = ptr_is_owned(a);
47761         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47762         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
47763         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47764         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
47765         uint64_t ret_ref = tag_ptr(ret_copy, true);
47766         return ret_ref;
47767 }
47768
47769 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_update"))) TS_UnsignedGossipMessage_channel_update(uint64_t a) {
47770         LDKUnsignedChannelUpdate a_conv;
47771         a_conv.inner = untag_ptr(a);
47772         a_conv.is_owned = ptr_is_owned(a);
47773         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47774         a_conv = UnsignedChannelUpdate_clone(&a_conv);
47775         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47776         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
47777         uint64_t ret_ref = tag_ptr(ret_copy, true);
47778         return ret_ref;
47779 }
47780
47781 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_node_announcement"))) TS_UnsignedGossipMessage_node_announcement(uint64_t a) {
47782         LDKUnsignedNodeAnnouncement a_conv;
47783         a_conv.inner = untag_ptr(a);
47784         a_conv.is_owned = ptr_is_owned(a);
47785         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47786         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
47787         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47788         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
47789         uint64_t ret_ref = tag_ptr(ret_copy, true);
47790         return ret_ref;
47791 }
47792
47793 int8_tArray  __attribute__((export_name("TS_UnsignedGossipMessage_write"))) TS_UnsignedGossipMessage_write(uint64_t obj) {
47794         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
47795         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
47796         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47797         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47798         CVec_u8Z_free(ret_var);
47799         return ret_arr;
47800 }
47801
47802 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
47803         LDKUnsignedNodeAnnouncement this_obj_conv;
47804         this_obj_conv.inner = untag_ptr(this_obj);
47805         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47807         UnsignedNodeAnnouncement_free(this_obj_conv);
47808 }
47809
47810 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
47811         LDKUnsignedNodeAnnouncement this_ptr_conv;
47812         this_ptr_conv.inner = untag_ptr(this_ptr);
47813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47815         this_ptr_conv.is_owned = false;
47816         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
47817         uint64_t ret_ref = 0;
47818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47820         return ret_ref;
47821 }
47822
47823 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
47824         LDKUnsignedNodeAnnouncement this_ptr_conv;
47825         this_ptr_conv.inner = untag_ptr(this_ptr);
47826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47828         this_ptr_conv.is_owned = false;
47829         LDKNodeFeatures val_conv;
47830         val_conv.inner = untag_ptr(val);
47831         val_conv.is_owned = ptr_is_owned(val);
47832         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47833         val_conv = NodeFeatures_clone(&val_conv);
47834         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
47835 }
47836
47837 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
47838         LDKUnsignedNodeAnnouncement this_ptr_conv;
47839         this_ptr_conv.inner = untag_ptr(this_ptr);
47840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47842         this_ptr_conv.is_owned = false;
47843         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
47844         return ret_conv;
47845 }
47846
47847 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
47848         LDKUnsignedNodeAnnouncement this_ptr_conv;
47849         this_ptr_conv.inner = untag_ptr(this_ptr);
47850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47852         this_ptr_conv.is_owned = false;
47853         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
47854 }
47855
47856 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
47857         LDKUnsignedNodeAnnouncement this_ptr_conv;
47858         this_ptr_conv.inner = untag_ptr(this_ptr);
47859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47861         this_ptr_conv.is_owned = false;
47862         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
47863         uint64_t ret_ref = 0;
47864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47866         return ret_ref;
47867 }
47868
47869 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, uint64_t val) {
47870         LDKUnsignedNodeAnnouncement this_ptr_conv;
47871         this_ptr_conv.inner = untag_ptr(this_ptr);
47872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47874         this_ptr_conv.is_owned = false;
47875         LDKNodeId val_conv;
47876         val_conv.inner = untag_ptr(val);
47877         val_conv.is_owned = ptr_is_owned(val);
47878         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47879         val_conv = NodeId_clone(&val_conv);
47880         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
47881 }
47882
47883 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
47884         LDKUnsignedNodeAnnouncement this_ptr_conv;
47885         this_ptr_conv.inner = untag_ptr(this_ptr);
47886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47888         this_ptr_conv.is_owned = false;
47889         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
47890         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
47891         return ret_arr;
47892 }
47893
47894 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
47895         LDKUnsignedNodeAnnouncement this_ptr_conv;
47896         this_ptr_conv.inner = untag_ptr(this_ptr);
47897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47899         this_ptr_conv.is_owned = false;
47900         LDKThreeBytes val_ref;
47901         CHECK(val->arr_len == 3);
47902         memcpy(val_ref.data, val->elems, 3); FREE(val);
47903         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
47904 }
47905
47906 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
47907         LDKUnsignedNodeAnnouncement this_ptr_conv;
47908         this_ptr_conv.inner = untag_ptr(this_ptr);
47909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47911         this_ptr_conv.is_owned = false;
47912         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
47913         uint64_t ret_ref = 0;
47914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47916         return ret_ref;
47917 }
47918
47919 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, uint64_t val) {
47920         LDKUnsignedNodeAnnouncement this_ptr_conv;
47921         this_ptr_conv.inner = untag_ptr(this_ptr);
47922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47924         this_ptr_conv.is_owned = false;
47925         LDKNodeAlias val_conv;
47926         val_conv.inner = untag_ptr(val);
47927         val_conv.is_owned = ptr_is_owned(val);
47928         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47929         val_conv = NodeAlias_clone(&val_conv);
47930         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
47931 }
47932
47933 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
47934         LDKUnsignedNodeAnnouncement this_ptr_conv;
47935         this_ptr_conv.inner = untag_ptr(this_ptr);
47936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47938         this_ptr_conv.is_owned = false;
47939         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
47940         uint64_tArray ret_arr = NULL;
47941         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
47942         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
47943         for (size_t p = 0; p < ret_var.datalen; p++) {
47944                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47945                 *ret_conv_15_copy = ret_var.data[p];
47946                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
47947                 ret_arr_ptr[p] = ret_conv_15_ref;
47948         }
47949         
47950         FREE(ret_var.data);
47951         return ret_arr;
47952 }
47953
47954 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
47955         LDKUnsignedNodeAnnouncement this_ptr_conv;
47956         this_ptr_conv.inner = untag_ptr(this_ptr);
47957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47959         this_ptr_conv.is_owned = false;
47960         LDKCVec_SocketAddressZ val_constr;
47961         val_constr.datalen = val->arr_len;
47962         if (val_constr.datalen > 0)
47963                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
47964         else
47965                 val_constr.data = NULL;
47966         uint64_t* val_vals = val->elems;
47967         for (size_t p = 0; p < val_constr.datalen; p++) {
47968                 uint64_t val_conv_15 = val_vals[p];
47969                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
47970                 CHECK_ACCESS(val_conv_15_ptr);
47971                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
47972                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
47973                 val_constr.data[p] = val_conv_15_conv;
47974         }
47975         FREE(val);
47976         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
47977 }
47978
47979 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
47980         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
47981         uint64_t ret_ref = 0;
47982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47984         return ret_ref;
47985 }
47986 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
47987         LDKUnsignedNodeAnnouncement arg_conv;
47988         arg_conv.inner = untag_ptr(arg);
47989         arg_conv.is_owned = ptr_is_owned(arg);
47990         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47991         arg_conv.is_owned = false;
47992         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
47993         return ret_conv;
47994 }
47995
47996 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
47997         LDKUnsignedNodeAnnouncement orig_conv;
47998         orig_conv.inner = untag_ptr(orig);
47999         orig_conv.is_owned = ptr_is_owned(orig);
48000         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48001         orig_conv.is_owned = false;
48002         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
48003         uint64_t ret_ref = 0;
48004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48006         return ret_ref;
48007 }
48008
48009 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_hash"))) TS_UnsignedNodeAnnouncement_hash(uint64_t o) {
48010         LDKUnsignedNodeAnnouncement o_conv;
48011         o_conv.inner = untag_ptr(o);
48012         o_conv.is_owned = ptr_is_owned(o);
48013         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48014         o_conv.is_owned = false;
48015         int64_t ret_conv = UnsignedNodeAnnouncement_hash(&o_conv);
48016         return ret_conv;
48017 }
48018
48019 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
48020         LDKUnsignedNodeAnnouncement a_conv;
48021         a_conv.inner = untag_ptr(a);
48022         a_conv.is_owned = ptr_is_owned(a);
48023         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48024         a_conv.is_owned = false;
48025         LDKUnsignedNodeAnnouncement b_conv;
48026         b_conv.inner = untag_ptr(b);
48027         b_conv.is_owned = ptr_is_owned(b);
48028         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48029         b_conv.is_owned = false;
48030         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
48031         return ret_conv;
48032 }
48033
48034 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
48035         LDKNodeAnnouncement this_obj_conv;
48036         this_obj_conv.inner = untag_ptr(this_obj);
48037         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48039         NodeAnnouncement_free(this_obj_conv);
48040 }
48041
48042 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
48043         LDKNodeAnnouncement this_ptr_conv;
48044         this_ptr_conv.inner = untag_ptr(this_ptr);
48045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48047         this_ptr_conv.is_owned = false;
48048         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48049         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
48050         return ret_arr;
48051 }
48052
48053 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
48054         LDKNodeAnnouncement this_ptr_conv;
48055         this_ptr_conv.inner = untag_ptr(this_ptr);
48056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48058         this_ptr_conv.is_owned = false;
48059         LDKECDSASignature val_ref;
48060         CHECK(val->arr_len == 64);
48061         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48062         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
48063 }
48064
48065 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
48066         LDKNodeAnnouncement this_ptr_conv;
48067         this_ptr_conv.inner = untag_ptr(this_ptr);
48068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48070         this_ptr_conv.is_owned = false;
48071         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
48072         uint64_t ret_ref = 0;
48073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48075         return ret_ref;
48076 }
48077
48078 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
48079         LDKNodeAnnouncement this_ptr_conv;
48080         this_ptr_conv.inner = untag_ptr(this_ptr);
48081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48083         this_ptr_conv.is_owned = false;
48084         LDKUnsignedNodeAnnouncement val_conv;
48085         val_conv.inner = untag_ptr(val);
48086         val_conv.is_owned = ptr_is_owned(val);
48087         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48088         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
48089         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
48090 }
48091
48092 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
48093         LDKECDSASignature signature_arg_ref;
48094         CHECK(signature_arg->arr_len == 64);
48095         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
48096         LDKUnsignedNodeAnnouncement contents_arg_conv;
48097         contents_arg_conv.inner = untag_ptr(contents_arg);
48098         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
48099         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
48100         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
48101         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
48102         uint64_t ret_ref = 0;
48103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48105         return ret_ref;
48106 }
48107
48108 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
48109         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
48110         uint64_t ret_ref = 0;
48111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48113         return ret_ref;
48114 }
48115 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
48116         LDKNodeAnnouncement arg_conv;
48117         arg_conv.inner = untag_ptr(arg);
48118         arg_conv.is_owned = ptr_is_owned(arg);
48119         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48120         arg_conv.is_owned = false;
48121         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
48122         return ret_conv;
48123 }
48124
48125 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
48126         LDKNodeAnnouncement orig_conv;
48127         orig_conv.inner = untag_ptr(orig);
48128         orig_conv.is_owned = ptr_is_owned(orig);
48129         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48130         orig_conv.is_owned = false;
48131         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
48132         uint64_t ret_ref = 0;
48133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48135         return ret_ref;
48136 }
48137
48138 int64_t  __attribute__((export_name("TS_NodeAnnouncement_hash"))) TS_NodeAnnouncement_hash(uint64_t o) {
48139         LDKNodeAnnouncement o_conv;
48140         o_conv.inner = untag_ptr(o);
48141         o_conv.is_owned = ptr_is_owned(o);
48142         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48143         o_conv.is_owned = false;
48144         int64_t ret_conv = NodeAnnouncement_hash(&o_conv);
48145         return ret_conv;
48146 }
48147
48148 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
48149         LDKNodeAnnouncement a_conv;
48150         a_conv.inner = untag_ptr(a);
48151         a_conv.is_owned = ptr_is_owned(a);
48152         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48153         a_conv.is_owned = false;
48154         LDKNodeAnnouncement b_conv;
48155         b_conv.inner = untag_ptr(b);
48156         b_conv.is_owned = ptr_is_owned(b);
48157         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48158         b_conv.is_owned = false;
48159         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
48160         return ret_conv;
48161 }
48162
48163 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
48164         LDKUnsignedChannelAnnouncement this_obj_conv;
48165         this_obj_conv.inner = untag_ptr(this_obj);
48166         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48168         UnsignedChannelAnnouncement_free(this_obj_conv);
48169 }
48170
48171 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
48172         LDKUnsignedChannelAnnouncement this_ptr_conv;
48173         this_ptr_conv.inner = untag_ptr(this_ptr);
48174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48176         this_ptr_conv.is_owned = false;
48177         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
48178         uint64_t ret_ref = 0;
48179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48181         return ret_ref;
48182 }
48183
48184 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
48185         LDKUnsignedChannelAnnouncement this_ptr_conv;
48186         this_ptr_conv.inner = untag_ptr(this_ptr);
48187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48189         this_ptr_conv.is_owned = false;
48190         LDKChannelFeatures val_conv;
48191         val_conv.inner = untag_ptr(val);
48192         val_conv.is_owned = ptr_is_owned(val);
48193         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48194         val_conv = ChannelFeatures_clone(&val_conv);
48195         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
48196 }
48197
48198 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
48199         LDKUnsignedChannelAnnouncement this_ptr_conv;
48200         this_ptr_conv.inner = untag_ptr(this_ptr);
48201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48203         this_ptr_conv.is_owned = false;
48204         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48205         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
48206         return ret_arr;
48207 }
48208
48209 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
48210         LDKUnsignedChannelAnnouncement this_ptr_conv;
48211         this_ptr_conv.inner = untag_ptr(this_ptr);
48212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48214         this_ptr_conv.is_owned = false;
48215         LDKThirtyTwoBytes val_ref;
48216         CHECK(val->arr_len == 32);
48217         memcpy(val_ref.data, val->elems, 32); FREE(val);
48218         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
48219 }
48220
48221 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
48222         LDKUnsignedChannelAnnouncement this_ptr_conv;
48223         this_ptr_conv.inner = untag_ptr(this_ptr);
48224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48226         this_ptr_conv.is_owned = false;
48227         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
48228         return ret_conv;
48229 }
48230
48231 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
48232         LDKUnsignedChannelAnnouncement this_ptr_conv;
48233         this_ptr_conv.inner = untag_ptr(this_ptr);
48234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48236         this_ptr_conv.is_owned = false;
48237         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
48238 }
48239
48240 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
48241         LDKUnsignedChannelAnnouncement this_ptr_conv;
48242         this_ptr_conv.inner = untag_ptr(this_ptr);
48243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48245         this_ptr_conv.is_owned = false;
48246         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
48247         uint64_t ret_ref = 0;
48248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48250         return ret_ref;
48251 }
48252
48253 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, uint64_t val) {
48254         LDKUnsignedChannelAnnouncement this_ptr_conv;
48255         this_ptr_conv.inner = untag_ptr(this_ptr);
48256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48258         this_ptr_conv.is_owned = false;
48259         LDKNodeId val_conv;
48260         val_conv.inner = untag_ptr(val);
48261         val_conv.is_owned = ptr_is_owned(val);
48262         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48263         val_conv = NodeId_clone(&val_conv);
48264         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
48265 }
48266
48267 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
48268         LDKUnsignedChannelAnnouncement this_ptr_conv;
48269         this_ptr_conv.inner = untag_ptr(this_ptr);
48270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48272         this_ptr_conv.is_owned = false;
48273         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
48274         uint64_t ret_ref = 0;
48275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48277         return ret_ref;
48278 }
48279
48280 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, uint64_t val) {
48281         LDKUnsignedChannelAnnouncement this_ptr_conv;
48282         this_ptr_conv.inner = untag_ptr(this_ptr);
48283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48285         this_ptr_conv.is_owned = false;
48286         LDKNodeId val_conv;
48287         val_conv.inner = untag_ptr(val);
48288         val_conv.is_owned = ptr_is_owned(val);
48289         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48290         val_conv = NodeId_clone(&val_conv);
48291         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
48292 }
48293
48294 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
48295         LDKUnsignedChannelAnnouncement this_ptr_conv;
48296         this_ptr_conv.inner = untag_ptr(this_ptr);
48297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48299         this_ptr_conv.is_owned = false;
48300         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
48301         uint64_t ret_ref = 0;
48302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48304         return ret_ref;
48305 }
48306
48307 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, uint64_t val) {
48308         LDKUnsignedChannelAnnouncement this_ptr_conv;
48309         this_ptr_conv.inner = untag_ptr(this_ptr);
48310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48312         this_ptr_conv.is_owned = false;
48313         LDKNodeId val_conv;
48314         val_conv.inner = untag_ptr(val);
48315         val_conv.is_owned = ptr_is_owned(val);
48316         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48317         val_conv = NodeId_clone(&val_conv);
48318         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
48319 }
48320
48321 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
48322         LDKUnsignedChannelAnnouncement this_ptr_conv;
48323         this_ptr_conv.inner = untag_ptr(this_ptr);
48324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48326         this_ptr_conv.is_owned = false;
48327         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
48328         uint64_t ret_ref = 0;
48329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48331         return ret_ref;
48332 }
48333
48334 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, uint64_t val) {
48335         LDKUnsignedChannelAnnouncement this_ptr_conv;
48336         this_ptr_conv.inner = untag_ptr(this_ptr);
48337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48339         this_ptr_conv.is_owned = false;
48340         LDKNodeId val_conv;
48341         val_conv.inner = untag_ptr(val);
48342         val_conv.is_owned = ptr_is_owned(val);
48343         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48344         val_conv = NodeId_clone(&val_conv);
48345         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
48346 }
48347
48348 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_excess_data"))) TS_UnsignedChannelAnnouncement_get_excess_data(uint64_t this_ptr) {
48349         LDKUnsignedChannelAnnouncement this_ptr_conv;
48350         this_ptr_conv.inner = untag_ptr(this_ptr);
48351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48353         this_ptr_conv.is_owned = false;
48354         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
48355         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48356         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48357         CVec_u8Z_free(ret_var);
48358         return ret_arr;
48359 }
48360
48361 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_excess_data"))) TS_UnsignedChannelAnnouncement_set_excess_data(uint64_t this_ptr, int8_tArray val) {
48362         LDKUnsignedChannelAnnouncement this_ptr_conv;
48363         this_ptr_conv.inner = untag_ptr(this_ptr);
48364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48366         this_ptr_conv.is_owned = false;
48367         LDKCVec_u8Z val_ref;
48368         val_ref.datalen = val->arr_len;
48369         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
48370         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
48371         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
48372 }
48373
48374 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_new"))) TS_UnsignedChannelAnnouncement_new(uint64_t features_arg, int8_tArray chain_hash_arg, int64_t short_channel_id_arg, uint64_t node_id_1_arg, uint64_t node_id_2_arg, uint64_t bitcoin_key_1_arg, uint64_t bitcoin_key_2_arg, int8_tArray excess_data_arg) {
48375         LDKChannelFeatures features_arg_conv;
48376         features_arg_conv.inner = untag_ptr(features_arg);
48377         features_arg_conv.is_owned = ptr_is_owned(features_arg);
48378         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
48379         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
48380         LDKThirtyTwoBytes chain_hash_arg_ref;
48381         CHECK(chain_hash_arg->arr_len == 32);
48382         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
48383         LDKNodeId node_id_1_arg_conv;
48384         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
48385         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
48386         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
48387         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
48388         LDKNodeId node_id_2_arg_conv;
48389         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
48390         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
48391         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
48392         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
48393         LDKNodeId bitcoin_key_1_arg_conv;
48394         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
48395         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
48396         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
48397         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
48398         LDKNodeId bitcoin_key_2_arg_conv;
48399         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
48400         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
48401         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
48402         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
48403         LDKCVec_u8Z excess_data_arg_ref;
48404         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
48405         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
48406         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
48407         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_new(features_arg_conv, chain_hash_arg_ref, short_channel_id_arg, node_id_1_arg_conv, node_id_2_arg_conv, bitcoin_key_1_arg_conv, bitcoin_key_2_arg_conv, excess_data_arg_ref);
48408         uint64_t ret_ref = 0;
48409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48411         return ret_ref;
48412 }
48413
48414 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
48415         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
48416         uint64_t ret_ref = 0;
48417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48419         return ret_ref;
48420 }
48421 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
48422         LDKUnsignedChannelAnnouncement arg_conv;
48423         arg_conv.inner = untag_ptr(arg);
48424         arg_conv.is_owned = ptr_is_owned(arg);
48425         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48426         arg_conv.is_owned = false;
48427         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
48428         return ret_conv;
48429 }
48430
48431 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
48432         LDKUnsignedChannelAnnouncement orig_conv;
48433         orig_conv.inner = untag_ptr(orig);
48434         orig_conv.is_owned = ptr_is_owned(orig);
48435         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48436         orig_conv.is_owned = false;
48437         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
48438         uint64_t ret_ref = 0;
48439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48441         return ret_ref;
48442 }
48443
48444 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_hash"))) TS_UnsignedChannelAnnouncement_hash(uint64_t o) {
48445         LDKUnsignedChannelAnnouncement o_conv;
48446         o_conv.inner = untag_ptr(o);
48447         o_conv.is_owned = ptr_is_owned(o);
48448         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48449         o_conv.is_owned = false;
48450         int64_t ret_conv = UnsignedChannelAnnouncement_hash(&o_conv);
48451         return ret_conv;
48452 }
48453
48454 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
48455         LDKUnsignedChannelAnnouncement a_conv;
48456         a_conv.inner = untag_ptr(a);
48457         a_conv.is_owned = ptr_is_owned(a);
48458         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48459         a_conv.is_owned = false;
48460         LDKUnsignedChannelAnnouncement b_conv;
48461         b_conv.inner = untag_ptr(b);
48462         b_conv.is_owned = ptr_is_owned(b);
48463         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48464         b_conv.is_owned = false;
48465         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
48466         return ret_conv;
48467 }
48468
48469 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
48470         LDKChannelAnnouncement this_obj_conv;
48471         this_obj_conv.inner = untag_ptr(this_obj);
48472         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48474         ChannelAnnouncement_free(this_obj_conv);
48475 }
48476
48477 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
48478         LDKChannelAnnouncement this_ptr_conv;
48479         this_ptr_conv.inner = untag_ptr(this_ptr);
48480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48482         this_ptr_conv.is_owned = false;
48483         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48484         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
48485         return ret_arr;
48486 }
48487
48488 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
48489         LDKChannelAnnouncement this_ptr_conv;
48490         this_ptr_conv.inner = untag_ptr(this_ptr);
48491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48493         this_ptr_conv.is_owned = false;
48494         LDKECDSASignature val_ref;
48495         CHECK(val->arr_len == 64);
48496         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48497         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
48498 }
48499
48500 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
48501         LDKChannelAnnouncement this_ptr_conv;
48502         this_ptr_conv.inner = untag_ptr(this_ptr);
48503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48505         this_ptr_conv.is_owned = false;
48506         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48507         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
48508         return ret_arr;
48509 }
48510
48511 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
48512         LDKChannelAnnouncement this_ptr_conv;
48513         this_ptr_conv.inner = untag_ptr(this_ptr);
48514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48516         this_ptr_conv.is_owned = false;
48517         LDKECDSASignature val_ref;
48518         CHECK(val->arr_len == 64);
48519         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48520         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
48521 }
48522
48523 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
48524         LDKChannelAnnouncement this_ptr_conv;
48525         this_ptr_conv.inner = untag_ptr(this_ptr);
48526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48528         this_ptr_conv.is_owned = false;
48529         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48530         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
48531         return ret_arr;
48532 }
48533
48534 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
48535         LDKChannelAnnouncement this_ptr_conv;
48536         this_ptr_conv.inner = untag_ptr(this_ptr);
48537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48539         this_ptr_conv.is_owned = false;
48540         LDKECDSASignature val_ref;
48541         CHECK(val->arr_len == 64);
48542         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48543         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
48544 }
48545
48546 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
48547         LDKChannelAnnouncement this_ptr_conv;
48548         this_ptr_conv.inner = untag_ptr(this_ptr);
48549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48551         this_ptr_conv.is_owned = false;
48552         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48553         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
48554         return ret_arr;
48555 }
48556
48557 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
48558         LDKChannelAnnouncement this_ptr_conv;
48559         this_ptr_conv.inner = untag_ptr(this_ptr);
48560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48562         this_ptr_conv.is_owned = false;
48563         LDKECDSASignature val_ref;
48564         CHECK(val->arr_len == 64);
48565         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48566         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
48567 }
48568
48569 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
48570         LDKChannelAnnouncement this_ptr_conv;
48571         this_ptr_conv.inner = untag_ptr(this_ptr);
48572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48574         this_ptr_conv.is_owned = false;
48575         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
48576         uint64_t ret_ref = 0;
48577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48579         return ret_ref;
48580 }
48581
48582 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
48583         LDKChannelAnnouncement this_ptr_conv;
48584         this_ptr_conv.inner = untag_ptr(this_ptr);
48585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48587         this_ptr_conv.is_owned = false;
48588         LDKUnsignedChannelAnnouncement val_conv;
48589         val_conv.inner = untag_ptr(val);
48590         val_conv.is_owned = ptr_is_owned(val);
48591         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48592         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
48593         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
48594 }
48595
48596 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) {
48597         LDKECDSASignature node_signature_1_arg_ref;
48598         CHECK(node_signature_1_arg->arr_len == 64);
48599         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
48600         LDKECDSASignature node_signature_2_arg_ref;
48601         CHECK(node_signature_2_arg->arr_len == 64);
48602         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
48603         LDKECDSASignature bitcoin_signature_1_arg_ref;
48604         CHECK(bitcoin_signature_1_arg->arr_len == 64);
48605         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
48606         LDKECDSASignature bitcoin_signature_2_arg_ref;
48607         CHECK(bitcoin_signature_2_arg->arr_len == 64);
48608         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
48609         LDKUnsignedChannelAnnouncement contents_arg_conv;
48610         contents_arg_conv.inner = untag_ptr(contents_arg);
48611         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
48612         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
48613         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
48614         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);
48615         uint64_t ret_ref = 0;
48616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48618         return ret_ref;
48619 }
48620
48621 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
48622         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
48623         uint64_t ret_ref = 0;
48624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48626         return ret_ref;
48627 }
48628 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
48629         LDKChannelAnnouncement arg_conv;
48630         arg_conv.inner = untag_ptr(arg);
48631         arg_conv.is_owned = ptr_is_owned(arg);
48632         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48633         arg_conv.is_owned = false;
48634         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
48635         return ret_conv;
48636 }
48637
48638 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
48639         LDKChannelAnnouncement orig_conv;
48640         orig_conv.inner = untag_ptr(orig);
48641         orig_conv.is_owned = ptr_is_owned(orig);
48642         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48643         orig_conv.is_owned = false;
48644         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
48645         uint64_t ret_ref = 0;
48646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48648         return ret_ref;
48649 }
48650
48651 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_hash"))) TS_ChannelAnnouncement_hash(uint64_t o) {
48652         LDKChannelAnnouncement o_conv;
48653         o_conv.inner = untag_ptr(o);
48654         o_conv.is_owned = ptr_is_owned(o);
48655         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48656         o_conv.is_owned = false;
48657         int64_t ret_conv = ChannelAnnouncement_hash(&o_conv);
48658         return ret_conv;
48659 }
48660
48661 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
48662         LDKChannelAnnouncement a_conv;
48663         a_conv.inner = untag_ptr(a);
48664         a_conv.is_owned = ptr_is_owned(a);
48665         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48666         a_conv.is_owned = false;
48667         LDKChannelAnnouncement b_conv;
48668         b_conv.inner = untag_ptr(b);
48669         b_conv.is_owned = ptr_is_owned(b);
48670         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48671         b_conv.is_owned = false;
48672         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
48673         return ret_conv;
48674 }
48675
48676 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
48677         LDKUnsignedChannelUpdate this_obj_conv;
48678         this_obj_conv.inner = untag_ptr(this_obj);
48679         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48681         UnsignedChannelUpdate_free(this_obj_conv);
48682 }
48683
48684 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
48685         LDKUnsignedChannelUpdate this_ptr_conv;
48686         this_ptr_conv.inner = untag_ptr(this_ptr);
48687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48689         this_ptr_conv.is_owned = false;
48690         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48691         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
48692         return ret_arr;
48693 }
48694
48695 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
48696         LDKUnsignedChannelUpdate this_ptr_conv;
48697         this_ptr_conv.inner = untag_ptr(this_ptr);
48698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48700         this_ptr_conv.is_owned = false;
48701         LDKThirtyTwoBytes val_ref;
48702         CHECK(val->arr_len == 32);
48703         memcpy(val_ref.data, val->elems, 32); FREE(val);
48704         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
48705 }
48706
48707 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
48708         LDKUnsignedChannelUpdate this_ptr_conv;
48709         this_ptr_conv.inner = untag_ptr(this_ptr);
48710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48712         this_ptr_conv.is_owned = false;
48713         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
48714         return ret_conv;
48715 }
48716
48717 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
48718         LDKUnsignedChannelUpdate this_ptr_conv;
48719         this_ptr_conv.inner = untag_ptr(this_ptr);
48720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48722         this_ptr_conv.is_owned = false;
48723         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
48724 }
48725
48726 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
48727         LDKUnsignedChannelUpdate this_ptr_conv;
48728         this_ptr_conv.inner = untag_ptr(this_ptr);
48729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48731         this_ptr_conv.is_owned = false;
48732         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
48733         return ret_conv;
48734 }
48735
48736 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
48737         LDKUnsignedChannelUpdate this_ptr_conv;
48738         this_ptr_conv.inner = untag_ptr(this_ptr);
48739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48741         this_ptr_conv.is_owned = false;
48742         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
48743 }
48744
48745 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
48746         LDKUnsignedChannelUpdate this_ptr_conv;
48747         this_ptr_conv.inner = untag_ptr(this_ptr);
48748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48750         this_ptr_conv.is_owned = false;
48751         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
48752         return ret_conv;
48753 }
48754
48755 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
48756         LDKUnsignedChannelUpdate this_ptr_conv;
48757         this_ptr_conv.inner = untag_ptr(this_ptr);
48758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48760         this_ptr_conv.is_owned = false;
48761         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
48762 }
48763
48764 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
48765         LDKUnsignedChannelUpdate this_ptr_conv;
48766         this_ptr_conv.inner = untag_ptr(this_ptr);
48767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48769         this_ptr_conv.is_owned = false;
48770         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
48771         return ret_conv;
48772 }
48773
48774 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
48775         LDKUnsignedChannelUpdate this_ptr_conv;
48776         this_ptr_conv.inner = untag_ptr(this_ptr);
48777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48779         this_ptr_conv.is_owned = false;
48780         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
48781 }
48782
48783 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
48784         LDKUnsignedChannelUpdate this_ptr_conv;
48785         this_ptr_conv.inner = untag_ptr(this_ptr);
48786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48788         this_ptr_conv.is_owned = false;
48789         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
48790         return ret_conv;
48791 }
48792
48793 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
48794         LDKUnsignedChannelUpdate this_ptr_conv;
48795         this_ptr_conv.inner = untag_ptr(this_ptr);
48796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48798         this_ptr_conv.is_owned = false;
48799         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
48800 }
48801
48802 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
48803         LDKUnsignedChannelUpdate this_ptr_conv;
48804         this_ptr_conv.inner = untag_ptr(this_ptr);
48805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48807         this_ptr_conv.is_owned = false;
48808         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
48809         return ret_conv;
48810 }
48811
48812 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
48813         LDKUnsignedChannelUpdate this_ptr_conv;
48814         this_ptr_conv.inner = untag_ptr(this_ptr);
48815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48817         this_ptr_conv.is_owned = false;
48818         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
48819 }
48820
48821 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
48822         LDKUnsignedChannelUpdate this_ptr_conv;
48823         this_ptr_conv.inner = untag_ptr(this_ptr);
48824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48826         this_ptr_conv.is_owned = false;
48827         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
48828         return ret_conv;
48829 }
48830
48831 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
48832         LDKUnsignedChannelUpdate this_ptr_conv;
48833         this_ptr_conv.inner = untag_ptr(this_ptr);
48834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48836         this_ptr_conv.is_owned = false;
48837         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
48838 }
48839
48840 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
48841         LDKUnsignedChannelUpdate this_ptr_conv;
48842         this_ptr_conv.inner = untag_ptr(this_ptr);
48843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48845         this_ptr_conv.is_owned = false;
48846         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
48847         return ret_conv;
48848 }
48849
48850 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
48851         LDKUnsignedChannelUpdate this_ptr_conv;
48852         this_ptr_conv.inner = untag_ptr(this_ptr);
48853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48855         this_ptr_conv.is_owned = false;
48856         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
48857 }
48858
48859 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
48860         LDKUnsignedChannelUpdate this_ptr_conv;
48861         this_ptr_conv.inner = untag_ptr(this_ptr);
48862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48864         this_ptr_conv.is_owned = false;
48865         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
48866         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48867         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48868         CVec_u8Z_free(ret_var);
48869         return ret_arr;
48870 }
48871
48872 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
48873         LDKUnsignedChannelUpdate this_ptr_conv;
48874         this_ptr_conv.inner = untag_ptr(this_ptr);
48875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48877         this_ptr_conv.is_owned = false;
48878         LDKCVec_u8Z val_ref;
48879         val_ref.datalen = val->arr_len;
48880         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
48881         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
48882         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
48883 }
48884
48885 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) {
48886         LDKThirtyTwoBytes chain_hash_arg_ref;
48887         CHECK(chain_hash_arg->arr_len == 32);
48888         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
48889         LDKCVec_u8Z excess_data_arg_ref;
48890         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
48891         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
48892         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
48893         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);
48894         uint64_t ret_ref = 0;
48895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48897         return ret_ref;
48898 }
48899
48900 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
48901         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
48902         uint64_t ret_ref = 0;
48903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48905         return ret_ref;
48906 }
48907 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
48908         LDKUnsignedChannelUpdate arg_conv;
48909         arg_conv.inner = untag_ptr(arg);
48910         arg_conv.is_owned = ptr_is_owned(arg);
48911         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48912         arg_conv.is_owned = false;
48913         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
48914         return ret_conv;
48915 }
48916
48917 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
48918         LDKUnsignedChannelUpdate orig_conv;
48919         orig_conv.inner = untag_ptr(orig);
48920         orig_conv.is_owned = ptr_is_owned(orig);
48921         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48922         orig_conv.is_owned = false;
48923         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
48924         uint64_t ret_ref = 0;
48925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48927         return ret_ref;
48928 }
48929
48930 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_hash"))) TS_UnsignedChannelUpdate_hash(uint64_t o) {
48931         LDKUnsignedChannelUpdate o_conv;
48932         o_conv.inner = untag_ptr(o);
48933         o_conv.is_owned = ptr_is_owned(o);
48934         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48935         o_conv.is_owned = false;
48936         int64_t ret_conv = UnsignedChannelUpdate_hash(&o_conv);
48937         return ret_conv;
48938 }
48939
48940 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
48941         LDKUnsignedChannelUpdate a_conv;
48942         a_conv.inner = untag_ptr(a);
48943         a_conv.is_owned = ptr_is_owned(a);
48944         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48945         a_conv.is_owned = false;
48946         LDKUnsignedChannelUpdate b_conv;
48947         b_conv.inner = untag_ptr(b);
48948         b_conv.is_owned = ptr_is_owned(b);
48949         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48950         b_conv.is_owned = false;
48951         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
48952         return ret_conv;
48953 }
48954
48955 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
48956         LDKChannelUpdate this_obj_conv;
48957         this_obj_conv.inner = untag_ptr(this_obj);
48958         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48960         ChannelUpdate_free(this_obj_conv);
48961 }
48962
48963 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
48964         LDKChannelUpdate this_ptr_conv;
48965         this_ptr_conv.inner = untag_ptr(this_ptr);
48966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48968         this_ptr_conv.is_owned = false;
48969         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48970         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
48971         return ret_arr;
48972 }
48973
48974 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
48975         LDKChannelUpdate this_ptr_conv;
48976         this_ptr_conv.inner = untag_ptr(this_ptr);
48977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48979         this_ptr_conv.is_owned = false;
48980         LDKECDSASignature val_ref;
48981         CHECK(val->arr_len == 64);
48982         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48983         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
48984 }
48985
48986 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
48987         LDKChannelUpdate this_ptr_conv;
48988         this_ptr_conv.inner = untag_ptr(this_ptr);
48989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48991         this_ptr_conv.is_owned = false;
48992         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
48993         uint64_t ret_ref = 0;
48994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48996         return ret_ref;
48997 }
48998
48999 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
49000         LDKChannelUpdate this_ptr_conv;
49001         this_ptr_conv.inner = untag_ptr(this_ptr);
49002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49004         this_ptr_conv.is_owned = false;
49005         LDKUnsignedChannelUpdate val_conv;
49006         val_conv.inner = untag_ptr(val);
49007         val_conv.is_owned = ptr_is_owned(val);
49008         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49009         val_conv = UnsignedChannelUpdate_clone(&val_conv);
49010         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
49011 }
49012
49013 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
49014         LDKECDSASignature signature_arg_ref;
49015         CHECK(signature_arg->arr_len == 64);
49016         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
49017         LDKUnsignedChannelUpdate contents_arg_conv;
49018         contents_arg_conv.inner = untag_ptr(contents_arg);
49019         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
49020         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
49021         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
49022         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
49023         uint64_t ret_ref = 0;
49024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49026         return ret_ref;
49027 }
49028
49029 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
49030         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
49031         uint64_t ret_ref = 0;
49032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49034         return ret_ref;
49035 }
49036 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
49037         LDKChannelUpdate arg_conv;
49038         arg_conv.inner = untag_ptr(arg);
49039         arg_conv.is_owned = ptr_is_owned(arg);
49040         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49041         arg_conv.is_owned = false;
49042         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
49043         return ret_conv;
49044 }
49045
49046 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
49047         LDKChannelUpdate orig_conv;
49048         orig_conv.inner = untag_ptr(orig);
49049         orig_conv.is_owned = ptr_is_owned(orig);
49050         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49051         orig_conv.is_owned = false;
49052         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
49053         uint64_t ret_ref = 0;
49054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49056         return ret_ref;
49057 }
49058
49059 int64_t  __attribute__((export_name("TS_ChannelUpdate_hash"))) TS_ChannelUpdate_hash(uint64_t o) {
49060         LDKChannelUpdate o_conv;
49061         o_conv.inner = untag_ptr(o);
49062         o_conv.is_owned = ptr_is_owned(o);
49063         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49064         o_conv.is_owned = false;
49065         int64_t ret_conv = ChannelUpdate_hash(&o_conv);
49066         return ret_conv;
49067 }
49068
49069 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
49070         LDKChannelUpdate a_conv;
49071         a_conv.inner = untag_ptr(a);
49072         a_conv.is_owned = ptr_is_owned(a);
49073         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49074         a_conv.is_owned = false;
49075         LDKChannelUpdate b_conv;
49076         b_conv.inner = untag_ptr(b);
49077         b_conv.is_owned = ptr_is_owned(b);
49078         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49079         b_conv.is_owned = false;
49080         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
49081         return ret_conv;
49082 }
49083
49084 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
49085         LDKQueryChannelRange this_obj_conv;
49086         this_obj_conv.inner = untag_ptr(this_obj);
49087         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49089         QueryChannelRange_free(this_obj_conv);
49090 }
49091
49092 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
49093         LDKQueryChannelRange this_ptr_conv;
49094         this_ptr_conv.inner = untag_ptr(this_ptr);
49095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49097         this_ptr_conv.is_owned = false;
49098         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49099         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
49100         return ret_arr;
49101 }
49102
49103 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
49104         LDKQueryChannelRange this_ptr_conv;
49105         this_ptr_conv.inner = untag_ptr(this_ptr);
49106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49108         this_ptr_conv.is_owned = false;
49109         LDKThirtyTwoBytes val_ref;
49110         CHECK(val->arr_len == 32);
49111         memcpy(val_ref.data, val->elems, 32); FREE(val);
49112         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
49113 }
49114
49115 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
49116         LDKQueryChannelRange this_ptr_conv;
49117         this_ptr_conv.inner = untag_ptr(this_ptr);
49118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49120         this_ptr_conv.is_owned = false;
49121         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
49122         return ret_conv;
49123 }
49124
49125 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
49126         LDKQueryChannelRange this_ptr_conv;
49127         this_ptr_conv.inner = untag_ptr(this_ptr);
49128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49130         this_ptr_conv.is_owned = false;
49131         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
49132 }
49133
49134 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
49135         LDKQueryChannelRange this_ptr_conv;
49136         this_ptr_conv.inner = untag_ptr(this_ptr);
49137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49139         this_ptr_conv.is_owned = false;
49140         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
49141         return ret_conv;
49142 }
49143
49144 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
49145         LDKQueryChannelRange this_ptr_conv;
49146         this_ptr_conv.inner = untag_ptr(this_ptr);
49147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49149         this_ptr_conv.is_owned = false;
49150         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
49151 }
49152
49153 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) {
49154         LDKThirtyTwoBytes chain_hash_arg_ref;
49155         CHECK(chain_hash_arg->arr_len == 32);
49156         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49157         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
49158         uint64_t ret_ref = 0;
49159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49161         return ret_ref;
49162 }
49163
49164 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
49165         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
49166         uint64_t ret_ref = 0;
49167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49169         return ret_ref;
49170 }
49171 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
49172         LDKQueryChannelRange arg_conv;
49173         arg_conv.inner = untag_ptr(arg);
49174         arg_conv.is_owned = ptr_is_owned(arg);
49175         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49176         arg_conv.is_owned = false;
49177         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
49178         return ret_conv;
49179 }
49180
49181 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
49182         LDKQueryChannelRange orig_conv;
49183         orig_conv.inner = untag_ptr(orig);
49184         orig_conv.is_owned = ptr_is_owned(orig);
49185         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49186         orig_conv.is_owned = false;
49187         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
49188         uint64_t ret_ref = 0;
49189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49191         return ret_ref;
49192 }
49193
49194 int64_t  __attribute__((export_name("TS_QueryChannelRange_hash"))) TS_QueryChannelRange_hash(uint64_t o) {
49195         LDKQueryChannelRange o_conv;
49196         o_conv.inner = untag_ptr(o);
49197         o_conv.is_owned = ptr_is_owned(o);
49198         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49199         o_conv.is_owned = false;
49200         int64_t ret_conv = QueryChannelRange_hash(&o_conv);
49201         return ret_conv;
49202 }
49203
49204 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
49205         LDKQueryChannelRange a_conv;
49206         a_conv.inner = untag_ptr(a);
49207         a_conv.is_owned = ptr_is_owned(a);
49208         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49209         a_conv.is_owned = false;
49210         LDKQueryChannelRange b_conv;
49211         b_conv.inner = untag_ptr(b);
49212         b_conv.is_owned = ptr_is_owned(b);
49213         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49214         b_conv.is_owned = false;
49215         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
49216         return ret_conv;
49217 }
49218
49219 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
49220         LDKReplyChannelRange this_obj_conv;
49221         this_obj_conv.inner = untag_ptr(this_obj);
49222         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49224         ReplyChannelRange_free(this_obj_conv);
49225 }
49226
49227 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
49228         LDKReplyChannelRange this_ptr_conv;
49229         this_ptr_conv.inner = untag_ptr(this_ptr);
49230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49232         this_ptr_conv.is_owned = false;
49233         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49234         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
49235         return ret_arr;
49236 }
49237
49238 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
49239         LDKReplyChannelRange this_ptr_conv;
49240         this_ptr_conv.inner = untag_ptr(this_ptr);
49241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49243         this_ptr_conv.is_owned = false;
49244         LDKThirtyTwoBytes val_ref;
49245         CHECK(val->arr_len == 32);
49246         memcpy(val_ref.data, val->elems, 32); FREE(val);
49247         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
49248 }
49249
49250 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
49251         LDKReplyChannelRange this_ptr_conv;
49252         this_ptr_conv.inner = untag_ptr(this_ptr);
49253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49255         this_ptr_conv.is_owned = false;
49256         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
49257         return ret_conv;
49258 }
49259
49260 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
49261         LDKReplyChannelRange this_ptr_conv;
49262         this_ptr_conv.inner = untag_ptr(this_ptr);
49263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49265         this_ptr_conv.is_owned = false;
49266         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
49267 }
49268
49269 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
49270         LDKReplyChannelRange this_ptr_conv;
49271         this_ptr_conv.inner = untag_ptr(this_ptr);
49272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49274         this_ptr_conv.is_owned = false;
49275         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
49276         return ret_conv;
49277 }
49278
49279 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
49280         LDKReplyChannelRange this_ptr_conv;
49281         this_ptr_conv.inner = untag_ptr(this_ptr);
49282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49284         this_ptr_conv.is_owned = false;
49285         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
49286 }
49287
49288 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
49289         LDKReplyChannelRange this_ptr_conv;
49290         this_ptr_conv.inner = untag_ptr(this_ptr);
49291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49293         this_ptr_conv.is_owned = false;
49294         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
49295         return ret_conv;
49296 }
49297
49298 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
49299         LDKReplyChannelRange this_ptr_conv;
49300         this_ptr_conv.inner = untag_ptr(this_ptr);
49301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49303         this_ptr_conv.is_owned = false;
49304         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
49305 }
49306
49307 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
49308         LDKReplyChannelRange this_ptr_conv;
49309         this_ptr_conv.inner = untag_ptr(this_ptr);
49310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49312         this_ptr_conv.is_owned = false;
49313         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
49314         int64_tArray ret_arr = NULL;
49315         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
49316         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
49317         for (size_t i = 0; i < ret_var.datalen; i++) {
49318                 int64_t ret_conv_8_conv = ret_var.data[i];
49319                 ret_arr_ptr[i] = ret_conv_8_conv;
49320         }
49321         
49322         FREE(ret_var.data);
49323         return ret_arr;
49324 }
49325
49326 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
49327         LDKReplyChannelRange this_ptr_conv;
49328         this_ptr_conv.inner = untag_ptr(this_ptr);
49329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49331         this_ptr_conv.is_owned = false;
49332         LDKCVec_u64Z val_constr;
49333         val_constr.datalen = val->arr_len;
49334         if (val_constr.datalen > 0)
49335                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49336         else
49337                 val_constr.data = NULL;
49338         int64_t* val_vals = val->elems;
49339         for (size_t i = 0; i < val_constr.datalen; i++) {
49340                 int64_t val_conv_8 = val_vals[i];
49341                 val_constr.data[i] = val_conv_8;
49342         }
49343         FREE(val);
49344         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
49345 }
49346
49347 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) {
49348         LDKThirtyTwoBytes chain_hash_arg_ref;
49349         CHECK(chain_hash_arg->arr_len == 32);
49350         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49351         LDKCVec_u64Z short_channel_ids_arg_constr;
49352         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
49353         if (short_channel_ids_arg_constr.datalen > 0)
49354                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49355         else
49356                 short_channel_ids_arg_constr.data = NULL;
49357         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
49358         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
49359                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
49360                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
49361         }
49362         FREE(short_channel_ids_arg);
49363         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
49364         uint64_t ret_ref = 0;
49365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49367         return ret_ref;
49368 }
49369
49370 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
49371         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
49372         uint64_t ret_ref = 0;
49373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49375         return ret_ref;
49376 }
49377 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
49378         LDKReplyChannelRange arg_conv;
49379         arg_conv.inner = untag_ptr(arg);
49380         arg_conv.is_owned = ptr_is_owned(arg);
49381         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49382         arg_conv.is_owned = false;
49383         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
49384         return ret_conv;
49385 }
49386
49387 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
49388         LDKReplyChannelRange orig_conv;
49389         orig_conv.inner = untag_ptr(orig);
49390         orig_conv.is_owned = ptr_is_owned(orig);
49391         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49392         orig_conv.is_owned = false;
49393         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
49394         uint64_t ret_ref = 0;
49395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49397         return ret_ref;
49398 }
49399
49400 int64_t  __attribute__((export_name("TS_ReplyChannelRange_hash"))) TS_ReplyChannelRange_hash(uint64_t o) {
49401         LDKReplyChannelRange o_conv;
49402         o_conv.inner = untag_ptr(o);
49403         o_conv.is_owned = ptr_is_owned(o);
49404         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49405         o_conv.is_owned = false;
49406         int64_t ret_conv = ReplyChannelRange_hash(&o_conv);
49407         return ret_conv;
49408 }
49409
49410 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
49411         LDKReplyChannelRange a_conv;
49412         a_conv.inner = untag_ptr(a);
49413         a_conv.is_owned = ptr_is_owned(a);
49414         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49415         a_conv.is_owned = false;
49416         LDKReplyChannelRange b_conv;
49417         b_conv.inner = untag_ptr(b);
49418         b_conv.is_owned = ptr_is_owned(b);
49419         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49420         b_conv.is_owned = false;
49421         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
49422         return ret_conv;
49423 }
49424
49425 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
49426         LDKQueryShortChannelIds this_obj_conv;
49427         this_obj_conv.inner = untag_ptr(this_obj);
49428         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49430         QueryShortChannelIds_free(this_obj_conv);
49431 }
49432
49433 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
49434         LDKQueryShortChannelIds this_ptr_conv;
49435         this_ptr_conv.inner = untag_ptr(this_ptr);
49436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49438         this_ptr_conv.is_owned = false;
49439         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49440         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
49441         return ret_arr;
49442 }
49443
49444 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
49445         LDKQueryShortChannelIds this_ptr_conv;
49446         this_ptr_conv.inner = untag_ptr(this_ptr);
49447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49449         this_ptr_conv.is_owned = false;
49450         LDKThirtyTwoBytes val_ref;
49451         CHECK(val->arr_len == 32);
49452         memcpy(val_ref.data, val->elems, 32); FREE(val);
49453         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
49454 }
49455
49456 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
49457         LDKQueryShortChannelIds this_ptr_conv;
49458         this_ptr_conv.inner = untag_ptr(this_ptr);
49459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49461         this_ptr_conv.is_owned = false;
49462         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
49463         int64_tArray ret_arr = NULL;
49464         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
49465         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
49466         for (size_t i = 0; i < ret_var.datalen; i++) {
49467                 int64_t ret_conv_8_conv = ret_var.data[i];
49468                 ret_arr_ptr[i] = ret_conv_8_conv;
49469         }
49470         
49471         FREE(ret_var.data);
49472         return ret_arr;
49473 }
49474
49475 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
49476         LDKQueryShortChannelIds this_ptr_conv;
49477         this_ptr_conv.inner = untag_ptr(this_ptr);
49478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49480         this_ptr_conv.is_owned = false;
49481         LDKCVec_u64Z val_constr;
49482         val_constr.datalen = val->arr_len;
49483         if (val_constr.datalen > 0)
49484                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49485         else
49486                 val_constr.data = NULL;
49487         int64_t* val_vals = val->elems;
49488         for (size_t i = 0; i < val_constr.datalen; i++) {
49489                 int64_t val_conv_8 = val_vals[i];
49490                 val_constr.data[i] = val_conv_8;
49491         }
49492         FREE(val);
49493         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
49494 }
49495
49496 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
49497         LDKThirtyTwoBytes chain_hash_arg_ref;
49498         CHECK(chain_hash_arg->arr_len == 32);
49499         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49500         LDKCVec_u64Z short_channel_ids_arg_constr;
49501         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
49502         if (short_channel_ids_arg_constr.datalen > 0)
49503                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49504         else
49505                 short_channel_ids_arg_constr.data = NULL;
49506         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
49507         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
49508                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
49509                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
49510         }
49511         FREE(short_channel_ids_arg);
49512         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
49513         uint64_t ret_ref = 0;
49514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49516         return ret_ref;
49517 }
49518
49519 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
49520         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
49521         uint64_t ret_ref = 0;
49522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49524         return ret_ref;
49525 }
49526 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
49527         LDKQueryShortChannelIds arg_conv;
49528         arg_conv.inner = untag_ptr(arg);
49529         arg_conv.is_owned = ptr_is_owned(arg);
49530         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49531         arg_conv.is_owned = false;
49532         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
49533         return ret_conv;
49534 }
49535
49536 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
49537         LDKQueryShortChannelIds orig_conv;
49538         orig_conv.inner = untag_ptr(orig);
49539         orig_conv.is_owned = ptr_is_owned(orig);
49540         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49541         orig_conv.is_owned = false;
49542         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
49543         uint64_t ret_ref = 0;
49544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49546         return ret_ref;
49547 }
49548
49549 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_hash"))) TS_QueryShortChannelIds_hash(uint64_t o) {
49550         LDKQueryShortChannelIds o_conv;
49551         o_conv.inner = untag_ptr(o);
49552         o_conv.is_owned = ptr_is_owned(o);
49553         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49554         o_conv.is_owned = false;
49555         int64_t ret_conv = QueryShortChannelIds_hash(&o_conv);
49556         return ret_conv;
49557 }
49558
49559 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
49560         LDKQueryShortChannelIds a_conv;
49561         a_conv.inner = untag_ptr(a);
49562         a_conv.is_owned = ptr_is_owned(a);
49563         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49564         a_conv.is_owned = false;
49565         LDKQueryShortChannelIds b_conv;
49566         b_conv.inner = untag_ptr(b);
49567         b_conv.is_owned = ptr_is_owned(b);
49568         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49569         b_conv.is_owned = false;
49570         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
49571         return ret_conv;
49572 }
49573
49574 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
49575         LDKReplyShortChannelIdsEnd this_obj_conv;
49576         this_obj_conv.inner = untag_ptr(this_obj);
49577         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49579         ReplyShortChannelIdsEnd_free(this_obj_conv);
49580 }
49581
49582 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
49583         LDKReplyShortChannelIdsEnd this_ptr_conv;
49584         this_ptr_conv.inner = untag_ptr(this_ptr);
49585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49587         this_ptr_conv.is_owned = false;
49588         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49589         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
49590         return ret_arr;
49591 }
49592
49593 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
49594         LDKReplyShortChannelIdsEnd this_ptr_conv;
49595         this_ptr_conv.inner = untag_ptr(this_ptr);
49596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49598         this_ptr_conv.is_owned = false;
49599         LDKThirtyTwoBytes val_ref;
49600         CHECK(val->arr_len == 32);
49601         memcpy(val_ref.data, val->elems, 32); FREE(val);
49602         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
49603 }
49604
49605 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
49606         LDKReplyShortChannelIdsEnd this_ptr_conv;
49607         this_ptr_conv.inner = untag_ptr(this_ptr);
49608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49610         this_ptr_conv.is_owned = false;
49611         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
49612         return ret_conv;
49613 }
49614
49615 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
49616         LDKReplyShortChannelIdsEnd this_ptr_conv;
49617         this_ptr_conv.inner = untag_ptr(this_ptr);
49618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49620         this_ptr_conv.is_owned = false;
49621         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
49622 }
49623
49624 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
49625         LDKThirtyTwoBytes chain_hash_arg_ref;
49626         CHECK(chain_hash_arg->arr_len == 32);
49627         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49628         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
49629         uint64_t ret_ref = 0;
49630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49632         return ret_ref;
49633 }
49634
49635 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
49636         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
49637         uint64_t ret_ref = 0;
49638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49640         return ret_ref;
49641 }
49642 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
49643         LDKReplyShortChannelIdsEnd arg_conv;
49644         arg_conv.inner = untag_ptr(arg);
49645         arg_conv.is_owned = ptr_is_owned(arg);
49646         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49647         arg_conv.is_owned = false;
49648         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
49649         return ret_conv;
49650 }
49651
49652 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
49653         LDKReplyShortChannelIdsEnd orig_conv;
49654         orig_conv.inner = untag_ptr(orig);
49655         orig_conv.is_owned = ptr_is_owned(orig);
49656         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49657         orig_conv.is_owned = false;
49658         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
49659         uint64_t ret_ref = 0;
49660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49662         return ret_ref;
49663 }
49664
49665 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_hash"))) TS_ReplyShortChannelIdsEnd_hash(uint64_t o) {
49666         LDKReplyShortChannelIdsEnd o_conv;
49667         o_conv.inner = untag_ptr(o);
49668         o_conv.is_owned = ptr_is_owned(o);
49669         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49670         o_conv.is_owned = false;
49671         int64_t ret_conv = ReplyShortChannelIdsEnd_hash(&o_conv);
49672         return ret_conv;
49673 }
49674
49675 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
49676         LDKReplyShortChannelIdsEnd a_conv;
49677         a_conv.inner = untag_ptr(a);
49678         a_conv.is_owned = ptr_is_owned(a);
49679         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49680         a_conv.is_owned = false;
49681         LDKReplyShortChannelIdsEnd b_conv;
49682         b_conv.inner = untag_ptr(b);
49683         b_conv.is_owned = ptr_is_owned(b);
49684         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49685         b_conv.is_owned = false;
49686         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
49687         return ret_conv;
49688 }
49689
49690 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
49691         LDKGossipTimestampFilter this_obj_conv;
49692         this_obj_conv.inner = untag_ptr(this_obj);
49693         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49695         GossipTimestampFilter_free(this_obj_conv);
49696 }
49697
49698 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
49699         LDKGossipTimestampFilter this_ptr_conv;
49700         this_ptr_conv.inner = untag_ptr(this_ptr);
49701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49703         this_ptr_conv.is_owned = false;
49704         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49705         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
49706         return ret_arr;
49707 }
49708
49709 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
49710         LDKGossipTimestampFilter this_ptr_conv;
49711         this_ptr_conv.inner = untag_ptr(this_ptr);
49712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49714         this_ptr_conv.is_owned = false;
49715         LDKThirtyTwoBytes val_ref;
49716         CHECK(val->arr_len == 32);
49717         memcpy(val_ref.data, val->elems, 32); FREE(val);
49718         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
49719 }
49720
49721 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
49722         LDKGossipTimestampFilter this_ptr_conv;
49723         this_ptr_conv.inner = untag_ptr(this_ptr);
49724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49726         this_ptr_conv.is_owned = false;
49727         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
49728         return ret_conv;
49729 }
49730
49731 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
49732         LDKGossipTimestampFilter this_ptr_conv;
49733         this_ptr_conv.inner = untag_ptr(this_ptr);
49734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49736         this_ptr_conv.is_owned = false;
49737         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
49738 }
49739
49740 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
49741         LDKGossipTimestampFilter this_ptr_conv;
49742         this_ptr_conv.inner = untag_ptr(this_ptr);
49743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49745         this_ptr_conv.is_owned = false;
49746         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
49747         return ret_conv;
49748 }
49749
49750 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
49751         LDKGossipTimestampFilter this_ptr_conv;
49752         this_ptr_conv.inner = untag_ptr(this_ptr);
49753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49755         this_ptr_conv.is_owned = false;
49756         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
49757 }
49758
49759 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) {
49760         LDKThirtyTwoBytes chain_hash_arg_ref;
49761         CHECK(chain_hash_arg->arr_len == 32);
49762         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49763         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
49764         uint64_t ret_ref = 0;
49765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49767         return ret_ref;
49768 }
49769
49770 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
49771         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
49772         uint64_t ret_ref = 0;
49773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49775         return ret_ref;
49776 }
49777 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
49778         LDKGossipTimestampFilter arg_conv;
49779         arg_conv.inner = untag_ptr(arg);
49780         arg_conv.is_owned = ptr_is_owned(arg);
49781         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49782         arg_conv.is_owned = false;
49783         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
49784         return ret_conv;
49785 }
49786
49787 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
49788         LDKGossipTimestampFilter orig_conv;
49789         orig_conv.inner = untag_ptr(orig);
49790         orig_conv.is_owned = ptr_is_owned(orig);
49791         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49792         orig_conv.is_owned = false;
49793         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
49794         uint64_t ret_ref = 0;
49795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49797         return ret_ref;
49798 }
49799
49800 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_hash"))) TS_GossipTimestampFilter_hash(uint64_t o) {
49801         LDKGossipTimestampFilter o_conv;
49802         o_conv.inner = untag_ptr(o);
49803         o_conv.is_owned = ptr_is_owned(o);
49804         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49805         o_conv.is_owned = false;
49806         int64_t ret_conv = GossipTimestampFilter_hash(&o_conv);
49807         return ret_conv;
49808 }
49809
49810 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
49811         LDKGossipTimestampFilter a_conv;
49812         a_conv.inner = untag_ptr(a);
49813         a_conv.is_owned = ptr_is_owned(a);
49814         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49815         a_conv.is_owned = false;
49816         LDKGossipTimestampFilter b_conv;
49817         b_conv.inner = untag_ptr(b);
49818         b_conv.is_owned = ptr_is_owned(b);
49819         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49820         b_conv.is_owned = false;
49821         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
49822         return ret_conv;
49823 }
49824
49825 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
49826         if (!ptr_is_owned(this_ptr)) return;
49827         void* this_ptr_ptr = untag_ptr(this_ptr);
49828         CHECK_ACCESS(this_ptr_ptr);
49829         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
49830         FREE(untag_ptr(this_ptr));
49831         ErrorAction_free(this_ptr_conv);
49832 }
49833
49834 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
49835         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49836         *ret_copy = ErrorAction_clone(arg);
49837         uint64_t ret_ref = tag_ptr(ret_copy, true);
49838         return ret_ref;
49839 }
49840 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
49841         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
49842         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
49843         return ret_conv;
49844 }
49845
49846 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
49847         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
49848         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49849         *ret_copy = ErrorAction_clone(orig_conv);
49850         uint64_t ret_ref = tag_ptr(ret_copy, true);
49851         return ret_ref;
49852 }
49853
49854 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
49855         LDKErrorMessage msg_conv;
49856         msg_conv.inner = untag_ptr(msg);
49857         msg_conv.is_owned = ptr_is_owned(msg);
49858         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
49859         msg_conv = ErrorMessage_clone(&msg_conv);
49860         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49861         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
49862         uint64_t ret_ref = tag_ptr(ret_copy, true);
49863         return ret_ref;
49864 }
49865
49866 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer_with_warning"))) TS_ErrorAction_disconnect_peer_with_warning(uint64_t msg) {
49867         LDKWarningMessage msg_conv;
49868         msg_conv.inner = untag_ptr(msg);
49869         msg_conv.is_owned = ptr_is_owned(msg);
49870         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
49871         msg_conv = WarningMessage_clone(&msg_conv);
49872         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49873         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
49874         uint64_t ret_ref = tag_ptr(ret_copy, true);
49875         return ret_ref;
49876 }
49877
49878 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
49879         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49880         *ret_copy = ErrorAction_ignore_error();
49881         uint64_t ret_ref = tag_ptr(ret_copy, true);
49882         return ret_ref;
49883 }
49884
49885 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
49886         LDKLevel a_conv = LDKLevel_from_js(a);
49887         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49888         *ret_copy = ErrorAction_ignore_and_log(a_conv);
49889         uint64_t ret_ref = tag_ptr(ret_copy, true);
49890         return ret_ref;
49891 }
49892
49893 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
49894         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49895         *ret_copy = ErrorAction_ignore_duplicate_gossip();
49896         uint64_t ret_ref = tag_ptr(ret_copy, true);
49897         return ret_ref;
49898 }
49899
49900 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
49901         LDKErrorMessage msg_conv;
49902         msg_conv.inner = untag_ptr(msg);
49903         msg_conv.is_owned = ptr_is_owned(msg);
49904         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
49905         msg_conv = ErrorMessage_clone(&msg_conv);
49906         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49907         *ret_copy = ErrorAction_send_error_message(msg_conv);
49908         uint64_t ret_ref = tag_ptr(ret_copy, true);
49909         return ret_ref;
49910 }
49911
49912 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
49913         LDKWarningMessage msg_conv;
49914         msg_conv.inner = untag_ptr(msg);
49915         msg_conv.is_owned = ptr_is_owned(msg);
49916         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
49917         msg_conv = WarningMessage_clone(&msg_conv);
49918         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
49919         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49920         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
49921         uint64_t ret_ref = tag_ptr(ret_copy, true);
49922         return ret_ref;
49923 }
49924
49925 int64_t  __attribute__((export_name("TS_ErrorAction_hash"))) TS_ErrorAction_hash(uint64_t o) {
49926         LDKErrorAction* o_conv = (LDKErrorAction*)untag_ptr(o);
49927         int64_t ret_conv = ErrorAction_hash(o_conv);
49928         return ret_conv;
49929 }
49930
49931 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
49932         LDKLightningError this_obj_conv;
49933         this_obj_conv.inner = untag_ptr(this_obj);
49934         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49936         LightningError_free(this_obj_conv);
49937 }
49938
49939 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
49940         LDKLightningError this_ptr_conv;
49941         this_ptr_conv.inner = untag_ptr(this_ptr);
49942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49944         this_ptr_conv.is_owned = false;
49945         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
49946         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
49947         Str_free(ret_str);
49948         return ret_conv;
49949 }
49950
49951 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
49952         LDKLightningError this_ptr_conv;
49953         this_ptr_conv.inner = untag_ptr(this_ptr);
49954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49956         this_ptr_conv.is_owned = false;
49957         LDKStr val_conv = str_ref_to_owned_c(val);
49958         LightningError_set_err(&this_ptr_conv, val_conv);
49959 }
49960
49961 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
49962         LDKLightningError this_ptr_conv;
49963         this_ptr_conv.inner = untag_ptr(this_ptr);
49964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49966         this_ptr_conv.is_owned = false;
49967         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49968         *ret_copy = LightningError_get_action(&this_ptr_conv);
49969         uint64_t ret_ref = tag_ptr(ret_copy, true);
49970         return ret_ref;
49971 }
49972
49973 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
49974         LDKLightningError this_ptr_conv;
49975         this_ptr_conv.inner = untag_ptr(this_ptr);
49976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49978         this_ptr_conv.is_owned = false;
49979         void* val_ptr = untag_ptr(val);
49980         CHECK_ACCESS(val_ptr);
49981         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
49982         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
49983         LightningError_set_action(&this_ptr_conv, val_conv);
49984 }
49985
49986 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
49987         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
49988         void* action_arg_ptr = untag_ptr(action_arg);
49989         CHECK_ACCESS(action_arg_ptr);
49990         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
49991         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
49992         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
49993         uint64_t ret_ref = 0;
49994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49996         return ret_ref;
49997 }
49998
49999 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
50000         LDKLightningError ret_var = LightningError_clone(arg);
50001         uint64_t ret_ref = 0;
50002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50004         return ret_ref;
50005 }
50006 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
50007         LDKLightningError arg_conv;
50008         arg_conv.inner = untag_ptr(arg);
50009         arg_conv.is_owned = ptr_is_owned(arg);
50010         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50011         arg_conv.is_owned = false;
50012         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
50013         return ret_conv;
50014 }
50015
50016 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
50017         LDKLightningError orig_conv;
50018         orig_conv.inner = untag_ptr(orig);
50019         orig_conv.is_owned = ptr_is_owned(orig);
50020         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50021         orig_conv.is_owned = false;
50022         LDKLightningError ret_var = LightningError_clone(&orig_conv);
50023         uint64_t ret_ref = 0;
50024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50026         return ret_ref;
50027 }
50028
50029 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
50030         LDKCommitmentUpdate this_obj_conv;
50031         this_obj_conv.inner = untag_ptr(this_obj);
50032         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50034         CommitmentUpdate_free(this_obj_conv);
50035 }
50036
50037 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
50038         LDKCommitmentUpdate this_ptr_conv;
50039         this_ptr_conv.inner = untag_ptr(this_ptr);
50040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50042         this_ptr_conv.is_owned = false;
50043         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
50044         uint64_tArray ret_arr = NULL;
50045         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
50046         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
50047         for (size_t p = 0; p < ret_var.datalen; p++) {
50048                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
50049                 uint64_t ret_conv_15_ref = 0;
50050                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
50051                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
50052                 ret_arr_ptr[p] = ret_conv_15_ref;
50053         }
50054         
50055         FREE(ret_var.data);
50056         return ret_arr;
50057 }
50058
50059 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
50060         LDKCommitmentUpdate this_ptr_conv;
50061         this_ptr_conv.inner = untag_ptr(this_ptr);
50062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50064         this_ptr_conv.is_owned = false;
50065         LDKCVec_UpdateAddHTLCZ val_constr;
50066         val_constr.datalen = val->arr_len;
50067         if (val_constr.datalen > 0)
50068                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
50069         else
50070                 val_constr.data = NULL;
50071         uint64_t* val_vals = val->elems;
50072         for (size_t p = 0; p < val_constr.datalen; p++) {
50073                 uint64_t val_conv_15 = val_vals[p];
50074                 LDKUpdateAddHTLC val_conv_15_conv;
50075                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
50076                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
50077                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
50078                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
50079                 val_constr.data[p] = val_conv_15_conv;
50080         }
50081         FREE(val);
50082         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
50083 }
50084
50085 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
50086         LDKCommitmentUpdate this_ptr_conv;
50087         this_ptr_conv.inner = untag_ptr(this_ptr);
50088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50090         this_ptr_conv.is_owned = false;
50091         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
50092         uint64_tArray ret_arr = NULL;
50093         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
50094         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
50095         for (size_t t = 0; t < ret_var.datalen; t++) {
50096                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
50097                 uint64_t ret_conv_19_ref = 0;
50098                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
50099                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
50100                 ret_arr_ptr[t] = ret_conv_19_ref;
50101         }
50102         
50103         FREE(ret_var.data);
50104         return ret_arr;
50105 }
50106
50107 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
50108         LDKCommitmentUpdate this_ptr_conv;
50109         this_ptr_conv.inner = untag_ptr(this_ptr);
50110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50112         this_ptr_conv.is_owned = false;
50113         LDKCVec_UpdateFulfillHTLCZ val_constr;
50114         val_constr.datalen = val->arr_len;
50115         if (val_constr.datalen > 0)
50116                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
50117         else
50118                 val_constr.data = NULL;
50119         uint64_t* val_vals = val->elems;
50120         for (size_t t = 0; t < val_constr.datalen; t++) {
50121                 uint64_t val_conv_19 = val_vals[t];
50122                 LDKUpdateFulfillHTLC val_conv_19_conv;
50123                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
50124                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
50125                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
50126                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
50127                 val_constr.data[t] = val_conv_19_conv;
50128         }
50129         FREE(val);
50130         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
50131 }
50132
50133 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
50134         LDKCommitmentUpdate this_ptr_conv;
50135         this_ptr_conv.inner = untag_ptr(this_ptr);
50136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50138         this_ptr_conv.is_owned = false;
50139         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
50140         uint64_tArray ret_arr = NULL;
50141         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
50142         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
50143         for (size_t q = 0; q < ret_var.datalen; q++) {
50144                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
50145                 uint64_t ret_conv_16_ref = 0;
50146                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
50147                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
50148                 ret_arr_ptr[q] = ret_conv_16_ref;
50149         }
50150         
50151         FREE(ret_var.data);
50152         return ret_arr;
50153 }
50154
50155 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
50156         LDKCommitmentUpdate this_ptr_conv;
50157         this_ptr_conv.inner = untag_ptr(this_ptr);
50158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50160         this_ptr_conv.is_owned = false;
50161         LDKCVec_UpdateFailHTLCZ val_constr;
50162         val_constr.datalen = val->arr_len;
50163         if (val_constr.datalen > 0)
50164                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
50165         else
50166                 val_constr.data = NULL;
50167         uint64_t* val_vals = val->elems;
50168         for (size_t q = 0; q < val_constr.datalen; q++) {
50169                 uint64_t val_conv_16 = val_vals[q];
50170                 LDKUpdateFailHTLC val_conv_16_conv;
50171                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
50172                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
50173                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
50174                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
50175                 val_constr.data[q] = val_conv_16_conv;
50176         }
50177         FREE(val);
50178         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
50179 }
50180
50181 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
50182         LDKCommitmentUpdate this_ptr_conv;
50183         this_ptr_conv.inner = untag_ptr(this_ptr);
50184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50186         this_ptr_conv.is_owned = false;
50187         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
50188         uint64_tArray ret_arr = NULL;
50189         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
50190         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
50191         for (size_t z = 0; z < ret_var.datalen; z++) {
50192                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
50193                 uint64_t ret_conv_25_ref = 0;
50194                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
50195                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
50196                 ret_arr_ptr[z] = ret_conv_25_ref;
50197         }
50198         
50199         FREE(ret_var.data);
50200         return ret_arr;
50201 }
50202
50203 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) {
50204         LDKCommitmentUpdate this_ptr_conv;
50205         this_ptr_conv.inner = untag_ptr(this_ptr);
50206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50208         this_ptr_conv.is_owned = false;
50209         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
50210         val_constr.datalen = val->arr_len;
50211         if (val_constr.datalen > 0)
50212                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
50213         else
50214                 val_constr.data = NULL;
50215         uint64_t* val_vals = val->elems;
50216         for (size_t z = 0; z < val_constr.datalen; z++) {
50217                 uint64_t val_conv_25 = val_vals[z];
50218                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
50219                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
50220                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
50221                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
50222                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
50223                 val_constr.data[z] = val_conv_25_conv;
50224         }
50225         FREE(val);
50226         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
50227 }
50228
50229 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
50230         LDKCommitmentUpdate this_ptr_conv;
50231         this_ptr_conv.inner = untag_ptr(this_ptr);
50232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50234         this_ptr_conv.is_owned = false;
50235         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
50236         uint64_t ret_ref = 0;
50237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50239         return ret_ref;
50240 }
50241
50242 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
50243         LDKCommitmentUpdate this_ptr_conv;
50244         this_ptr_conv.inner = untag_ptr(this_ptr);
50245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50247         this_ptr_conv.is_owned = false;
50248         LDKUpdateFee val_conv;
50249         val_conv.inner = untag_ptr(val);
50250         val_conv.is_owned = ptr_is_owned(val);
50251         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50252         val_conv = UpdateFee_clone(&val_conv);
50253         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
50254 }
50255
50256 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
50257         LDKCommitmentUpdate this_ptr_conv;
50258         this_ptr_conv.inner = untag_ptr(this_ptr);
50259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50261         this_ptr_conv.is_owned = false;
50262         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
50263         uint64_t ret_ref = 0;
50264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50266         return ret_ref;
50267 }
50268
50269 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
50270         LDKCommitmentUpdate this_ptr_conv;
50271         this_ptr_conv.inner = untag_ptr(this_ptr);
50272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50274         this_ptr_conv.is_owned = false;
50275         LDKCommitmentSigned val_conv;
50276         val_conv.inner = untag_ptr(val);
50277         val_conv.is_owned = ptr_is_owned(val);
50278         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50279         val_conv = CommitmentSigned_clone(&val_conv);
50280         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
50281 }
50282
50283 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) {
50284         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
50285         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
50286         if (update_add_htlcs_arg_constr.datalen > 0)
50287                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
50288         else
50289                 update_add_htlcs_arg_constr.data = NULL;
50290         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
50291         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
50292                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
50293                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
50294                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
50295                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
50296                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
50297                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
50298                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
50299         }
50300         FREE(update_add_htlcs_arg);
50301         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
50302         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
50303         if (update_fulfill_htlcs_arg_constr.datalen > 0)
50304                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
50305         else
50306                 update_fulfill_htlcs_arg_constr.data = NULL;
50307         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
50308         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
50309                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
50310                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
50311                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
50312                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
50313                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
50314                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
50315                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
50316         }
50317         FREE(update_fulfill_htlcs_arg);
50318         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
50319         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
50320         if (update_fail_htlcs_arg_constr.datalen > 0)
50321                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
50322         else
50323                 update_fail_htlcs_arg_constr.data = NULL;
50324         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
50325         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
50326                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
50327                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
50328                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
50329                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
50330                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
50331                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
50332                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
50333         }
50334         FREE(update_fail_htlcs_arg);
50335         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
50336         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
50337         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
50338                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
50339         else
50340                 update_fail_malformed_htlcs_arg_constr.data = NULL;
50341         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
50342         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
50343                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
50344                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
50345                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
50346                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
50347                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
50348                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
50349                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
50350         }
50351         FREE(update_fail_malformed_htlcs_arg);
50352         LDKUpdateFee update_fee_arg_conv;
50353         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
50354         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
50355         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
50356         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
50357         LDKCommitmentSigned commitment_signed_arg_conv;
50358         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
50359         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
50360         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
50361         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
50362         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);
50363         uint64_t ret_ref = 0;
50364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50366         return ret_ref;
50367 }
50368
50369 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
50370         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
50371         uint64_t ret_ref = 0;
50372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50374         return ret_ref;
50375 }
50376 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
50377         LDKCommitmentUpdate arg_conv;
50378         arg_conv.inner = untag_ptr(arg);
50379         arg_conv.is_owned = ptr_is_owned(arg);
50380         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50381         arg_conv.is_owned = false;
50382         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
50383         return ret_conv;
50384 }
50385
50386 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
50387         LDKCommitmentUpdate orig_conv;
50388         orig_conv.inner = untag_ptr(orig);
50389         orig_conv.is_owned = ptr_is_owned(orig);
50390         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50391         orig_conv.is_owned = false;
50392         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
50393         uint64_t ret_ref = 0;
50394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50396         return ret_ref;
50397 }
50398
50399 int64_t  __attribute__((export_name("TS_CommitmentUpdate_hash"))) TS_CommitmentUpdate_hash(uint64_t o) {
50400         LDKCommitmentUpdate o_conv;
50401         o_conv.inner = untag_ptr(o);
50402         o_conv.is_owned = ptr_is_owned(o);
50403         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50404         o_conv.is_owned = false;
50405         int64_t ret_conv = CommitmentUpdate_hash(&o_conv);
50406         return ret_conv;
50407 }
50408
50409 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
50410         LDKCommitmentUpdate a_conv;
50411         a_conv.inner = untag_ptr(a);
50412         a_conv.is_owned = ptr_is_owned(a);
50413         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50414         a_conv.is_owned = false;
50415         LDKCommitmentUpdate b_conv;
50416         b_conv.inner = untag_ptr(b);
50417         b_conv.is_owned = ptr_is_owned(b);
50418         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50419         b_conv.is_owned = false;
50420         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
50421         return ret_conv;
50422 }
50423
50424 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
50425         if (!ptr_is_owned(this_ptr)) return;
50426         void* this_ptr_ptr = untag_ptr(this_ptr);
50427         CHECK_ACCESS(this_ptr_ptr);
50428         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
50429         FREE(untag_ptr(this_ptr));
50430         ChannelMessageHandler_free(this_ptr_conv);
50431 }
50432
50433 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
50434         if (!ptr_is_owned(this_ptr)) return;
50435         void* this_ptr_ptr = untag_ptr(this_ptr);
50436         CHECK_ACCESS(this_ptr_ptr);
50437         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
50438         FREE(untag_ptr(this_ptr));
50439         RoutingMessageHandler_free(this_ptr_conv);
50440 }
50441
50442 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
50443         if (!ptr_is_owned(this_ptr)) return;
50444         void* this_ptr_ptr = untag_ptr(this_ptr);
50445         CHECK_ACCESS(this_ptr_ptr);
50446         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
50447         FREE(untag_ptr(this_ptr));
50448         OnionMessageHandler_free(this_ptr_conv);
50449 }
50450
50451 void  __attribute__((export_name("TS_FinalOnionHopData_free"))) TS_FinalOnionHopData_free(uint64_t this_obj) {
50452         LDKFinalOnionHopData this_obj_conv;
50453         this_obj_conv.inner = untag_ptr(this_obj);
50454         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50456         FinalOnionHopData_free(this_obj_conv);
50457 }
50458
50459 int8_tArray  __attribute__((export_name("TS_FinalOnionHopData_get_payment_secret"))) TS_FinalOnionHopData_get_payment_secret(uint64_t this_ptr) {
50460         LDKFinalOnionHopData this_ptr_conv;
50461         this_ptr_conv.inner = untag_ptr(this_ptr);
50462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50464         this_ptr_conv.is_owned = false;
50465         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50466         memcpy(ret_arr->elems, *FinalOnionHopData_get_payment_secret(&this_ptr_conv), 32);
50467         return ret_arr;
50468 }
50469
50470 void  __attribute__((export_name("TS_FinalOnionHopData_set_payment_secret"))) TS_FinalOnionHopData_set_payment_secret(uint64_t this_ptr, int8_tArray val) {
50471         LDKFinalOnionHopData this_ptr_conv;
50472         this_ptr_conv.inner = untag_ptr(this_ptr);
50473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50475         this_ptr_conv.is_owned = false;
50476         LDKThirtyTwoBytes val_ref;
50477         CHECK(val->arr_len == 32);
50478         memcpy(val_ref.data, val->elems, 32); FREE(val);
50479         FinalOnionHopData_set_payment_secret(&this_ptr_conv, val_ref);
50480 }
50481
50482 int64_t  __attribute__((export_name("TS_FinalOnionHopData_get_total_msat"))) TS_FinalOnionHopData_get_total_msat(uint64_t this_ptr) {
50483         LDKFinalOnionHopData this_ptr_conv;
50484         this_ptr_conv.inner = untag_ptr(this_ptr);
50485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50487         this_ptr_conv.is_owned = false;
50488         int64_t ret_conv = FinalOnionHopData_get_total_msat(&this_ptr_conv);
50489         return ret_conv;
50490 }
50491
50492 void  __attribute__((export_name("TS_FinalOnionHopData_set_total_msat"))) TS_FinalOnionHopData_set_total_msat(uint64_t this_ptr, int64_t val) {
50493         LDKFinalOnionHopData this_ptr_conv;
50494         this_ptr_conv.inner = untag_ptr(this_ptr);
50495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50497         this_ptr_conv.is_owned = false;
50498         FinalOnionHopData_set_total_msat(&this_ptr_conv, val);
50499 }
50500
50501 uint64_t  __attribute__((export_name("TS_FinalOnionHopData_new"))) TS_FinalOnionHopData_new(int8_tArray payment_secret_arg, int64_t total_msat_arg) {
50502         LDKThirtyTwoBytes payment_secret_arg_ref;
50503         CHECK(payment_secret_arg->arr_len == 32);
50504         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
50505         LDKFinalOnionHopData ret_var = FinalOnionHopData_new(payment_secret_arg_ref, total_msat_arg);
50506         uint64_t ret_ref = 0;
50507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50509         return ret_ref;
50510 }
50511
50512 static inline uint64_t FinalOnionHopData_clone_ptr(LDKFinalOnionHopData *NONNULL_PTR arg) {
50513         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(arg);
50514         uint64_t ret_ref = 0;
50515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50517         return ret_ref;
50518 }
50519 int64_t  __attribute__((export_name("TS_FinalOnionHopData_clone_ptr"))) TS_FinalOnionHopData_clone_ptr(uint64_t arg) {
50520         LDKFinalOnionHopData arg_conv;
50521         arg_conv.inner = untag_ptr(arg);
50522         arg_conv.is_owned = ptr_is_owned(arg);
50523         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50524         arg_conv.is_owned = false;
50525         int64_t ret_conv = FinalOnionHopData_clone_ptr(&arg_conv);
50526         return ret_conv;
50527 }
50528
50529 uint64_t  __attribute__((export_name("TS_FinalOnionHopData_clone"))) TS_FinalOnionHopData_clone(uint64_t orig) {
50530         LDKFinalOnionHopData orig_conv;
50531         orig_conv.inner = untag_ptr(orig);
50532         orig_conv.is_owned = ptr_is_owned(orig);
50533         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50534         orig_conv.is_owned = false;
50535         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(&orig_conv);
50536         uint64_t ret_ref = 0;
50537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50539         return ret_ref;
50540 }
50541
50542 void  __attribute__((export_name("TS_OnionPacket_free"))) TS_OnionPacket_free(uint64_t this_obj) {
50543         LDKOnionPacket this_obj_conv;
50544         this_obj_conv.inner = untag_ptr(this_obj);
50545         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50547         OnionPacket_free(this_obj_conv);
50548 }
50549
50550 int8_t  __attribute__((export_name("TS_OnionPacket_get_version"))) TS_OnionPacket_get_version(uint64_t this_ptr) {
50551         LDKOnionPacket this_ptr_conv;
50552         this_ptr_conv.inner = untag_ptr(this_ptr);
50553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50555         this_ptr_conv.is_owned = false;
50556         int8_t ret_conv = OnionPacket_get_version(&this_ptr_conv);
50557         return ret_conv;
50558 }
50559
50560 void  __attribute__((export_name("TS_OnionPacket_set_version"))) TS_OnionPacket_set_version(uint64_t this_ptr, int8_t val) {
50561         LDKOnionPacket this_ptr_conv;
50562         this_ptr_conv.inner = untag_ptr(this_ptr);
50563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50565         this_ptr_conv.is_owned = false;
50566         OnionPacket_set_version(&this_ptr_conv, val);
50567 }
50568
50569 uint64_t  __attribute__((export_name("TS_OnionPacket_get_public_key"))) TS_OnionPacket_get_public_key(uint64_t this_ptr) {
50570         LDKOnionPacket this_ptr_conv;
50571         this_ptr_conv.inner = untag_ptr(this_ptr);
50572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50574         this_ptr_conv.is_owned = false;
50575         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
50576         *ret_conv = OnionPacket_get_public_key(&this_ptr_conv);
50577         return tag_ptr(ret_conv, true);
50578 }
50579
50580 void  __attribute__((export_name("TS_OnionPacket_set_public_key"))) TS_OnionPacket_set_public_key(uint64_t this_ptr, uint64_t val) {
50581         LDKOnionPacket this_ptr_conv;
50582         this_ptr_conv.inner = untag_ptr(this_ptr);
50583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50585         this_ptr_conv.is_owned = false;
50586         void* val_ptr = untag_ptr(val);
50587         CHECK_ACCESS(val_ptr);
50588         LDKCResult_PublicKeySecp256k1ErrorZ val_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(val_ptr);
50589         val_conv = CResult_PublicKeySecp256k1ErrorZ_clone((LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(val));
50590         OnionPacket_set_public_key(&this_ptr_conv, val_conv);
50591 }
50592
50593 int8_tArray  __attribute__((export_name("TS_OnionPacket_get_hmac"))) TS_OnionPacket_get_hmac(uint64_t this_ptr) {
50594         LDKOnionPacket this_ptr_conv;
50595         this_ptr_conv.inner = untag_ptr(this_ptr);
50596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50598         this_ptr_conv.is_owned = false;
50599         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50600         memcpy(ret_arr->elems, *OnionPacket_get_hmac(&this_ptr_conv), 32);
50601         return ret_arr;
50602 }
50603
50604 void  __attribute__((export_name("TS_OnionPacket_set_hmac"))) TS_OnionPacket_set_hmac(uint64_t this_ptr, int8_tArray val) {
50605         LDKOnionPacket this_ptr_conv;
50606         this_ptr_conv.inner = untag_ptr(this_ptr);
50607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50609         this_ptr_conv.is_owned = false;
50610         LDKThirtyTwoBytes val_ref;
50611         CHECK(val->arr_len == 32);
50612         memcpy(val_ref.data, val->elems, 32); FREE(val);
50613         OnionPacket_set_hmac(&this_ptr_conv, val_ref);
50614 }
50615
50616 static inline uint64_t OnionPacket_clone_ptr(LDKOnionPacket *NONNULL_PTR arg) {
50617         LDKOnionPacket ret_var = OnionPacket_clone(arg);
50618         uint64_t ret_ref = 0;
50619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50621         return ret_ref;
50622 }
50623 int64_t  __attribute__((export_name("TS_OnionPacket_clone_ptr"))) TS_OnionPacket_clone_ptr(uint64_t arg) {
50624         LDKOnionPacket arg_conv;
50625         arg_conv.inner = untag_ptr(arg);
50626         arg_conv.is_owned = ptr_is_owned(arg);
50627         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50628         arg_conv.is_owned = false;
50629         int64_t ret_conv = OnionPacket_clone_ptr(&arg_conv);
50630         return ret_conv;
50631 }
50632
50633 uint64_t  __attribute__((export_name("TS_OnionPacket_clone"))) TS_OnionPacket_clone(uint64_t orig) {
50634         LDKOnionPacket orig_conv;
50635         orig_conv.inner = untag_ptr(orig);
50636         orig_conv.is_owned = ptr_is_owned(orig);
50637         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50638         orig_conv.is_owned = false;
50639         LDKOnionPacket ret_var = OnionPacket_clone(&orig_conv);
50640         uint64_t ret_ref = 0;
50641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50643         return ret_ref;
50644 }
50645
50646 int64_t  __attribute__((export_name("TS_OnionPacket_hash"))) TS_OnionPacket_hash(uint64_t o) {
50647         LDKOnionPacket o_conv;
50648         o_conv.inner = untag_ptr(o);
50649         o_conv.is_owned = ptr_is_owned(o);
50650         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50651         o_conv.is_owned = false;
50652         int64_t ret_conv = OnionPacket_hash(&o_conv);
50653         return ret_conv;
50654 }
50655
50656 jboolean  __attribute__((export_name("TS_OnionPacket_eq"))) TS_OnionPacket_eq(uint64_t a, uint64_t b) {
50657         LDKOnionPacket a_conv;
50658         a_conv.inner = untag_ptr(a);
50659         a_conv.is_owned = ptr_is_owned(a);
50660         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50661         a_conv.is_owned = false;
50662         LDKOnionPacket b_conv;
50663         b_conv.inner = untag_ptr(b);
50664         b_conv.is_owned = ptr_is_owned(b);
50665         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50666         b_conv.is_owned = false;
50667         jboolean ret_conv = OnionPacket_eq(&a_conv, &b_conv);
50668         return ret_conv;
50669 }
50670
50671 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
50672         LDKAcceptChannel obj_conv;
50673         obj_conv.inner = untag_ptr(obj);
50674         obj_conv.is_owned = ptr_is_owned(obj);
50675         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50676         obj_conv.is_owned = false;
50677         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
50678         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50679         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50680         CVec_u8Z_free(ret_var);
50681         return ret_arr;
50682 }
50683
50684 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
50685         LDKu8slice ser_ref;
50686         ser_ref.datalen = ser->arr_len;
50687         ser_ref.data = ser->elems;
50688         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
50689         *ret_conv = AcceptChannel_read(ser_ref);
50690         FREE(ser);
50691         return tag_ptr(ret_conv, true);
50692 }
50693
50694 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_write"))) TS_AcceptChannelV2_write(uint64_t obj) {
50695         LDKAcceptChannelV2 obj_conv;
50696         obj_conv.inner = untag_ptr(obj);
50697         obj_conv.is_owned = ptr_is_owned(obj);
50698         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50699         obj_conv.is_owned = false;
50700         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
50701         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50702         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50703         CVec_u8Z_free(ret_var);
50704         return ret_arr;
50705 }
50706
50707 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_read"))) TS_AcceptChannelV2_read(int8_tArray ser) {
50708         LDKu8slice ser_ref;
50709         ser_ref.datalen = ser->arr_len;
50710         ser_ref.data = ser->elems;
50711         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
50712         *ret_conv = AcceptChannelV2_read(ser_ref);
50713         FREE(ser);
50714         return tag_ptr(ret_conv, true);
50715 }
50716
50717 int8_tArray  __attribute__((export_name("TS_Stfu_write"))) TS_Stfu_write(uint64_t obj) {
50718         LDKStfu obj_conv;
50719         obj_conv.inner = untag_ptr(obj);
50720         obj_conv.is_owned = ptr_is_owned(obj);
50721         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50722         obj_conv.is_owned = false;
50723         LDKCVec_u8Z ret_var = Stfu_write(&obj_conv);
50724         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50725         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50726         CVec_u8Z_free(ret_var);
50727         return ret_arr;
50728 }
50729
50730 uint64_t  __attribute__((export_name("TS_Stfu_read"))) TS_Stfu_read(int8_tArray ser) {
50731         LDKu8slice ser_ref;
50732         ser_ref.datalen = ser->arr_len;
50733         ser_ref.data = ser->elems;
50734         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
50735         *ret_conv = Stfu_read(ser_ref);
50736         FREE(ser);
50737         return tag_ptr(ret_conv, true);
50738 }
50739
50740 int8_tArray  __attribute__((export_name("TS_Splice_write"))) TS_Splice_write(uint64_t obj) {
50741         LDKSplice obj_conv;
50742         obj_conv.inner = untag_ptr(obj);
50743         obj_conv.is_owned = ptr_is_owned(obj);
50744         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50745         obj_conv.is_owned = false;
50746         LDKCVec_u8Z ret_var = Splice_write(&obj_conv);
50747         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50748         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50749         CVec_u8Z_free(ret_var);
50750         return ret_arr;
50751 }
50752
50753 uint64_t  __attribute__((export_name("TS_Splice_read"))) TS_Splice_read(int8_tArray ser) {
50754         LDKu8slice ser_ref;
50755         ser_ref.datalen = ser->arr_len;
50756         ser_ref.data = ser->elems;
50757         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
50758         *ret_conv = Splice_read(ser_ref);
50759         FREE(ser);
50760         return tag_ptr(ret_conv, true);
50761 }
50762
50763 int8_tArray  __attribute__((export_name("TS_SpliceAck_write"))) TS_SpliceAck_write(uint64_t obj) {
50764         LDKSpliceAck obj_conv;
50765         obj_conv.inner = untag_ptr(obj);
50766         obj_conv.is_owned = ptr_is_owned(obj);
50767         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50768         obj_conv.is_owned = false;
50769         LDKCVec_u8Z ret_var = SpliceAck_write(&obj_conv);
50770         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50771         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50772         CVec_u8Z_free(ret_var);
50773         return ret_arr;
50774 }
50775
50776 uint64_t  __attribute__((export_name("TS_SpliceAck_read"))) TS_SpliceAck_read(int8_tArray ser) {
50777         LDKu8slice ser_ref;
50778         ser_ref.datalen = ser->arr_len;
50779         ser_ref.data = ser->elems;
50780         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
50781         *ret_conv = SpliceAck_read(ser_ref);
50782         FREE(ser);
50783         return tag_ptr(ret_conv, true);
50784 }
50785
50786 int8_tArray  __attribute__((export_name("TS_SpliceLocked_write"))) TS_SpliceLocked_write(uint64_t obj) {
50787         LDKSpliceLocked obj_conv;
50788         obj_conv.inner = untag_ptr(obj);
50789         obj_conv.is_owned = ptr_is_owned(obj);
50790         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50791         obj_conv.is_owned = false;
50792         LDKCVec_u8Z ret_var = SpliceLocked_write(&obj_conv);
50793         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50794         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50795         CVec_u8Z_free(ret_var);
50796         return ret_arr;
50797 }
50798
50799 uint64_t  __attribute__((export_name("TS_SpliceLocked_read"))) TS_SpliceLocked_read(int8_tArray ser) {
50800         LDKu8slice ser_ref;
50801         ser_ref.datalen = ser->arr_len;
50802         ser_ref.data = ser->elems;
50803         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
50804         *ret_conv = SpliceLocked_read(ser_ref);
50805         FREE(ser);
50806         return tag_ptr(ret_conv, true);
50807 }
50808
50809 int8_tArray  __attribute__((export_name("TS_TxAddInput_write"))) TS_TxAddInput_write(uint64_t obj) {
50810         LDKTxAddInput obj_conv;
50811         obj_conv.inner = untag_ptr(obj);
50812         obj_conv.is_owned = ptr_is_owned(obj);
50813         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50814         obj_conv.is_owned = false;
50815         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
50816         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50817         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50818         CVec_u8Z_free(ret_var);
50819         return ret_arr;
50820 }
50821
50822 uint64_t  __attribute__((export_name("TS_TxAddInput_read"))) TS_TxAddInput_read(int8_tArray ser) {
50823         LDKu8slice ser_ref;
50824         ser_ref.datalen = ser->arr_len;
50825         ser_ref.data = ser->elems;
50826         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
50827         *ret_conv = TxAddInput_read(ser_ref);
50828         FREE(ser);
50829         return tag_ptr(ret_conv, true);
50830 }
50831
50832 int8_tArray  __attribute__((export_name("TS_TxAddOutput_write"))) TS_TxAddOutput_write(uint64_t obj) {
50833         LDKTxAddOutput obj_conv;
50834         obj_conv.inner = untag_ptr(obj);
50835         obj_conv.is_owned = ptr_is_owned(obj);
50836         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50837         obj_conv.is_owned = false;
50838         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
50839         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50840         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50841         CVec_u8Z_free(ret_var);
50842         return ret_arr;
50843 }
50844
50845 uint64_t  __attribute__((export_name("TS_TxAddOutput_read"))) TS_TxAddOutput_read(int8_tArray ser) {
50846         LDKu8slice ser_ref;
50847         ser_ref.datalen = ser->arr_len;
50848         ser_ref.data = ser->elems;
50849         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
50850         *ret_conv = TxAddOutput_read(ser_ref);
50851         FREE(ser);
50852         return tag_ptr(ret_conv, true);
50853 }
50854
50855 int8_tArray  __attribute__((export_name("TS_TxRemoveInput_write"))) TS_TxRemoveInput_write(uint64_t obj) {
50856         LDKTxRemoveInput obj_conv;
50857         obj_conv.inner = untag_ptr(obj);
50858         obj_conv.is_owned = ptr_is_owned(obj);
50859         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50860         obj_conv.is_owned = false;
50861         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
50862         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50863         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50864         CVec_u8Z_free(ret_var);
50865         return ret_arr;
50866 }
50867
50868 uint64_t  __attribute__((export_name("TS_TxRemoveInput_read"))) TS_TxRemoveInput_read(int8_tArray ser) {
50869         LDKu8slice ser_ref;
50870         ser_ref.datalen = ser->arr_len;
50871         ser_ref.data = ser->elems;
50872         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
50873         *ret_conv = TxRemoveInput_read(ser_ref);
50874         FREE(ser);
50875         return tag_ptr(ret_conv, true);
50876 }
50877
50878 int8_tArray  __attribute__((export_name("TS_TxRemoveOutput_write"))) TS_TxRemoveOutput_write(uint64_t obj) {
50879         LDKTxRemoveOutput obj_conv;
50880         obj_conv.inner = untag_ptr(obj);
50881         obj_conv.is_owned = ptr_is_owned(obj);
50882         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50883         obj_conv.is_owned = false;
50884         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
50885         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50886         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50887         CVec_u8Z_free(ret_var);
50888         return ret_arr;
50889 }
50890
50891 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_read"))) TS_TxRemoveOutput_read(int8_tArray ser) {
50892         LDKu8slice ser_ref;
50893         ser_ref.datalen = ser->arr_len;
50894         ser_ref.data = ser->elems;
50895         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
50896         *ret_conv = TxRemoveOutput_read(ser_ref);
50897         FREE(ser);
50898         return tag_ptr(ret_conv, true);
50899 }
50900
50901 int8_tArray  __attribute__((export_name("TS_TxComplete_write"))) TS_TxComplete_write(uint64_t obj) {
50902         LDKTxComplete obj_conv;
50903         obj_conv.inner = untag_ptr(obj);
50904         obj_conv.is_owned = ptr_is_owned(obj);
50905         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50906         obj_conv.is_owned = false;
50907         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
50908         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50909         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50910         CVec_u8Z_free(ret_var);
50911         return ret_arr;
50912 }
50913
50914 uint64_t  __attribute__((export_name("TS_TxComplete_read"))) TS_TxComplete_read(int8_tArray ser) {
50915         LDKu8slice ser_ref;
50916         ser_ref.datalen = ser->arr_len;
50917         ser_ref.data = ser->elems;
50918         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
50919         *ret_conv = TxComplete_read(ser_ref);
50920         FREE(ser);
50921         return tag_ptr(ret_conv, true);
50922 }
50923
50924 int8_tArray  __attribute__((export_name("TS_TxSignatures_write"))) TS_TxSignatures_write(uint64_t obj) {
50925         LDKTxSignatures obj_conv;
50926         obj_conv.inner = untag_ptr(obj);
50927         obj_conv.is_owned = ptr_is_owned(obj);
50928         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50929         obj_conv.is_owned = false;
50930         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
50931         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50932         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50933         CVec_u8Z_free(ret_var);
50934         return ret_arr;
50935 }
50936
50937 uint64_t  __attribute__((export_name("TS_TxSignatures_read"))) TS_TxSignatures_read(int8_tArray ser) {
50938         LDKu8slice ser_ref;
50939         ser_ref.datalen = ser->arr_len;
50940         ser_ref.data = ser->elems;
50941         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
50942         *ret_conv = TxSignatures_read(ser_ref);
50943         FREE(ser);
50944         return tag_ptr(ret_conv, true);
50945 }
50946
50947 int8_tArray  __attribute__((export_name("TS_TxInitRbf_write"))) TS_TxInitRbf_write(uint64_t obj) {
50948         LDKTxInitRbf obj_conv;
50949         obj_conv.inner = untag_ptr(obj);
50950         obj_conv.is_owned = ptr_is_owned(obj);
50951         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50952         obj_conv.is_owned = false;
50953         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
50954         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50955         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50956         CVec_u8Z_free(ret_var);
50957         return ret_arr;
50958 }
50959
50960 uint64_t  __attribute__((export_name("TS_TxInitRbf_read"))) TS_TxInitRbf_read(int8_tArray ser) {
50961         LDKu8slice ser_ref;
50962         ser_ref.datalen = ser->arr_len;
50963         ser_ref.data = ser->elems;
50964         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
50965         *ret_conv = TxInitRbf_read(ser_ref);
50966         FREE(ser);
50967         return tag_ptr(ret_conv, true);
50968 }
50969
50970 int8_tArray  __attribute__((export_name("TS_TxAckRbf_write"))) TS_TxAckRbf_write(uint64_t obj) {
50971         LDKTxAckRbf obj_conv;
50972         obj_conv.inner = untag_ptr(obj);
50973         obj_conv.is_owned = ptr_is_owned(obj);
50974         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50975         obj_conv.is_owned = false;
50976         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
50977         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50978         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50979         CVec_u8Z_free(ret_var);
50980         return ret_arr;
50981 }
50982
50983 uint64_t  __attribute__((export_name("TS_TxAckRbf_read"))) TS_TxAckRbf_read(int8_tArray ser) {
50984         LDKu8slice ser_ref;
50985         ser_ref.datalen = ser->arr_len;
50986         ser_ref.data = ser->elems;
50987         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
50988         *ret_conv = TxAckRbf_read(ser_ref);
50989         FREE(ser);
50990         return tag_ptr(ret_conv, true);
50991 }
50992
50993 int8_tArray  __attribute__((export_name("TS_TxAbort_write"))) TS_TxAbort_write(uint64_t obj) {
50994         LDKTxAbort obj_conv;
50995         obj_conv.inner = untag_ptr(obj);
50996         obj_conv.is_owned = ptr_is_owned(obj);
50997         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50998         obj_conv.is_owned = false;
50999         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
51000         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51001         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51002         CVec_u8Z_free(ret_var);
51003         return ret_arr;
51004 }
51005
51006 uint64_t  __attribute__((export_name("TS_TxAbort_read"))) TS_TxAbort_read(int8_tArray ser) {
51007         LDKu8slice ser_ref;
51008         ser_ref.datalen = ser->arr_len;
51009         ser_ref.data = ser->elems;
51010         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
51011         *ret_conv = TxAbort_read(ser_ref);
51012         FREE(ser);
51013         return tag_ptr(ret_conv, true);
51014 }
51015
51016 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
51017         LDKAnnouncementSignatures obj_conv;
51018         obj_conv.inner = untag_ptr(obj);
51019         obj_conv.is_owned = ptr_is_owned(obj);
51020         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51021         obj_conv.is_owned = false;
51022         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
51023         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51024         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51025         CVec_u8Z_free(ret_var);
51026         return ret_arr;
51027 }
51028
51029 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
51030         LDKu8slice ser_ref;
51031         ser_ref.datalen = ser->arr_len;
51032         ser_ref.data = ser->elems;
51033         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
51034         *ret_conv = AnnouncementSignatures_read(ser_ref);
51035         FREE(ser);
51036         return tag_ptr(ret_conv, true);
51037 }
51038
51039 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
51040         LDKChannelReestablish obj_conv;
51041         obj_conv.inner = untag_ptr(obj);
51042         obj_conv.is_owned = ptr_is_owned(obj);
51043         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51044         obj_conv.is_owned = false;
51045         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
51046         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51047         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51048         CVec_u8Z_free(ret_var);
51049         return ret_arr;
51050 }
51051
51052 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
51053         LDKu8slice ser_ref;
51054         ser_ref.datalen = ser->arr_len;
51055         ser_ref.data = ser->elems;
51056         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
51057         *ret_conv = ChannelReestablish_read(ser_ref);
51058         FREE(ser);
51059         return tag_ptr(ret_conv, true);
51060 }
51061
51062 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
51063         LDKClosingSigned obj_conv;
51064         obj_conv.inner = untag_ptr(obj);
51065         obj_conv.is_owned = ptr_is_owned(obj);
51066         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51067         obj_conv.is_owned = false;
51068         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
51069         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51070         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51071         CVec_u8Z_free(ret_var);
51072         return ret_arr;
51073 }
51074
51075 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
51076         LDKu8slice ser_ref;
51077         ser_ref.datalen = ser->arr_len;
51078         ser_ref.data = ser->elems;
51079         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
51080         *ret_conv = ClosingSigned_read(ser_ref);
51081         FREE(ser);
51082         return tag_ptr(ret_conv, true);
51083 }
51084
51085 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
51086         LDKClosingSignedFeeRange obj_conv;
51087         obj_conv.inner = untag_ptr(obj);
51088         obj_conv.is_owned = ptr_is_owned(obj);
51089         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51090         obj_conv.is_owned = false;
51091         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
51092         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51093         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51094         CVec_u8Z_free(ret_var);
51095         return ret_arr;
51096 }
51097
51098 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
51099         LDKu8slice ser_ref;
51100         ser_ref.datalen = ser->arr_len;
51101         ser_ref.data = ser->elems;
51102         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
51103         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
51104         FREE(ser);
51105         return tag_ptr(ret_conv, true);
51106 }
51107
51108 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
51109         LDKCommitmentSigned obj_conv;
51110         obj_conv.inner = untag_ptr(obj);
51111         obj_conv.is_owned = ptr_is_owned(obj);
51112         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51113         obj_conv.is_owned = false;
51114         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
51115         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51116         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51117         CVec_u8Z_free(ret_var);
51118         return ret_arr;
51119 }
51120
51121 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
51122         LDKu8slice ser_ref;
51123         ser_ref.datalen = ser->arr_len;
51124         ser_ref.data = ser->elems;
51125         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
51126         *ret_conv = CommitmentSigned_read(ser_ref);
51127         FREE(ser);
51128         return tag_ptr(ret_conv, true);
51129 }
51130
51131 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
51132         LDKFundingCreated obj_conv;
51133         obj_conv.inner = untag_ptr(obj);
51134         obj_conv.is_owned = ptr_is_owned(obj);
51135         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51136         obj_conv.is_owned = false;
51137         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
51138         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51139         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51140         CVec_u8Z_free(ret_var);
51141         return ret_arr;
51142 }
51143
51144 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
51145         LDKu8slice ser_ref;
51146         ser_ref.datalen = ser->arr_len;
51147         ser_ref.data = ser->elems;
51148         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
51149         *ret_conv = FundingCreated_read(ser_ref);
51150         FREE(ser);
51151         return tag_ptr(ret_conv, true);
51152 }
51153
51154 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
51155         LDKFundingSigned obj_conv;
51156         obj_conv.inner = untag_ptr(obj);
51157         obj_conv.is_owned = ptr_is_owned(obj);
51158         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51159         obj_conv.is_owned = false;
51160         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
51161         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51162         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51163         CVec_u8Z_free(ret_var);
51164         return ret_arr;
51165 }
51166
51167 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
51168         LDKu8slice ser_ref;
51169         ser_ref.datalen = ser->arr_len;
51170         ser_ref.data = ser->elems;
51171         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
51172         *ret_conv = FundingSigned_read(ser_ref);
51173         FREE(ser);
51174         return tag_ptr(ret_conv, true);
51175 }
51176
51177 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
51178         LDKChannelReady obj_conv;
51179         obj_conv.inner = untag_ptr(obj);
51180         obj_conv.is_owned = ptr_is_owned(obj);
51181         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51182         obj_conv.is_owned = false;
51183         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
51184         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51185         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51186         CVec_u8Z_free(ret_var);
51187         return ret_arr;
51188 }
51189
51190 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
51191         LDKu8slice ser_ref;
51192         ser_ref.datalen = ser->arr_len;
51193         ser_ref.data = ser->elems;
51194         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
51195         *ret_conv = ChannelReady_read(ser_ref);
51196         FREE(ser);
51197         return tag_ptr(ret_conv, true);
51198 }
51199
51200 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
51201         LDKInit obj_conv;
51202         obj_conv.inner = untag_ptr(obj);
51203         obj_conv.is_owned = ptr_is_owned(obj);
51204         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51205         obj_conv.is_owned = false;
51206         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
51207         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51208         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51209         CVec_u8Z_free(ret_var);
51210         return ret_arr;
51211 }
51212
51213 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
51214         LDKu8slice ser_ref;
51215         ser_ref.datalen = ser->arr_len;
51216         ser_ref.data = ser->elems;
51217         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
51218         *ret_conv = Init_read(ser_ref);
51219         FREE(ser);
51220         return tag_ptr(ret_conv, true);
51221 }
51222
51223 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
51224         LDKOpenChannel obj_conv;
51225         obj_conv.inner = untag_ptr(obj);
51226         obj_conv.is_owned = ptr_is_owned(obj);
51227         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51228         obj_conv.is_owned = false;
51229         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
51230         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51231         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51232         CVec_u8Z_free(ret_var);
51233         return ret_arr;
51234 }
51235
51236 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
51237         LDKu8slice ser_ref;
51238         ser_ref.datalen = ser->arr_len;
51239         ser_ref.data = ser->elems;
51240         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
51241         *ret_conv = OpenChannel_read(ser_ref);
51242         FREE(ser);
51243         return tag_ptr(ret_conv, true);
51244 }
51245
51246 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_write"))) TS_OpenChannelV2_write(uint64_t obj) {
51247         LDKOpenChannelV2 obj_conv;
51248         obj_conv.inner = untag_ptr(obj);
51249         obj_conv.is_owned = ptr_is_owned(obj);
51250         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51251         obj_conv.is_owned = false;
51252         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
51253         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51254         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51255         CVec_u8Z_free(ret_var);
51256         return ret_arr;
51257 }
51258
51259 uint64_t  __attribute__((export_name("TS_OpenChannelV2_read"))) TS_OpenChannelV2_read(int8_tArray ser) {
51260         LDKu8slice ser_ref;
51261         ser_ref.datalen = ser->arr_len;
51262         ser_ref.data = ser->elems;
51263         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
51264         *ret_conv = OpenChannelV2_read(ser_ref);
51265         FREE(ser);
51266         return tag_ptr(ret_conv, true);
51267 }
51268
51269 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
51270         LDKRevokeAndACK obj_conv;
51271         obj_conv.inner = untag_ptr(obj);
51272         obj_conv.is_owned = ptr_is_owned(obj);
51273         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51274         obj_conv.is_owned = false;
51275         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
51276         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51277         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51278         CVec_u8Z_free(ret_var);
51279         return ret_arr;
51280 }
51281
51282 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
51283         LDKu8slice ser_ref;
51284         ser_ref.datalen = ser->arr_len;
51285         ser_ref.data = ser->elems;
51286         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
51287         *ret_conv = RevokeAndACK_read(ser_ref);
51288         FREE(ser);
51289         return tag_ptr(ret_conv, true);
51290 }
51291
51292 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
51293         LDKShutdown obj_conv;
51294         obj_conv.inner = untag_ptr(obj);
51295         obj_conv.is_owned = ptr_is_owned(obj);
51296         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51297         obj_conv.is_owned = false;
51298         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
51299         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51300         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51301         CVec_u8Z_free(ret_var);
51302         return ret_arr;
51303 }
51304
51305 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
51306         LDKu8slice ser_ref;
51307         ser_ref.datalen = ser->arr_len;
51308         ser_ref.data = ser->elems;
51309         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
51310         *ret_conv = Shutdown_read(ser_ref);
51311         FREE(ser);
51312         return tag_ptr(ret_conv, true);
51313 }
51314
51315 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
51316         LDKUpdateFailHTLC obj_conv;
51317         obj_conv.inner = untag_ptr(obj);
51318         obj_conv.is_owned = ptr_is_owned(obj);
51319         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51320         obj_conv.is_owned = false;
51321         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
51322         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51323         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51324         CVec_u8Z_free(ret_var);
51325         return ret_arr;
51326 }
51327
51328 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
51329         LDKu8slice ser_ref;
51330         ser_ref.datalen = ser->arr_len;
51331         ser_ref.data = ser->elems;
51332         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
51333         *ret_conv = UpdateFailHTLC_read(ser_ref);
51334         FREE(ser);
51335         return tag_ptr(ret_conv, true);
51336 }
51337
51338 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
51339         LDKUpdateFailMalformedHTLC obj_conv;
51340         obj_conv.inner = untag_ptr(obj);
51341         obj_conv.is_owned = ptr_is_owned(obj);
51342         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51343         obj_conv.is_owned = false;
51344         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
51345         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51346         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51347         CVec_u8Z_free(ret_var);
51348         return ret_arr;
51349 }
51350
51351 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
51352         LDKu8slice ser_ref;
51353         ser_ref.datalen = ser->arr_len;
51354         ser_ref.data = ser->elems;
51355         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
51356         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
51357         FREE(ser);
51358         return tag_ptr(ret_conv, true);
51359 }
51360
51361 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
51362         LDKUpdateFee obj_conv;
51363         obj_conv.inner = untag_ptr(obj);
51364         obj_conv.is_owned = ptr_is_owned(obj);
51365         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51366         obj_conv.is_owned = false;
51367         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
51368         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51369         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51370         CVec_u8Z_free(ret_var);
51371         return ret_arr;
51372 }
51373
51374 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
51375         LDKu8slice ser_ref;
51376         ser_ref.datalen = ser->arr_len;
51377         ser_ref.data = ser->elems;
51378         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
51379         *ret_conv = UpdateFee_read(ser_ref);
51380         FREE(ser);
51381         return tag_ptr(ret_conv, true);
51382 }
51383
51384 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
51385         LDKUpdateFulfillHTLC obj_conv;
51386         obj_conv.inner = untag_ptr(obj);
51387         obj_conv.is_owned = ptr_is_owned(obj);
51388         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51389         obj_conv.is_owned = false;
51390         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
51391         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51392         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51393         CVec_u8Z_free(ret_var);
51394         return ret_arr;
51395 }
51396
51397 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
51398         LDKu8slice ser_ref;
51399         ser_ref.datalen = ser->arr_len;
51400         ser_ref.data = ser->elems;
51401         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
51402         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
51403         FREE(ser);
51404         return tag_ptr(ret_conv, true);
51405 }
51406
51407 int8_tArray  __attribute__((export_name("TS_OnionPacket_write"))) TS_OnionPacket_write(uint64_t obj) {
51408         LDKOnionPacket obj_conv;
51409         obj_conv.inner = untag_ptr(obj);
51410         obj_conv.is_owned = ptr_is_owned(obj);
51411         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51412         obj_conv.is_owned = false;
51413         LDKCVec_u8Z ret_var = OnionPacket_write(&obj_conv);
51414         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51415         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51416         CVec_u8Z_free(ret_var);
51417         return ret_arr;
51418 }
51419
51420 uint64_t  __attribute__((export_name("TS_OnionPacket_read"))) TS_OnionPacket_read(int8_tArray ser) {
51421         LDKu8slice ser_ref;
51422         ser_ref.datalen = ser->arr_len;
51423         ser_ref.data = ser->elems;
51424         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
51425         *ret_conv = OnionPacket_read(ser_ref);
51426         FREE(ser);
51427         return tag_ptr(ret_conv, true);
51428 }
51429
51430 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
51431         LDKUpdateAddHTLC obj_conv;
51432         obj_conv.inner = untag_ptr(obj);
51433         obj_conv.is_owned = ptr_is_owned(obj);
51434         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51435         obj_conv.is_owned = false;
51436         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
51437         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51438         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51439         CVec_u8Z_free(ret_var);
51440         return ret_arr;
51441 }
51442
51443 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
51444         LDKu8slice ser_ref;
51445         ser_ref.datalen = ser->arr_len;
51446         ser_ref.data = ser->elems;
51447         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
51448         *ret_conv = UpdateAddHTLC_read(ser_ref);
51449         FREE(ser);
51450         return tag_ptr(ret_conv, true);
51451 }
51452
51453 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
51454         LDKu8slice ser_ref;
51455         ser_ref.datalen = ser->arr_len;
51456         ser_ref.data = ser->elems;
51457         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
51458         *ret_conv = OnionMessage_read(ser_ref);
51459         FREE(ser);
51460         return tag_ptr(ret_conv, true);
51461 }
51462
51463 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
51464         LDKOnionMessage obj_conv;
51465         obj_conv.inner = untag_ptr(obj);
51466         obj_conv.is_owned = ptr_is_owned(obj);
51467         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51468         obj_conv.is_owned = false;
51469         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
51470         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51471         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51472         CVec_u8Z_free(ret_var);
51473         return ret_arr;
51474 }
51475
51476 int8_tArray  __attribute__((export_name("TS_FinalOnionHopData_write"))) TS_FinalOnionHopData_write(uint64_t obj) {
51477         LDKFinalOnionHopData obj_conv;
51478         obj_conv.inner = untag_ptr(obj);
51479         obj_conv.is_owned = ptr_is_owned(obj);
51480         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51481         obj_conv.is_owned = false;
51482         LDKCVec_u8Z ret_var = FinalOnionHopData_write(&obj_conv);
51483         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51484         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51485         CVec_u8Z_free(ret_var);
51486         return ret_arr;
51487 }
51488
51489 uint64_t  __attribute__((export_name("TS_FinalOnionHopData_read"))) TS_FinalOnionHopData_read(int8_tArray ser) {
51490         LDKu8slice ser_ref;
51491         ser_ref.datalen = ser->arr_len;
51492         ser_ref.data = ser->elems;
51493         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
51494         *ret_conv = FinalOnionHopData_read(ser_ref);
51495         FREE(ser);
51496         return tag_ptr(ret_conv, true);
51497 }
51498
51499 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
51500         LDKPing obj_conv;
51501         obj_conv.inner = untag_ptr(obj);
51502         obj_conv.is_owned = ptr_is_owned(obj);
51503         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51504         obj_conv.is_owned = false;
51505         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
51506         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51507         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51508         CVec_u8Z_free(ret_var);
51509         return ret_arr;
51510 }
51511
51512 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
51513         LDKu8slice ser_ref;
51514         ser_ref.datalen = ser->arr_len;
51515         ser_ref.data = ser->elems;
51516         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
51517         *ret_conv = Ping_read(ser_ref);
51518         FREE(ser);
51519         return tag_ptr(ret_conv, true);
51520 }
51521
51522 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
51523         LDKPong obj_conv;
51524         obj_conv.inner = untag_ptr(obj);
51525         obj_conv.is_owned = ptr_is_owned(obj);
51526         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51527         obj_conv.is_owned = false;
51528         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
51529         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51530         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51531         CVec_u8Z_free(ret_var);
51532         return ret_arr;
51533 }
51534
51535 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
51536         LDKu8slice ser_ref;
51537         ser_ref.datalen = ser->arr_len;
51538         ser_ref.data = ser->elems;
51539         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
51540         *ret_conv = Pong_read(ser_ref);
51541         FREE(ser);
51542         return tag_ptr(ret_conv, true);
51543 }
51544
51545 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
51546         LDKUnsignedChannelAnnouncement obj_conv;
51547         obj_conv.inner = untag_ptr(obj);
51548         obj_conv.is_owned = ptr_is_owned(obj);
51549         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51550         obj_conv.is_owned = false;
51551         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
51552         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51553         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51554         CVec_u8Z_free(ret_var);
51555         return ret_arr;
51556 }
51557
51558 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
51559         LDKu8slice ser_ref;
51560         ser_ref.datalen = ser->arr_len;
51561         ser_ref.data = ser->elems;
51562         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
51563         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
51564         FREE(ser);
51565         return tag_ptr(ret_conv, true);
51566 }
51567
51568 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
51569         LDKChannelAnnouncement obj_conv;
51570         obj_conv.inner = untag_ptr(obj);
51571         obj_conv.is_owned = ptr_is_owned(obj);
51572         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51573         obj_conv.is_owned = false;
51574         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
51575         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51576         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51577         CVec_u8Z_free(ret_var);
51578         return ret_arr;
51579 }
51580
51581 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
51582         LDKu8slice ser_ref;
51583         ser_ref.datalen = ser->arr_len;
51584         ser_ref.data = ser->elems;
51585         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
51586         *ret_conv = ChannelAnnouncement_read(ser_ref);
51587         FREE(ser);
51588         return tag_ptr(ret_conv, true);
51589 }
51590
51591 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
51592         LDKUnsignedChannelUpdate obj_conv;
51593         obj_conv.inner = untag_ptr(obj);
51594         obj_conv.is_owned = ptr_is_owned(obj);
51595         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51596         obj_conv.is_owned = false;
51597         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
51598         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51599         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51600         CVec_u8Z_free(ret_var);
51601         return ret_arr;
51602 }
51603
51604 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
51605         LDKu8slice ser_ref;
51606         ser_ref.datalen = ser->arr_len;
51607         ser_ref.data = ser->elems;
51608         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
51609         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
51610         FREE(ser);
51611         return tag_ptr(ret_conv, true);
51612 }
51613
51614 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
51615         LDKChannelUpdate obj_conv;
51616         obj_conv.inner = untag_ptr(obj);
51617         obj_conv.is_owned = ptr_is_owned(obj);
51618         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51619         obj_conv.is_owned = false;
51620         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
51621         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51622         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51623         CVec_u8Z_free(ret_var);
51624         return ret_arr;
51625 }
51626
51627 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
51628         LDKu8slice ser_ref;
51629         ser_ref.datalen = ser->arr_len;
51630         ser_ref.data = ser->elems;
51631         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
51632         *ret_conv = ChannelUpdate_read(ser_ref);
51633         FREE(ser);
51634         return tag_ptr(ret_conv, true);
51635 }
51636
51637 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
51638         LDKErrorMessage obj_conv;
51639         obj_conv.inner = untag_ptr(obj);
51640         obj_conv.is_owned = ptr_is_owned(obj);
51641         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51642         obj_conv.is_owned = false;
51643         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
51644         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51645         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51646         CVec_u8Z_free(ret_var);
51647         return ret_arr;
51648 }
51649
51650 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
51651         LDKu8slice ser_ref;
51652         ser_ref.datalen = ser->arr_len;
51653         ser_ref.data = ser->elems;
51654         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
51655         *ret_conv = ErrorMessage_read(ser_ref);
51656         FREE(ser);
51657         return tag_ptr(ret_conv, true);
51658 }
51659
51660 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
51661         LDKWarningMessage obj_conv;
51662         obj_conv.inner = untag_ptr(obj);
51663         obj_conv.is_owned = ptr_is_owned(obj);
51664         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51665         obj_conv.is_owned = false;
51666         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
51667         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51668         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51669         CVec_u8Z_free(ret_var);
51670         return ret_arr;
51671 }
51672
51673 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
51674         LDKu8slice ser_ref;
51675         ser_ref.datalen = ser->arr_len;
51676         ser_ref.data = ser->elems;
51677         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
51678         *ret_conv = WarningMessage_read(ser_ref);
51679         FREE(ser);
51680         return tag_ptr(ret_conv, true);
51681 }
51682
51683 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
51684         LDKUnsignedNodeAnnouncement obj_conv;
51685         obj_conv.inner = untag_ptr(obj);
51686         obj_conv.is_owned = ptr_is_owned(obj);
51687         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51688         obj_conv.is_owned = false;
51689         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
51690         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51691         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51692         CVec_u8Z_free(ret_var);
51693         return ret_arr;
51694 }
51695
51696 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
51697         LDKu8slice ser_ref;
51698         ser_ref.datalen = ser->arr_len;
51699         ser_ref.data = ser->elems;
51700         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
51701         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
51702         FREE(ser);
51703         return tag_ptr(ret_conv, true);
51704 }
51705
51706 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
51707         LDKNodeAnnouncement obj_conv;
51708         obj_conv.inner = untag_ptr(obj);
51709         obj_conv.is_owned = ptr_is_owned(obj);
51710         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51711         obj_conv.is_owned = false;
51712         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
51713         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51714         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51715         CVec_u8Z_free(ret_var);
51716         return ret_arr;
51717 }
51718
51719 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
51720         LDKu8slice ser_ref;
51721         ser_ref.datalen = ser->arr_len;
51722         ser_ref.data = ser->elems;
51723         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
51724         *ret_conv = NodeAnnouncement_read(ser_ref);
51725         FREE(ser);
51726         return tag_ptr(ret_conv, true);
51727 }
51728
51729 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
51730         LDKu8slice ser_ref;
51731         ser_ref.datalen = ser->arr_len;
51732         ser_ref.data = ser->elems;
51733         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
51734         *ret_conv = QueryShortChannelIds_read(ser_ref);
51735         FREE(ser);
51736         return tag_ptr(ret_conv, true);
51737 }
51738
51739 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
51740         LDKQueryShortChannelIds obj_conv;
51741         obj_conv.inner = untag_ptr(obj);
51742         obj_conv.is_owned = ptr_is_owned(obj);
51743         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51744         obj_conv.is_owned = false;
51745         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
51746         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51747         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51748         CVec_u8Z_free(ret_var);
51749         return ret_arr;
51750 }
51751
51752 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
51753         LDKReplyShortChannelIdsEnd obj_conv;
51754         obj_conv.inner = untag_ptr(obj);
51755         obj_conv.is_owned = ptr_is_owned(obj);
51756         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51757         obj_conv.is_owned = false;
51758         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
51759         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51760         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51761         CVec_u8Z_free(ret_var);
51762         return ret_arr;
51763 }
51764
51765 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
51766         LDKu8slice ser_ref;
51767         ser_ref.datalen = ser->arr_len;
51768         ser_ref.data = ser->elems;
51769         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
51770         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
51771         FREE(ser);
51772         return tag_ptr(ret_conv, true);
51773 }
51774
51775 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
51776         LDKQueryChannelRange this_arg_conv;
51777         this_arg_conv.inner = untag_ptr(this_arg);
51778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51780         this_arg_conv.is_owned = false;
51781         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
51782         return ret_conv;
51783 }
51784
51785 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
51786         LDKQueryChannelRange obj_conv;
51787         obj_conv.inner = untag_ptr(obj);
51788         obj_conv.is_owned = ptr_is_owned(obj);
51789         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51790         obj_conv.is_owned = false;
51791         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
51792         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51793         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51794         CVec_u8Z_free(ret_var);
51795         return ret_arr;
51796 }
51797
51798 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
51799         LDKu8slice ser_ref;
51800         ser_ref.datalen = ser->arr_len;
51801         ser_ref.data = ser->elems;
51802         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
51803         *ret_conv = QueryChannelRange_read(ser_ref);
51804         FREE(ser);
51805         return tag_ptr(ret_conv, true);
51806 }
51807
51808 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
51809         LDKu8slice ser_ref;
51810         ser_ref.datalen = ser->arr_len;
51811         ser_ref.data = ser->elems;
51812         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
51813         *ret_conv = ReplyChannelRange_read(ser_ref);
51814         FREE(ser);
51815         return tag_ptr(ret_conv, true);
51816 }
51817
51818 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
51819         LDKReplyChannelRange obj_conv;
51820         obj_conv.inner = untag_ptr(obj);
51821         obj_conv.is_owned = ptr_is_owned(obj);
51822         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51823         obj_conv.is_owned = false;
51824         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
51825         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51826         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51827         CVec_u8Z_free(ret_var);
51828         return ret_arr;
51829 }
51830
51831 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
51832         LDKGossipTimestampFilter obj_conv;
51833         obj_conv.inner = untag_ptr(obj);
51834         obj_conv.is_owned = ptr_is_owned(obj);
51835         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51836         obj_conv.is_owned = false;
51837         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
51838         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51839         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51840         CVec_u8Z_free(ret_var);
51841         return ret_arr;
51842 }
51843
51844 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
51845         LDKu8slice ser_ref;
51846         ser_ref.datalen = ser->arr_len;
51847         ser_ref.data = ser->elems;
51848         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
51849         *ret_conv = GossipTimestampFilter_read(ser_ref);
51850         FREE(ser);
51851         return tag_ptr(ret_conv, true);
51852 }
51853
51854 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
51855         if (!ptr_is_owned(this_ptr)) return;
51856         void* this_ptr_ptr = untag_ptr(this_ptr);
51857         CHECK_ACCESS(this_ptr_ptr);
51858         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
51859         FREE(untag_ptr(this_ptr));
51860         CustomMessageHandler_free(this_ptr_conv);
51861 }
51862
51863 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
51864         LDKIgnoringMessageHandler this_obj_conv;
51865         this_obj_conv.inner = untag_ptr(this_obj);
51866         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51868         IgnoringMessageHandler_free(this_obj_conv);
51869 }
51870
51871 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
51872         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
51873         uint64_t ret_ref = 0;
51874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51876         return ret_ref;
51877 }
51878
51879 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_EventsProvider"))) TS_IgnoringMessageHandler_as_EventsProvider(uint64_t this_arg) {
51880         LDKIgnoringMessageHandler this_arg_conv;
51881         this_arg_conv.inner = untag_ptr(this_arg);
51882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51884         this_arg_conv.is_owned = false;
51885         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
51886         *ret_ret = IgnoringMessageHandler_as_EventsProvider(&this_arg_conv);
51887         return tag_ptr(ret_ret, true);
51888 }
51889
51890 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
51891         LDKIgnoringMessageHandler this_arg_conv;
51892         this_arg_conv.inner = untag_ptr(this_arg);
51893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51895         this_arg_conv.is_owned = false;
51896         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
51897         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
51898         return tag_ptr(ret_ret, true);
51899 }
51900
51901 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
51902         LDKIgnoringMessageHandler this_arg_conv;
51903         this_arg_conv.inner = untag_ptr(this_arg);
51904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51906         this_arg_conv.is_owned = false;
51907         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
51908         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
51909         return tag_ptr(ret_ret, true);
51910 }
51911
51912 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
51913         LDKIgnoringMessageHandler this_arg_conv;
51914         this_arg_conv.inner = untag_ptr(this_arg);
51915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51917         this_arg_conv.is_owned = false;
51918         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
51919         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
51920         return tag_ptr(ret_ret, true);
51921 }
51922
51923 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OffersMessageHandler"))) TS_IgnoringMessageHandler_as_OffersMessageHandler(uint64_t this_arg) {
51924         LDKIgnoringMessageHandler this_arg_conv;
51925         this_arg_conv.inner = untag_ptr(this_arg);
51926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51928         this_arg_conv.is_owned = false;
51929         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
51930         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
51931         return tag_ptr(ret_ret, true);
51932 }
51933
51934 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
51935         LDKIgnoringMessageHandler this_arg_conv;
51936         this_arg_conv.inner = untag_ptr(this_arg);
51937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51939         this_arg_conv.is_owned = false;
51940         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
51941         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
51942         return tag_ptr(ret_ret, true);
51943 }
51944
51945 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
51946         LDKIgnoringMessageHandler this_arg_conv;
51947         this_arg_conv.inner = untag_ptr(this_arg);
51948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51950         this_arg_conv.is_owned = false;
51951         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
51952         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
51953         return tag_ptr(ret_ret, true);
51954 }
51955
51956 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
51957         LDKIgnoringMessageHandler this_arg_conv;
51958         this_arg_conv.inner = untag_ptr(this_arg);
51959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51961         this_arg_conv.is_owned = false;
51962         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
51963         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
51964         return tag_ptr(ret_ret, true);
51965 }
51966
51967 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
51968         LDKErroringMessageHandler this_obj_conv;
51969         this_obj_conv.inner = untag_ptr(this_obj);
51970         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51972         ErroringMessageHandler_free(this_obj_conv);
51973 }
51974
51975 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
51976         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
51977         uint64_t ret_ref = 0;
51978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51980         return ret_ref;
51981 }
51982
51983 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
51984         LDKErroringMessageHandler this_arg_conv;
51985         this_arg_conv.inner = untag_ptr(this_arg);
51986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51988         this_arg_conv.is_owned = false;
51989         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
51990         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
51991         return tag_ptr(ret_ret, true);
51992 }
51993
51994 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
51995         LDKErroringMessageHandler this_arg_conv;
51996         this_arg_conv.inner = untag_ptr(this_arg);
51997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51999         this_arg_conv.is_owned = false;
52000         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
52001         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
52002         return tag_ptr(ret_ret, true);
52003 }
52004
52005 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
52006         LDKMessageHandler this_obj_conv;
52007         this_obj_conv.inner = untag_ptr(this_obj);
52008         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52010         MessageHandler_free(this_obj_conv);
52011 }
52012
52013 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
52014         LDKMessageHandler this_ptr_conv;
52015         this_ptr_conv.inner = untag_ptr(this_ptr);
52016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52018         this_ptr_conv.is_owned = false;
52019         // WARNING: This object doesn't live past this scope, needs clone!
52020         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
52021         return ret_ret;
52022 }
52023
52024 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
52025         LDKMessageHandler this_ptr_conv;
52026         this_ptr_conv.inner = untag_ptr(this_ptr);
52027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52029         this_ptr_conv.is_owned = false;
52030         void* val_ptr = untag_ptr(val);
52031         CHECK_ACCESS(val_ptr);
52032         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
52033         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
52034                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52035                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
52036         }
52037         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
52038 }
52039
52040 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
52041         LDKMessageHandler this_ptr_conv;
52042         this_ptr_conv.inner = untag_ptr(this_ptr);
52043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52045         this_ptr_conv.is_owned = false;
52046         // WARNING: This object doesn't live past this scope, needs clone!
52047         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
52048         return ret_ret;
52049 }
52050
52051 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
52052         LDKMessageHandler this_ptr_conv;
52053         this_ptr_conv.inner = untag_ptr(this_ptr);
52054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52056         this_ptr_conv.is_owned = false;
52057         void* val_ptr = untag_ptr(val);
52058         CHECK_ACCESS(val_ptr);
52059         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
52060         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
52061                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52062                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
52063         }
52064         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
52065 }
52066
52067 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
52068         LDKMessageHandler this_ptr_conv;
52069         this_ptr_conv.inner = untag_ptr(this_ptr);
52070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52072         this_ptr_conv.is_owned = false;
52073         // WARNING: This object doesn't live past this scope, needs clone!
52074         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
52075         return ret_ret;
52076 }
52077
52078 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
52079         LDKMessageHandler this_ptr_conv;
52080         this_ptr_conv.inner = untag_ptr(this_ptr);
52081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52083         this_ptr_conv.is_owned = false;
52084         void* val_ptr = untag_ptr(val);
52085         CHECK_ACCESS(val_ptr);
52086         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
52087         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
52088                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52089                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
52090         }
52091         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
52092 }
52093
52094 uint64_t  __attribute__((export_name("TS_MessageHandler_get_custom_message_handler"))) TS_MessageHandler_get_custom_message_handler(uint64_t this_ptr) {
52095         LDKMessageHandler this_ptr_conv;
52096         this_ptr_conv.inner = untag_ptr(this_ptr);
52097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52099         this_ptr_conv.is_owned = false;
52100         // WARNING: This object doesn't live past this scope, needs clone!
52101         uint64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
52102         return ret_ret;
52103 }
52104
52105 void  __attribute__((export_name("TS_MessageHandler_set_custom_message_handler"))) TS_MessageHandler_set_custom_message_handler(uint64_t this_ptr, uint64_t val) {
52106         LDKMessageHandler this_ptr_conv;
52107         this_ptr_conv.inner = untag_ptr(this_ptr);
52108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52110         this_ptr_conv.is_owned = false;
52111         void* val_ptr = untag_ptr(val);
52112         CHECK_ACCESS(val_ptr);
52113         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
52114         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
52115                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52116                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
52117         }
52118         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
52119 }
52120
52121 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) {
52122         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
52123         CHECK_ACCESS(chan_handler_arg_ptr);
52124         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
52125         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
52126                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52127                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
52128         }
52129         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
52130         CHECK_ACCESS(route_handler_arg_ptr);
52131         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
52132         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
52133                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52134                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
52135         }
52136         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
52137         CHECK_ACCESS(onion_message_handler_arg_ptr);
52138         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
52139         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
52140                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52141                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
52142         }
52143         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
52144         CHECK_ACCESS(custom_message_handler_arg_ptr);
52145         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
52146         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
52147                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52148                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
52149         }
52150         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
52151         uint64_t ret_ref = 0;
52152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52154         return ret_ref;
52155 }
52156
52157 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
52158         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
52159         *ret_ret = SocketDescriptor_clone(arg);
52160         return tag_ptr(ret_ret, true);
52161 }
52162 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
52163         void* arg_ptr = untag_ptr(arg);
52164         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
52165         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
52166         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
52167         return ret_conv;
52168 }
52169
52170 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
52171         void* orig_ptr = untag_ptr(orig);
52172         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
52173         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
52174         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
52175         *ret_ret = SocketDescriptor_clone(orig_conv);
52176         return tag_ptr(ret_ret, true);
52177 }
52178
52179 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
52180         if (!ptr_is_owned(this_ptr)) return;
52181         void* this_ptr_ptr = untag_ptr(this_ptr);
52182         CHECK_ACCESS(this_ptr_ptr);
52183         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
52184         FREE(untag_ptr(this_ptr));
52185         SocketDescriptor_free(this_ptr_conv);
52186 }
52187
52188 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
52189         LDKPeerHandleError this_obj_conv;
52190         this_obj_conv.inner = untag_ptr(this_obj);
52191         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52193         PeerHandleError_free(this_obj_conv);
52194 }
52195
52196 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new() {
52197         LDKPeerHandleError ret_var = PeerHandleError_new();
52198         uint64_t ret_ref = 0;
52199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52201         return ret_ref;
52202 }
52203
52204 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
52205         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
52206         uint64_t ret_ref = 0;
52207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52209         return ret_ref;
52210 }
52211 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
52212         LDKPeerHandleError arg_conv;
52213         arg_conv.inner = untag_ptr(arg);
52214         arg_conv.is_owned = ptr_is_owned(arg);
52215         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52216         arg_conv.is_owned = false;
52217         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
52218         return ret_conv;
52219 }
52220
52221 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
52222         LDKPeerHandleError orig_conv;
52223         orig_conv.inner = untag_ptr(orig);
52224         orig_conv.is_owned = ptr_is_owned(orig);
52225         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52226         orig_conv.is_owned = false;
52227         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
52228         uint64_t ret_ref = 0;
52229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52231         return ret_ref;
52232 }
52233
52234 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
52235         LDKPeerManager this_obj_conv;
52236         this_obj_conv.inner = untag_ptr(this_obj);
52237         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52239         PeerManager_free(this_obj_conv);
52240 }
52241
52242 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) {
52243         LDKMessageHandler message_handler_conv;
52244         message_handler_conv.inner = untag_ptr(message_handler);
52245         message_handler_conv.is_owned = ptr_is_owned(message_handler);
52246         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
52247         // WARNING: we need a move here but no clone is available for LDKMessageHandler
52248         
52249         uint8_t ephemeral_random_data_arr[32];
52250         CHECK(ephemeral_random_data->arr_len == 32);
52251         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
52252         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
52253         void* logger_ptr = untag_ptr(logger);
52254         CHECK_ACCESS(logger_ptr);
52255         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
52256         if (logger_conv.free == LDKLogger_JCalls_free) {
52257                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52258                 LDKLogger_JCalls_cloned(&logger_conv);
52259         }
52260         void* node_signer_ptr = untag_ptr(node_signer);
52261         CHECK_ACCESS(node_signer_ptr);
52262         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
52263         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
52264                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52265                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
52266         }
52267         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
52268         uint64_t ret_ref = 0;
52269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52271         return ret_ref;
52272 }
52273
52274 uint64_tArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
52275         LDKPeerManager this_arg_conv;
52276         this_arg_conv.inner = untag_ptr(this_arg);
52277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52279         this_arg_conv.is_owned = false;
52280         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
52281         uint64_tArray ret_arr = NULL;
52282         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
52283         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
52284         for (size_t r = 0; r < ret_var.datalen; r++) {
52285                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv_43_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
52286                 *ret_conv_43_conv = ret_var.data[r];
52287                 ret_arr_ptr[r] = tag_ptr(ret_conv_43_conv, true);
52288         }
52289         
52290         FREE(ret_var.data);
52291         return ret_arr;
52292 }
52293
52294 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) {
52295         LDKPeerManager this_arg_conv;
52296         this_arg_conv.inner = untag_ptr(this_arg);
52297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52299         this_arg_conv.is_owned = false;
52300         LDKPublicKey their_node_id_ref;
52301         CHECK(their_node_id->arr_len == 33);
52302         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
52303         void* descriptor_ptr = untag_ptr(descriptor);
52304         CHECK_ACCESS(descriptor_ptr);
52305         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
52306         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
52307                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52308                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
52309         }
52310         void* remote_network_address_ptr = untag_ptr(remote_network_address);
52311         CHECK_ACCESS(remote_network_address_ptr);
52312         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
52313         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
52314         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
52315         return tag_ptr(ret_conv, true);
52316 }
52317
52318 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) {
52319         LDKPeerManager this_arg_conv;
52320         this_arg_conv.inner = untag_ptr(this_arg);
52321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52323         this_arg_conv.is_owned = false;
52324         void* descriptor_ptr = untag_ptr(descriptor);
52325         CHECK_ACCESS(descriptor_ptr);
52326         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
52327         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
52328                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52329                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
52330         }
52331         void* remote_network_address_ptr = untag_ptr(remote_network_address);
52332         CHECK_ACCESS(remote_network_address_ptr);
52333         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
52334         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
52335         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
52336         return tag_ptr(ret_conv, true);
52337 }
52338
52339 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
52340         LDKPeerManager this_arg_conv;
52341         this_arg_conv.inner = untag_ptr(this_arg);
52342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52344         this_arg_conv.is_owned = false;
52345         void* descriptor_ptr = untag_ptr(descriptor);
52346         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
52347         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
52348         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
52349         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
52350         return tag_ptr(ret_conv, true);
52351 }
52352
52353 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
52354         LDKPeerManager this_arg_conv;
52355         this_arg_conv.inner = untag_ptr(this_arg);
52356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52358         this_arg_conv.is_owned = false;
52359         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
52360         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
52361         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
52362         LDKu8slice data_ref;
52363         data_ref.datalen = data->arr_len;
52364         data_ref.data = data->elems;
52365         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
52366         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
52367         FREE(data);
52368         return tag_ptr(ret_conv, true);
52369 }
52370
52371 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
52372         LDKPeerManager this_arg_conv;
52373         this_arg_conv.inner = untag_ptr(this_arg);
52374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52376         this_arg_conv.is_owned = false;
52377         PeerManager_process_events(&this_arg_conv);
52378 }
52379
52380 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
52381         LDKPeerManager this_arg_conv;
52382         this_arg_conv.inner = untag_ptr(this_arg);
52383         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52385         this_arg_conv.is_owned = false;
52386         void* descriptor_ptr = untag_ptr(descriptor);
52387         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
52388         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
52389         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
52390 }
52391
52392 void  __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id) {
52393         LDKPeerManager this_arg_conv;
52394         this_arg_conv.inner = untag_ptr(this_arg);
52395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52397         this_arg_conv.is_owned = false;
52398         LDKPublicKey node_id_ref;
52399         CHECK(node_id->arr_len == 33);
52400         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
52401         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
52402 }
52403
52404 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
52405         LDKPeerManager this_arg_conv;
52406         this_arg_conv.inner = untag_ptr(this_arg);
52407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52409         this_arg_conv.is_owned = false;
52410         PeerManager_disconnect_all_peers(&this_arg_conv);
52411 }
52412
52413 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
52414         LDKPeerManager this_arg_conv;
52415         this_arg_conv.inner = untag_ptr(this_arg);
52416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52418         this_arg_conv.is_owned = false;
52419         PeerManager_timer_tick_occurred(&this_arg_conv);
52420 }
52421
52422 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) {
52423         LDKPeerManager this_arg_conv;
52424         this_arg_conv.inner = untag_ptr(this_arg);
52425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52427         this_arg_conv.is_owned = false;
52428         LDKThreeBytes rgb_ref;
52429         CHECK(rgb->arr_len == 3);
52430         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
52431         LDKThirtyTwoBytes alias_ref;
52432         CHECK(alias->arr_len == 32);
52433         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
52434         LDKCVec_SocketAddressZ addresses_constr;
52435         addresses_constr.datalen = addresses->arr_len;
52436         if (addresses_constr.datalen > 0)
52437                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
52438         else
52439                 addresses_constr.data = NULL;
52440         uint64_t* addresses_vals = addresses->elems;
52441         for (size_t p = 0; p < addresses_constr.datalen; p++) {
52442                 uint64_t addresses_conv_15 = addresses_vals[p];
52443                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
52444                 CHECK_ACCESS(addresses_conv_15_ptr);
52445                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
52446                 addresses_constr.data[p] = addresses_conv_15_conv;
52447         }
52448         FREE(addresses);
52449         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
52450 }
52451
52452 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(uint64_t channel_type_features) {
52453         LDKChannelTypeFeatures channel_type_features_conv;
52454         channel_type_features_conv.inner = untag_ptr(channel_type_features);
52455         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
52456         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
52457         channel_type_features_conv.is_owned = false;
52458         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
52459         return ret_conv;
52460 }
52461
52462 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(uint64_t channel_type_features) {
52463         LDKChannelTypeFeatures channel_type_features_conv;
52464         channel_type_features_conv.inner = untag_ptr(channel_type_features);
52465         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
52466         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
52467         channel_type_features_conv.is_owned = false;
52468         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
52469         return ret_conv;
52470 }
52471
52472 uint32_t  __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) {
52473         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
52474         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv));
52475         return ret_conv;
52476 }
52477
52478 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() {
52479         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout());
52480         return ret_conv;
52481 }
52482
52483 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() {
52484         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage());
52485         return ret_conv;
52486 }
52487
52488 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() {
52489         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout());
52490         return ret_conv;
52491 }
52492
52493 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() {
52494         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage());
52495         return ret_conv;
52496 }
52497
52498 uint32_t  __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() {
52499         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation());
52500         return ret_conv;
52501 }
52502
52503 jboolean  __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) {
52504         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
52505         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
52506         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
52507         return ret_conv;
52508 }
52509
52510 uint64_t  __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) {
52511         LDKWitness witness_ref;
52512         witness_ref.datalen = witness->arr_len;
52513         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
52514         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
52515         witness_ref.data_is_owned = true;
52516         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
52517         *ret_copy = HTLCClaim_from_witness(witness_ref);
52518         uint64_t ret_ref = tag_ptr(ret_copy, true);
52519         return ret_ref;
52520 }
52521
52522 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
52523         uint8_t commitment_seed_arr[32];
52524         CHECK(commitment_seed->arr_len == 32);
52525         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
52526         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
52527         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52528         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
52529         return ret_arr;
52530 }
52531
52532 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) {
52533         LDKCVec_u8Z to_holder_script_ref;
52534         to_holder_script_ref.datalen = to_holder_script->arr_len;
52535         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
52536         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
52537         LDKCVec_u8Z to_counterparty_script_ref;
52538         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
52539         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
52540         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
52541         LDKOutPoint funding_outpoint_conv;
52542         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
52543         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
52544         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
52545         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
52546         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);
52547         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52548         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52549         Transaction_free(ret_var);
52550         return ret_arr;
52551 }
52552
52553 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
52554         LDKCounterpartyCommitmentSecrets this_obj_conv;
52555         this_obj_conv.inner = untag_ptr(this_obj);
52556         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52558         CounterpartyCommitmentSecrets_free(this_obj_conv);
52559 }
52560
52561 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
52562         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
52563         uint64_t ret_ref = 0;
52564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52566         return ret_ref;
52567 }
52568 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
52569         LDKCounterpartyCommitmentSecrets arg_conv;
52570         arg_conv.inner = untag_ptr(arg);
52571         arg_conv.is_owned = ptr_is_owned(arg);
52572         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52573         arg_conv.is_owned = false;
52574         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
52575         return ret_conv;
52576 }
52577
52578 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
52579         LDKCounterpartyCommitmentSecrets orig_conv;
52580         orig_conv.inner = untag_ptr(orig);
52581         orig_conv.is_owned = ptr_is_owned(orig);
52582         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52583         orig_conv.is_owned = false;
52584         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
52585         uint64_t ret_ref = 0;
52586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52588         return ret_ref;
52589 }
52590
52591 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
52592         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
52593         uint64_t ret_ref = 0;
52594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52596         return ret_ref;
52597 }
52598
52599 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
52600         LDKCounterpartyCommitmentSecrets this_arg_conv;
52601         this_arg_conv.inner = untag_ptr(this_arg);
52602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52604         this_arg_conv.is_owned = false;
52605         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
52606         return ret_conv;
52607 }
52608
52609 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
52610         LDKCounterpartyCommitmentSecrets this_arg_conv;
52611         this_arg_conv.inner = untag_ptr(this_arg);
52612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52614         this_arg_conv.is_owned = false;
52615         LDKThirtyTwoBytes secret_ref;
52616         CHECK(secret->arr_len == 32);
52617         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
52618         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52619         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
52620         return tag_ptr(ret_conv, true);
52621 }
52622
52623 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
52624         LDKCounterpartyCommitmentSecrets this_arg_conv;
52625         this_arg_conv.inner = untag_ptr(this_arg);
52626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52628         this_arg_conv.is_owned = false;
52629         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52630         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
52631         return ret_arr;
52632 }
52633
52634 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
52635         LDKCounterpartyCommitmentSecrets obj_conv;
52636         obj_conv.inner = untag_ptr(obj);
52637         obj_conv.is_owned = ptr_is_owned(obj);
52638         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52639         obj_conv.is_owned = false;
52640         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
52641         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52642         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52643         CVec_u8Z_free(ret_var);
52644         return ret_arr;
52645 }
52646
52647 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
52648         LDKu8slice ser_ref;
52649         ser_ref.datalen = ser->arr_len;
52650         ser_ref.data = ser->elems;
52651         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
52652         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
52653         FREE(ser);
52654         return tag_ptr(ret_conv, true);
52655 }
52656
52657 int8_tArray  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
52658         LDKPublicKey per_commitment_point_ref;
52659         CHECK(per_commitment_point->arr_len == 33);
52660         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
52661         uint8_t base_secret_arr[32];
52662         CHECK(base_secret->arr_len == 32);
52663         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
52664         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
52665         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52666         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
52667         return ret_arr;
52668 }
52669
52670 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) {
52671         uint8_t per_commitment_secret_arr[32];
52672         CHECK(per_commitment_secret->arr_len == 32);
52673         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
52674         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
52675         uint8_t countersignatory_revocation_base_secret_arr[32];
52676         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
52677         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
52678         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
52679         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52680         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
52681         return ret_arr;
52682 }
52683
52684 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
52685         LDKTxCreationKeys this_obj_conv;
52686         this_obj_conv.inner = untag_ptr(this_obj);
52687         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52689         TxCreationKeys_free(this_obj_conv);
52690 }
52691
52692 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
52693         LDKTxCreationKeys this_ptr_conv;
52694         this_ptr_conv.inner = untag_ptr(this_ptr);
52695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52697         this_ptr_conv.is_owned = false;
52698         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52699         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
52700         return ret_arr;
52701 }
52702
52703 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
52704         LDKTxCreationKeys this_ptr_conv;
52705         this_ptr_conv.inner = untag_ptr(this_ptr);
52706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52708         this_ptr_conv.is_owned = false;
52709         LDKPublicKey val_ref;
52710         CHECK(val->arr_len == 33);
52711         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
52712         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
52713 }
52714
52715 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
52716         LDKTxCreationKeys this_ptr_conv;
52717         this_ptr_conv.inner = untag_ptr(this_ptr);
52718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52720         this_ptr_conv.is_owned = false;
52721         LDKRevocationKey ret_var = TxCreationKeys_get_revocation_key(&this_ptr_conv);
52722         uint64_t ret_ref = 0;
52723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52725         return ret_ref;
52726 }
52727
52728 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, uint64_t val) {
52729         LDKTxCreationKeys this_ptr_conv;
52730         this_ptr_conv.inner = untag_ptr(this_ptr);
52731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52733         this_ptr_conv.is_owned = false;
52734         LDKRevocationKey val_conv;
52735         val_conv.inner = untag_ptr(val);
52736         val_conv.is_owned = ptr_is_owned(val);
52737         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52738         val_conv = RevocationKey_clone(&val_conv);
52739         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_conv);
52740 }
52741
52742 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
52743         LDKTxCreationKeys this_ptr_conv;
52744         this_ptr_conv.inner = untag_ptr(this_ptr);
52745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52747         this_ptr_conv.is_owned = false;
52748         LDKHtlcKey ret_var = TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv);
52749         uint64_t ret_ref = 0;
52750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52752         return ret_ref;
52753 }
52754
52755 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, uint64_t val) {
52756         LDKTxCreationKeys this_ptr_conv;
52757         this_ptr_conv.inner = untag_ptr(this_ptr);
52758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52760         this_ptr_conv.is_owned = false;
52761         LDKHtlcKey val_conv;
52762         val_conv.inner = untag_ptr(val);
52763         val_conv.is_owned = ptr_is_owned(val);
52764         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52765         val_conv = HtlcKey_clone(&val_conv);
52766         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_conv);
52767 }
52768
52769 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
52770         LDKTxCreationKeys this_ptr_conv;
52771         this_ptr_conv.inner = untag_ptr(this_ptr);
52772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52774         this_ptr_conv.is_owned = false;
52775         LDKHtlcKey ret_var = TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv);
52776         uint64_t ret_ref = 0;
52777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52779         return ret_ref;
52780 }
52781
52782 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, uint64_t val) {
52783         LDKTxCreationKeys this_ptr_conv;
52784         this_ptr_conv.inner = untag_ptr(this_ptr);
52785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52787         this_ptr_conv.is_owned = false;
52788         LDKHtlcKey val_conv;
52789         val_conv.inner = untag_ptr(val);
52790         val_conv.is_owned = ptr_is_owned(val);
52791         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52792         val_conv = HtlcKey_clone(&val_conv);
52793         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_conv);
52794 }
52795
52796 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
52797         LDKTxCreationKeys this_ptr_conv;
52798         this_ptr_conv.inner = untag_ptr(this_ptr);
52799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52801         this_ptr_conv.is_owned = false;
52802         LDKDelayedPaymentKey ret_var = TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv);
52803         uint64_t ret_ref = 0;
52804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52806         return ret_ref;
52807 }
52808
52809 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint64_t this_ptr, uint64_t val) {
52810         LDKTxCreationKeys this_ptr_conv;
52811         this_ptr_conv.inner = untag_ptr(this_ptr);
52812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52814         this_ptr_conv.is_owned = false;
52815         LDKDelayedPaymentKey val_conv;
52816         val_conv.inner = untag_ptr(val);
52817         val_conv.is_owned = ptr_is_owned(val);
52818         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52819         val_conv = DelayedPaymentKey_clone(&val_conv);
52820         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_conv);
52821 }
52822
52823 uint64_t  __attribute__((export_name("TS_TxCreationKeys_new"))) TS_TxCreationKeys_new(int8_tArray per_commitment_point_arg, uint64_t revocation_key_arg, uint64_t broadcaster_htlc_key_arg, uint64_t countersignatory_htlc_key_arg, uint64_t broadcaster_delayed_payment_key_arg) {
52824         LDKPublicKey per_commitment_point_arg_ref;
52825         CHECK(per_commitment_point_arg->arr_len == 33);
52826         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
52827         LDKRevocationKey revocation_key_arg_conv;
52828         revocation_key_arg_conv.inner = untag_ptr(revocation_key_arg);
52829         revocation_key_arg_conv.is_owned = ptr_is_owned(revocation_key_arg);
52830         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_arg_conv);
52831         revocation_key_arg_conv = RevocationKey_clone(&revocation_key_arg_conv);
52832         LDKHtlcKey broadcaster_htlc_key_arg_conv;
52833         broadcaster_htlc_key_arg_conv.inner = untag_ptr(broadcaster_htlc_key_arg);
52834         broadcaster_htlc_key_arg_conv.is_owned = ptr_is_owned(broadcaster_htlc_key_arg);
52835         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_key_arg_conv);
52836         broadcaster_htlc_key_arg_conv = HtlcKey_clone(&broadcaster_htlc_key_arg_conv);
52837         LDKHtlcKey countersignatory_htlc_key_arg_conv;
52838         countersignatory_htlc_key_arg_conv.inner = untag_ptr(countersignatory_htlc_key_arg);
52839         countersignatory_htlc_key_arg_conv.is_owned = ptr_is_owned(countersignatory_htlc_key_arg);
52840         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_key_arg_conv);
52841         countersignatory_htlc_key_arg_conv = HtlcKey_clone(&countersignatory_htlc_key_arg_conv);
52842         LDKDelayedPaymentKey broadcaster_delayed_payment_key_arg_conv;
52843         broadcaster_delayed_payment_key_arg_conv.inner = untag_ptr(broadcaster_delayed_payment_key_arg);
52844         broadcaster_delayed_payment_key_arg_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key_arg);
52845         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_arg_conv);
52846         broadcaster_delayed_payment_key_arg_conv = DelayedPaymentKey_clone(&broadcaster_delayed_payment_key_arg_conv);
52847         LDKTxCreationKeys ret_var = TxCreationKeys_new(per_commitment_point_arg_ref, revocation_key_arg_conv, broadcaster_htlc_key_arg_conv, countersignatory_htlc_key_arg_conv, broadcaster_delayed_payment_key_arg_conv);
52848         uint64_t ret_ref = 0;
52849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52851         return ret_ref;
52852 }
52853
52854 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
52855         LDKTxCreationKeys a_conv;
52856         a_conv.inner = untag_ptr(a);
52857         a_conv.is_owned = ptr_is_owned(a);
52858         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52859         a_conv.is_owned = false;
52860         LDKTxCreationKeys b_conv;
52861         b_conv.inner = untag_ptr(b);
52862         b_conv.is_owned = ptr_is_owned(b);
52863         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52864         b_conv.is_owned = false;
52865         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
52866         return ret_conv;
52867 }
52868
52869 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
52870         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
52871         uint64_t ret_ref = 0;
52872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52874         return ret_ref;
52875 }
52876 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
52877         LDKTxCreationKeys arg_conv;
52878         arg_conv.inner = untag_ptr(arg);
52879         arg_conv.is_owned = ptr_is_owned(arg);
52880         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52881         arg_conv.is_owned = false;
52882         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
52883         return ret_conv;
52884 }
52885
52886 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
52887         LDKTxCreationKeys orig_conv;
52888         orig_conv.inner = untag_ptr(orig);
52889         orig_conv.is_owned = ptr_is_owned(orig);
52890         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52891         orig_conv.is_owned = false;
52892         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
52893         uint64_t ret_ref = 0;
52894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52896         return ret_ref;
52897 }
52898
52899 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
52900         LDKTxCreationKeys obj_conv;
52901         obj_conv.inner = untag_ptr(obj);
52902         obj_conv.is_owned = ptr_is_owned(obj);
52903         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52904         obj_conv.is_owned = false;
52905         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
52906         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52907         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52908         CVec_u8Z_free(ret_var);
52909         return ret_arr;
52910 }
52911
52912 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
52913         LDKu8slice ser_ref;
52914         ser_ref.datalen = ser->arr_len;
52915         ser_ref.data = ser->elems;
52916         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
52917         *ret_conv = TxCreationKeys_read(ser_ref);
52918         FREE(ser);
52919         return tag_ptr(ret_conv, true);
52920 }
52921
52922 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
52923         LDKChannelPublicKeys this_obj_conv;
52924         this_obj_conv.inner = untag_ptr(this_obj);
52925         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52927         ChannelPublicKeys_free(this_obj_conv);
52928 }
52929
52930 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
52931         LDKChannelPublicKeys this_ptr_conv;
52932         this_ptr_conv.inner = untag_ptr(this_ptr);
52933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52935         this_ptr_conv.is_owned = false;
52936         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52937         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
52938         return ret_arr;
52939 }
52940
52941 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
52942         LDKChannelPublicKeys this_ptr_conv;
52943         this_ptr_conv.inner = untag_ptr(this_ptr);
52944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52946         this_ptr_conv.is_owned = false;
52947         LDKPublicKey val_ref;
52948         CHECK(val->arr_len == 33);
52949         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
52950         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
52951 }
52952
52953 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
52954         LDKChannelPublicKeys 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         LDKRevocationBasepoint ret_var = ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv);
52960         uint64_t ret_ref = 0;
52961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52963         return ret_ref;
52964 }
52965
52966 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, uint64_t val) {
52967         LDKChannelPublicKeys this_ptr_conv;
52968         this_ptr_conv.inner = untag_ptr(this_ptr);
52969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52971         this_ptr_conv.is_owned = false;
52972         LDKRevocationBasepoint val_conv;
52973         val_conv.inner = untag_ptr(val);
52974         val_conv.is_owned = ptr_is_owned(val);
52975         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52976         val_conv = RevocationBasepoint_clone(&val_conv);
52977         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_conv);
52978 }
52979
52980 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
52981         LDKChannelPublicKeys this_ptr_conv;
52982         this_ptr_conv.inner = untag_ptr(this_ptr);
52983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52985         this_ptr_conv.is_owned = false;
52986         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52987         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
52988         return ret_arr;
52989 }
52990
52991 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
52992         LDKChannelPublicKeys this_ptr_conv;
52993         this_ptr_conv.inner = untag_ptr(this_ptr);
52994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52996         this_ptr_conv.is_owned = false;
52997         LDKPublicKey val_ref;
52998         CHECK(val->arr_len == 33);
52999         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
53000         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
53001 }
53002
53003 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
53004         LDKChannelPublicKeys this_ptr_conv;
53005         this_ptr_conv.inner = untag_ptr(this_ptr);
53006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53008         this_ptr_conv.is_owned = false;
53009         LDKDelayedPaymentBasepoint ret_var = ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv);
53010         uint64_t ret_ref = 0;
53011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53013         return ret_ref;
53014 }
53015
53016 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, uint64_t val) {
53017         LDKChannelPublicKeys this_ptr_conv;
53018         this_ptr_conv.inner = untag_ptr(this_ptr);
53019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53021         this_ptr_conv.is_owned = false;
53022         LDKDelayedPaymentBasepoint val_conv;
53023         val_conv.inner = untag_ptr(val);
53024         val_conv.is_owned = ptr_is_owned(val);
53025         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53026         val_conv = DelayedPaymentBasepoint_clone(&val_conv);
53027         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_conv);
53028 }
53029
53030 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
53031         LDKChannelPublicKeys this_ptr_conv;
53032         this_ptr_conv.inner = untag_ptr(this_ptr);
53033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53035         this_ptr_conv.is_owned = false;
53036         LDKHtlcBasepoint ret_var = ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv);
53037         uint64_t ret_ref = 0;
53038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53040         return ret_ref;
53041 }
53042
53043 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, uint64_t val) {
53044         LDKChannelPublicKeys this_ptr_conv;
53045         this_ptr_conv.inner = untag_ptr(this_ptr);
53046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53048         this_ptr_conv.is_owned = false;
53049         LDKHtlcBasepoint val_conv;
53050         val_conv.inner = untag_ptr(val);
53051         val_conv.is_owned = ptr_is_owned(val);
53052         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53053         val_conv = HtlcBasepoint_clone(&val_conv);
53054         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_conv);
53055 }
53056
53057 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_new"))) TS_ChannelPublicKeys_new(int8_tArray funding_pubkey_arg, uint64_t revocation_basepoint_arg, int8_tArray payment_point_arg, uint64_t delayed_payment_basepoint_arg, uint64_t htlc_basepoint_arg) {
53058         LDKPublicKey funding_pubkey_arg_ref;
53059         CHECK(funding_pubkey_arg->arr_len == 33);
53060         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
53061         LDKRevocationBasepoint revocation_basepoint_arg_conv;
53062         revocation_basepoint_arg_conv.inner = untag_ptr(revocation_basepoint_arg);
53063         revocation_basepoint_arg_conv.is_owned = ptr_is_owned(revocation_basepoint_arg);
53064         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_basepoint_arg_conv);
53065         revocation_basepoint_arg_conv = RevocationBasepoint_clone(&revocation_basepoint_arg_conv);
53066         LDKPublicKey payment_point_arg_ref;
53067         CHECK(payment_point_arg->arr_len == 33);
53068         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
53069         LDKDelayedPaymentBasepoint delayed_payment_basepoint_arg_conv;
53070         delayed_payment_basepoint_arg_conv.inner = untag_ptr(delayed_payment_basepoint_arg);
53071         delayed_payment_basepoint_arg_conv.is_owned = ptr_is_owned(delayed_payment_basepoint_arg);
53072         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_basepoint_arg_conv);
53073         delayed_payment_basepoint_arg_conv = DelayedPaymentBasepoint_clone(&delayed_payment_basepoint_arg_conv);
53074         LDKHtlcBasepoint htlc_basepoint_arg_conv;
53075         htlc_basepoint_arg_conv.inner = untag_ptr(htlc_basepoint_arg);
53076         htlc_basepoint_arg_conv.is_owned = ptr_is_owned(htlc_basepoint_arg);
53077         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_basepoint_arg_conv);
53078         htlc_basepoint_arg_conv = HtlcBasepoint_clone(&htlc_basepoint_arg_conv);
53079         LDKChannelPublicKeys ret_var = ChannelPublicKeys_new(funding_pubkey_arg_ref, revocation_basepoint_arg_conv, payment_point_arg_ref, delayed_payment_basepoint_arg_conv, htlc_basepoint_arg_conv);
53080         uint64_t ret_ref = 0;
53081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53083         return ret_ref;
53084 }
53085
53086 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
53087         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
53088         uint64_t ret_ref = 0;
53089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53091         return ret_ref;
53092 }
53093 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
53094         LDKChannelPublicKeys arg_conv;
53095         arg_conv.inner = untag_ptr(arg);
53096         arg_conv.is_owned = ptr_is_owned(arg);
53097         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53098         arg_conv.is_owned = false;
53099         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
53100         return ret_conv;
53101 }
53102
53103 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
53104         LDKChannelPublicKeys orig_conv;
53105         orig_conv.inner = untag_ptr(orig);
53106         orig_conv.is_owned = ptr_is_owned(orig);
53107         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53108         orig_conv.is_owned = false;
53109         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
53110         uint64_t ret_ref = 0;
53111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53113         return ret_ref;
53114 }
53115
53116 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_hash"))) TS_ChannelPublicKeys_hash(uint64_t o) {
53117         LDKChannelPublicKeys o_conv;
53118         o_conv.inner = untag_ptr(o);
53119         o_conv.is_owned = ptr_is_owned(o);
53120         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53121         o_conv.is_owned = false;
53122         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
53123         return ret_conv;
53124 }
53125
53126 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
53127         LDKChannelPublicKeys a_conv;
53128         a_conv.inner = untag_ptr(a);
53129         a_conv.is_owned = ptr_is_owned(a);
53130         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53131         a_conv.is_owned = false;
53132         LDKChannelPublicKeys b_conv;
53133         b_conv.inner = untag_ptr(b);
53134         b_conv.is_owned = ptr_is_owned(b);
53135         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53136         b_conv.is_owned = false;
53137         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
53138         return ret_conv;
53139 }
53140
53141 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
53142         LDKChannelPublicKeys obj_conv;
53143         obj_conv.inner = untag_ptr(obj);
53144         obj_conv.is_owned = ptr_is_owned(obj);
53145         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53146         obj_conv.is_owned = false;
53147         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
53148         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53149         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53150         CVec_u8Z_free(ret_var);
53151         return ret_arr;
53152 }
53153
53154 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
53155         LDKu8slice ser_ref;
53156         ser_ref.datalen = ser->arr_len;
53157         ser_ref.data = ser->elems;
53158         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
53159         *ret_conv = ChannelPublicKeys_read(ser_ref);
53160         FREE(ser);
53161         return tag_ptr(ret_conv, true);
53162 }
53163
53164 uint64_t  __attribute__((export_name("TS_TxCreationKeys_derive_new"))) TS_TxCreationKeys_derive_new(int8_tArray per_commitment_point, uint64_t broadcaster_delayed_payment_base, uint64_t broadcaster_htlc_base, uint64_t countersignatory_revocation_base, uint64_t countersignatory_htlc_base) {
53165         LDKPublicKey per_commitment_point_ref;
53166         CHECK(per_commitment_point->arr_len == 33);
53167         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
53168         LDKDelayedPaymentBasepoint broadcaster_delayed_payment_base_conv;
53169         broadcaster_delayed_payment_base_conv.inner = untag_ptr(broadcaster_delayed_payment_base);
53170         broadcaster_delayed_payment_base_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_base);
53171         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_base_conv);
53172         broadcaster_delayed_payment_base_conv.is_owned = false;
53173         LDKHtlcBasepoint broadcaster_htlc_base_conv;
53174         broadcaster_htlc_base_conv.inner = untag_ptr(broadcaster_htlc_base);
53175         broadcaster_htlc_base_conv.is_owned = ptr_is_owned(broadcaster_htlc_base);
53176         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_base_conv);
53177         broadcaster_htlc_base_conv.is_owned = false;
53178         LDKRevocationBasepoint countersignatory_revocation_base_conv;
53179         countersignatory_revocation_base_conv.inner = untag_ptr(countersignatory_revocation_base);
53180         countersignatory_revocation_base_conv.is_owned = ptr_is_owned(countersignatory_revocation_base);
53181         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_revocation_base_conv);
53182         countersignatory_revocation_base_conv.is_owned = false;
53183         LDKHtlcBasepoint countersignatory_htlc_base_conv;
53184         countersignatory_htlc_base_conv.inner = untag_ptr(countersignatory_htlc_base);
53185         countersignatory_htlc_base_conv.is_owned = ptr_is_owned(countersignatory_htlc_base);
53186         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_base_conv);
53187         countersignatory_htlc_base_conv.is_owned = false;
53188         LDKTxCreationKeys ret_var = TxCreationKeys_derive_new(per_commitment_point_ref, &broadcaster_delayed_payment_base_conv, &broadcaster_htlc_base_conv, &countersignatory_revocation_base_conv, &countersignatory_htlc_base_conv);
53189         uint64_t ret_ref = 0;
53190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53192         return ret_ref;
53193 }
53194
53195 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) {
53196         LDKPublicKey per_commitment_point_ref;
53197         CHECK(per_commitment_point->arr_len == 33);
53198         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
53199         LDKChannelPublicKeys broadcaster_keys_conv;
53200         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
53201         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
53202         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
53203         broadcaster_keys_conv.is_owned = false;
53204         LDKChannelPublicKeys countersignatory_keys_conv;
53205         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
53206         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
53207         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
53208         countersignatory_keys_conv.is_owned = false;
53209         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
53210         uint64_t ret_ref = 0;
53211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53213         return ret_ref;
53214 }
53215
53216 int8_tArray  __attribute__((export_name("TS_get_revokeable_redeemscript"))) TS_get_revokeable_redeemscript(uint64_t revocation_key, int16_t contest_delay, uint64_t broadcaster_delayed_payment_key) {
53217         LDKRevocationKey revocation_key_conv;
53218         revocation_key_conv.inner = untag_ptr(revocation_key);
53219         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
53220         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
53221         revocation_key_conv.is_owned = false;
53222         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
53223         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
53224         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
53225         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
53226         broadcaster_delayed_payment_key_conv.is_owned = false;
53227         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(&revocation_key_conv, contest_delay, &broadcaster_delayed_payment_key_conv);
53228         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53229         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53230         CVec_u8Z_free(ret_var);
53231         return ret_arr;
53232 }
53233
53234 int8_tArray  __attribute__((export_name("TS_get_counterparty_payment_script"))) TS_get_counterparty_payment_script(uint64_t channel_type_features, int8_tArray payment_key) {
53235         LDKChannelTypeFeatures channel_type_features_conv;
53236         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53237         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53238         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53239         channel_type_features_conv.is_owned = false;
53240         LDKPublicKey payment_key_ref;
53241         CHECK(payment_key->arr_len == 33);
53242         memcpy(payment_key_ref.compressed_form, payment_key->elems, 33); FREE(payment_key);
53243         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
53244         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53245         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53246         CVec_u8Z_free(ret_var);
53247         return ret_arr;
53248 }
53249
53250 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
53251         LDKHTLCOutputInCommitment this_obj_conv;
53252         this_obj_conv.inner = untag_ptr(this_obj);
53253         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53255         HTLCOutputInCommitment_free(this_obj_conv);
53256 }
53257
53258 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
53259         LDKHTLCOutputInCommitment this_ptr_conv;
53260         this_ptr_conv.inner = untag_ptr(this_ptr);
53261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53263         this_ptr_conv.is_owned = false;
53264         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
53265         return ret_conv;
53266 }
53267
53268 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
53269         LDKHTLCOutputInCommitment this_ptr_conv;
53270         this_ptr_conv.inner = untag_ptr(this_ptr);
53271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53273         this_ptr_conv.is_owned = false;
53274         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
53275 }
53276
53277 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
53278         LDKHTLCOutputInCommitment this_ptr_conv;
53279         this_ptr_conv.inner = untag_ptr(this_ptr);
53280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53282         this_ptr_conv.is_owned = false;
53283         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
53284         return ret_conv;
53285 }
53286
53287 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
53288         LDKHTLCOutputInCommitment this_ptr_conv;
53289         this_ptr_conv.inner = untag_ptr(this_ptr);
53290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53292         this_ptr_conv.is_owned = false;
53293         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
53294 }
53295
53296 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
53297         LDKHTLCOutputInCommitment this_ptr_conv;
53298         this_ptr_conv.inner = untag_ptr(this_ptr);
53299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53301         this_ptr_conv.is_owned = false;
53302         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
53303         return ret_conv;
53304 }
53305
53306 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
53307         LDKHTLCOutputInCommitment this_ptr_conv;
53308         this_ptr_conv.inner = untag_ptr(this_ptr);
53309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53311         this_ptr_conv.is_owned = false;
53312         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
53313 }
53314
53315 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
53316         LDKHTLCOutputInCommitment this_ptr_conv;
53317         this_ptr_conv.inner = untag_ptr(this_ptr);
53318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53320         this_ptr_conv.is_owned = false;
53321         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53322         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
53323         return ret_arr;
53324 }
53325
53326 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
53327         LDKHTLCOutputInCommitment this_ptr_conv;
53328         this_ptr_conv.inner = untag_ptr(this_ptr);
53329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53331         this_ptr_conv.is_owned = false;
53332         LDKThirtyTwoBytes val_ref;
53333         CHECK(val->arr_len == 32);
53334         memcpy(val_ref.data, val->elems, 32); FREE(val);
53335         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
53336 }
53337
53338 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
53339         LDKHTLCOutputInCommitment this_ptr_conv;
53340         this_ptr_conv.inner = untag_ptr(this_ptr);
53341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53343         this_ptr_conv.is_owned = false;
53344         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
53345         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
53346         uint64_t ret_ref = tag_ptr(ret_copy, true);
53347         return ret_ref;
53348 }
53349
53350 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
53351         LDKHTLCOutputInCommitment this_ptr_conv;
53352         this_ptr_conv.inner = untag_ptr(this_ptr);
53353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53355         this_ptr_conv.is_owned = false;
53356         void* val_ptr = untag_ptr(val);
53357         CHECK_ACCESS(val_ptr);
53358         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
53359         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
53360         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
53361 }
53362
53363 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) {
53364         LDKThirtyTwoBytes payment_hash_arg_ref;
53365         CHECK(payment_hash_arg->arr_len == 32);
53366         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
53367         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
53368         CHECK_ACCESS(transaction_output_index_arg_ptr);
53369         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
53370         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
53371         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
53372         uint64_t ret_ref = 0;
53373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53375         return ret_ref;
53376 }
53377
53378 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
53379         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
53380         uint64_t ret_ref = 0;
53381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53383         return ret_ref;
53384 }
53385 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
53386         LDKHTLCOutputInCommitment arg_conv;
53387         arg_conv.inner = untag_ptr(arg);
53388         arg_conv.is_owned = ptr_is_owned(arg);
53389         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53390         arg_conv.is_owned = false;
53391         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
53392         return ret_conv;
53393 }
53394
53395 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
53396         LDKHTLCOutputInCommitment orig_conv;
53397         orig_conv.inner = untag_ptr(orig);
53398         orig_conv.is_owned = ptr_is_owned(orig);
53399         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53400         orig_conv.is_owned = false;
53401         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
53402         uint64_t ret_ref = 0;
53403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53405         return ret_ref;
53406 }
53407
53408 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
53409         LDKHTLCOutputInCommitment a_conv;
53410         a_conv.inner = untag_ptr(a);
53411         a_conv.is_owned = ptr_is_owned(a);
53412         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53413         a_conv.is_owned = false;
53414         LDKHTLCOutputInCommitment b_conv;
53415         b_conv.inner = untag_ptr(b);
53416         b_conv.is_owned = ptr_is_owned(b);
53417         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53418         b_conv.is_owned = false;
53419         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
53420         return ret_conv;
53421 }
53422
53423 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
53424         LDKHTLCOutputInCommitment obj_conv;
53425         obj_conv.inner = untag_ptr(obj);
53426         obj_conv.is_owned = ptr_is_owned(obj);
53427         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53428         obj_conv.is_owned = false;
53429         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
53430         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53431         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53432         CVec_u8Z_free(ret_var);
53433         return ret_arr;
53434 }
53435
53436 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
53437         LDKu8slice ser_ref;
53438         ser_ref.datalen = ser->arr_len;
53439         ser_ref.data = ser->elems;
53440         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
53441         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
53442         FREE(ser);
53443         return tag_ptr(ret_conv, true);
53444 }
53445
53446 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, uint64_t channel_type_features, uint64_t keys) {
53447         LDKHTLCOutputInCommitment htlc_conv;
53448         htlc_conv.inner = untag_ptr(htlc);
53449         htlc_conv.is_owned = ptr_is_owned(htlc);
53450         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
53451         htlc_conv.is_owned = false;
53452         LDKChannelTypeFeatures channel_type_features_conv;
53453         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53454         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53455         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53456         channel_type_features_conv.is_owned = false;
53457         LDKTxCreationKeys keys_conv;
53458         keys_conv.inner = untag_ptr(keys);
53459         keys_conv.is_owned = ptr_is_owned(keys);
53460         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
53461         keys_conv.is_owned = false;
53462         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
53463         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53464         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53465         CVec_u8Z_free(ret_var);
53466         return ret_arr;
53467 }
53468
53469 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
53470         LDKPublicKey broadcaster_ref;
53471         CHECK(broadcaster->arr_len == 33);
53472         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
53473         LDKPublicKey countersignatory_ref;
53474         CHECK(countersignatory->arr_len == 33);
53475         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
53476         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
53477         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53478         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53479         CVec_u8Z_free(ret_var);
53480         return ret_arr;
53481 }
53482
53483 int8_tArray  __attribute__((export_name("TS_build_htlc_transaction"))) TS_build_htlc_transaction(int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, uint64_t htlc, uint64_t channel_type_features, uint64_t broadcaster_delayed_payment_key, uint64_t revocation_key) {
53484         uint8_t commitment_txid_arr[32];
53485         CHECK(commitment_txid->arr_len == 32);
53486         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
53487         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
53488         LDKHTLCOutputInCommitment htlc_conv;
53489         htlc_conv.inner = untag_ptr(htlc);
53490         htlc_conv.is_owned = ptr_is_owned(htlc);
53491         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
53492         htlc_conv.is_owned = false;
53493         LDKChannelTypeFeatures channel_type_features_conv;
53494         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53495         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53496         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53497         channel_type_features_conv.is_owned = false;
53498         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
53499         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
53500         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
53501         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
53502         broadcaster_delayed_payment_key_conv.is_owned = false;
53503         LDKRevocationKey revocation_key_conv;
53504         revocation_key_conv.inner = untag_ptr(revocation_key);
53505         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
53506         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
53507         revocation_key_conv.is_owned = false;
53508         LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, &channel_type_features_conv, &broadcaster_delayed_payment_key_conv, &revocation_key_conv);
53509         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53510         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53511         Transaction_free(ret_var);
53512         return ret_arr;
53513 }
53514
53515 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) {
53516         LDKECDSASignature local_sig_ref;
53517         CHECK(local_sig->arr_len == 64);
53518         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
53519         LDKECDSASignature remote_sig_ref;
53520         CHECK(remote_sig->arr_len == 64);
53521         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
53522         void* preimage_ptr = untag_ptr(preimage);
53523         CHECK_ACCESS(preimage_ptr);
53524         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
53525         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
53526         LDKu8slice redeem_script_ref;
53527         redeem_script_ref.datalen = redeem_script->arr_len;
53528         redeem_script_ref.data = redeem_script->elems;
53529         LDKChannelTypeFeatures channel_type_features_conv;
53530         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53531         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53532         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53533         channel_type_features_conv.is_owned = false;
53534         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
53535         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53536         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53537         Witness_free(ret_var);
53538         FREE(redeem_script);
53539         return ret_arr;
53540 }
53541
53542 int8_tArray  __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
53543         LDKPublicKey payment_point_ref;
53544         CHECK(payment_point->arr_len == 33);
53545         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
53546         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
53547         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53548         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53549         CVec_u8Z_free(ret_var);
53550         return ret_arr;
53551 }
53552
53553 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
53554         LDKPublicKey funding_pubkey_ref;
53555         CHECK(funding_pubkey->arr_len == 33);
53556         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
53557         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
53558         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53559         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53560         CVec_u8Z_free(ret_var);
53561         return ret_arr;
53562 }
53563
53564 int8_tArray  __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
53565         LDKPublicKey funding_key_ref;
53566         CHECK(funding_key->arr_len == 33);
53567         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
53568         LDKECDSASignature funding_sig_ref;
53569         CHECK(funding_sig->arr_len == 64);
53570         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
53571         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
53572         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53573         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53574         Witness_free(ret_var);
53575         return ret_arr;
53576 }
53577
53578 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
53579         LDKChannelTransactionParameters this_obj_conv;
53580         this_obj_conv.inner = untag_ptr(this_obj);
53581         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53583         ChannelTransactionParameters_free(this_obj_conv);
53584 }
53585
53586 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
53587         LDKChannelTransactionParameters this_ptr_conv;
53588         this_ptr_conv.inner = untag_ptr(this_ptr);
53589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53591         this_ptr_conv.is_owned = false;
53592         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
53593         uint64_t ret_ref = 0;
53594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53596         return ret_ref;
53597 }
53598
53599 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
53600         LDKChannelTransactionParameters this_ptr_conv;
53601         this_ptr_conv.inner = untag_ptr(this_ptr);
53602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53604         this_ptr_conv.is_owned = false;
53605         LDKChannelPublicKeys val_conv;
53606         val_conv.inner = untag_ptr(val);
53607         val_conv.is_owned = ptr_is_owned(val);
53608         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53609         val_conv = ChannelPublicKeys_clone(&val_conv);
53610         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
53611 }
53612
53613 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
53614         LDKChannelTransactionParameters this_ptr_conv;
53615         this_ptr_conv.inner = untag_ptr(this_ptr);
53616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53618         this_ptr_conv.is_owned = false;
53619         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
53620         return ret_conv;
53621 }
53622
53623 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) {
53624         LDKChannelTransactionParameters this_ptr_conv;
53625         this_ptr_conv.inner = untag_ptr(this_ptr);
53626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53628         this_ptr_conv.is_owned = false;
53629         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
53630 }
53631
53632 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
53633         LDKChannelTransactionParameters this_ptr_conv;
53634         this_ptr_conv.inner = untag_ptr(this_ptr);
53635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53637         this_ptr_conv.is_owned = false;
53638         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
53639         return ret_conv;
53640 }
53641
53642 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
53643         LDKChannelTransactionParameters this_ptr_conv;
53644         this_ptr_conv.inner = untag_ptr(this_ptr);
53645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53647         this_ptr_conv.is_owned = false;
53648         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
53649 }
53650
53651 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
53652         LDKChannelTransactionParameters this_ptr_conv;
53653         this_ptr_conv.inner = untag_ptr(this_ptr);
53654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53656         this_ptr_conv.is_owned = false;
53657         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
53658         uint64_t ret_ref = 0;
53659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53661         return ret_ref;
53662 }
53663
53664 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
53665         LDKChannelTransactionParameters this_ptr_conv;
53666         this_ptr_conv.inner = untag_ptr(this_ptr);
53667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53669         this_ptr_conv.is_owned = false;
53670         LDKCounterpartyChannelTransactionParameters val_conv;
53671         val_conv.inner = untag_ptr(val);
53672         val_conv.is_owned = ptr_is_owned(val);
53673         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53674         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
53675         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
53676 }
53677
53678 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
53679         LDKChannelTransactionParameters this_ptr_conv;
53680         this_ptr_conv.inner = untag_ptr(this_ptr);
53681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53683         this_ptr_conv.is_owned = false;
53684         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
53685         uint64_t ret_ref = 0;
53686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53688         return ret_ref;
53689 }
53690
53691 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
53692         LDKChannelTransactionParameters this_ptr_conv;
53693         this_ptr_conv.inner = untag_ptr(this_ptr);
53694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53696         this_ptr_conv.is_owned = false;
53697         LDKOutPoint val_conv;
53698         val_conv.inner = untag_ptr(val);
53699         val_conv.is_owned = ptr_is_owned(val);
53700         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53701         val_conv = OutPoint_clone(&val_conv);
53702         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
53703 }
53704
53705 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_channel_type_features"))) TS_ChannelTransactionParameters_get_channel_type_features(uint64_t this_ptr) {
53706         LDKChannelTransactionParameters this_ptr_conv;
53707         this_ptr_conv.inner = untag_ptr(this_ptr);
53708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53710         this_ptr_conv.is_owned = false;
53711         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
53712         uint64_t ret_ref = 0;
53713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53715         return ret_ref;
53716 }
53717
53718 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_channel_type_features"))) TS_ChannelTransactionParameters_set_channel_type_features(uint64_t this_ptr, uint64_t val) {
53719         LDKChannelTransactionParameters this_ptr_conv;
53720         this_ptr_conv.inner = untag_ptr(this_ptr);
53721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53723         this_ptr_conv.is_owned = false;
53724         LDKChannelTypeFeatures val_conv;
53725         val_conv.inner = untag_ptr(val);
53726         val_conv.is_owned = ptr_is_owned(val);
53727         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53728         val_conv = ChannelTypeFeatures_clone(&val_conv);
53729         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
53730 }
53731
53732 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) {
53733         LDKChannelPublicKeys holder_pubkeys_arg_conv;
53734         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
53735         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
53736         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
53737         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
53738         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
53739         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
53740         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
53741         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
53742         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
53743         LDKOutPoint funding_outpoint_arg_conv;
53744         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
53745         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
53746         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
53747         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
53748         LDKChannelTypeFeatures channel_type_features_arg_conv;
53749         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
53750         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
53751         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
53752         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
53753         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);
53754         uint64_t ret_ref = 0;
53755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53757         return ret_ref;
53758 }
53759
53760 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
53761         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
53762         uint64_t ret_ref = 0;
53763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53765         return ret_ref;
53766 }
53767 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
53768         LDKChannelTransactionParameters arg_conv;
53769         arg_conv.inner = untag_ptr(arg);
53770         arg_conv.is_owned = ptr_is_owned(arg);
53771         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53772         arg_conv.is_owned = false;
53773         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
53774         return ret_conv;
53775 }
53776
53777 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
53778         LDKChannelTransactionParameters orig_conv;
53779         orig_conv.inner = untag_ptr(orig);
53780         orig_conv.is_owned = ptr_is_owned(orig);
53781         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53782         orig_conv.is_owned = false;
53783         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
53784         uint64_t ret_ref = 0;
53785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53787         return ret_ref;
53788 }
53789
53790 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_hash"))) TS_ChannelTransactionParameters_hash(uint64_t o) {
53791         LDKChannelTransactionParameters o_conv;
53792         o_conv.inner = untag_ptr(o);
53793         o_conv.is_owned = ptr_is_owned(o);
53794         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53795         o_conv.is_owned = false;
53796         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
53797         return ret_conv;
53798 }
53799
53800 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_eq"))) TS_ChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
53801         LDKChannelTransactionParameters a_conv;
53802         a_conv.inner = untag_ptr(a);
53803         a_conv.is_owned = ptr_is_owned(a);
53804         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53805         a_conv.is_owned = false;
53806         LDKChannelTransactionParameters b_conv;
53807         b_conv.inner = untag_ptr(b);
53808         b_conv.is_owned = ptr_is_owned(b);
53809         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53810         b_conv.is_owned = false;
53811         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
53812         return ret_conv;
53813 }
53814
53815 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
53816         LDKCounterpartyChannelTransactionParameters this_obj_conv;
53817         this_obj_conv.inner = untag_ptr(this_obj);
53818         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53820         CounterpartyChannelTransactionParameters_free(this_obj_conv);
53821 }
53822
53823 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
53824         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
53825         this_ptr_conv.inner = untag_ptr(this_ptr);
53826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53828         this_ptr_conv.is_owned = false;
53829         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
53830         uint64_t ret_ref = 0;
53831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53833         return ret_ref;
53834 }
53835
53836 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
53837         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
53838         this_ptr_conv.inner = untag_ptr(this_ptr);
53839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53841         this_ptr_conv.is_owned = false;
53842         LDKChannelPublicKeys val_conv;
53843         val_conv.inner = untag_ptr(val);
53844         val_conv.is_owned = ptr_is_owned(val);
53845         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53846         val_conv = ChannelPublicKeys_clone(&val_conv);
53847         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
53848 }
53849
53850 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
53851         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
53852         this_ptr_conv.inner = untag_ptr(this_ptr);
53853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53855         this_ptr_conv.is_owned = false;
53856         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
53857         return ret_conv;
53858 }
53859
53860 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
53861         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
53862         this_ptr_conv.inner = untag_ptr(this_ptr);
53863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53865         this_ptr_conv.is_owned = false;
53866         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
53867 }
53868
53869 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
53870         LDKChannelPublicKeys pubkeys_arg_conv;
53871         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
53872         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
53873         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
53874         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
53875         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
53876         uint64_t ret_ref = 0;
53877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53879         return ret_ref;
53880 }
53881
53882 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
53883         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
53884         uint64_t ret_ref = 0;
53885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53887         return ret_ref;
53888 }
53889 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
53890         LDKCounterpartyChannelTransactionParameters arg_conv;
53891         arg_conv.inner = untag_ptr(arg);
53892         arg_conv.is_owned = ptr_is_owned(arg);
53893         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53894         arg_conv.is_owned = false;
53895         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
53896         return ret_conv;
53897 }
53898
53899 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
53900         LDKCounterpartyChannelTransactionParameters orig_conv;
53901         orig_conv.inner = untag_ptr(orig);
53902         orig_conv.is_owned = ptr_is_owned(orig);
53903         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53904         orig_conv.is_owned = false;
53905         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
53906         uint64_t ret_ref = 0;
53907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53909         return ret_ref;
53910 }
53911
53912 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_hash"))) TS_CounterpartyChannelTransactionParameters_hash(uint64_t o) {
53913         LDKCounterpartyChannelTransactionParameters o_conv;
53914         o_conv.inner = untag_ptr(o);
53915         o_conv.is_owned = ptr_is_owned(o);
53916         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53917         o_conv.is_owned = false;
53918         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
53919         return ret_conv;
53920 }
53921
53922 jboolean  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_eq"))) TS_CounterpartyChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
53923         LDKCounterpartyChannelTransactionParameters a_conv;
53924         a_conv.inner = untag_ptr(a);
53925         a_conv.is_owned = ptr_is_owned(a);
53926         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53927         a_conv.is_owned = false;
53928         LDKCounterpartyChannelTransactionParameters b_conv;
53929         b_conv.inner = untag_ptr(b);
53930         b_conv.is_owned = ptr_is_owned(b);
53931         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53932         b_conv.is_owned = false;
53933         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
53934         return ret_conv;
53935 }
53936
53937 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
53938         LDKChannelTransactionParameters this_arg_conv;
53939         this_arg_conv.inner = untag_ptr(this_arg);
53940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53942         this_arg_conv.is_owned = false;
53943         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
53944         return ret_conv;
53945 }
53946
53947 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
53948         LDKChannelTransactionParameters this_arg_conv;
53949         this_arg_conv.inner = untag_ptr(this_arg);
53950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53952         this_arg_conv.is_owned = false;
53953         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
53954         uint64_t ret_ref = 0;
53955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53957         return ret_ref;
53958 }
53959
53960 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
53961         LDKChannelTransactionParameters this_arg_conv;
53962         this_arg_conv.inner = untag_ptr(this_arg);
53963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53965         this_arg_conv.is_owned = false;
53966         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
53967         uint64_t ret_ref = 0;
53968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53970         return ret_ref;
53971 }
53972
53973 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
53974         LDKCounterpartyChannelTransactionParameters obj_conv;
53975         obj_conv.inner = untag_ptr(obj);
53976         obj_conv.is_owned = ptr_is_owned(obj);
53977         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53978         obj_conv.is_owned = false;
53979         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
53980         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53981         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53982         CVec_u8Z_free(ret_var);
53983         return ret_arr;
53984 }
53985
53986 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
53987         LDKu8slice ser_ref;
53988         ser_ref.datalen = ser->arr_len;
53989         ser_ref.data = ser->elems;
53990         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
53991         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
53992         FREE(ser);
53993         return tag_ptr(ret_conv, true);
53994 }
53995
53996 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
53997         LDKChannelTransactionParameters obj_conv;
53998         obj_conv.inner = untag_ptr(obj);
53999         obj_conv.is_owned = ptr_is_owned(obj);
54000         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54001         obj_conv.is_owned = false;
54002         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
54003         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54004         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54005         CVec_u8Z_free(ret_var);
54006         return ret_arr;
54007 }
54008
54009 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
54010         LDKu8slice ser_ref;
54011         ser_ref.datalen = ser->arr_len;
54012         ser_ref.data = ser->elems;
54013         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
54014         *ret_conv = ChannelTransactionParameters_read(ser_ref);
54015         FREE(ser);
54016         return tag_ptr(ret_conv, true);
54017 }
54018
54019 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
54020         LDKDirectedChannelTransactionParameters this_obj_conv;
54021         this_obj_conv.inner = untag_ptr(this_obj);
54022         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54024         DirectedChannelTransactionParameters_free(this_obj_conv);
54025 }
54026
54027 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
54028         LDKDirectedChannelTransactionParameters this_arg_conv;
54029         this_arg_conv.inner = untag_ptr(this_arg);
54030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54032         this_arg_conv.is_owned = false;
54033         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
54034         uint64_t ret_ref = 0;
54035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54037         return ret_ref;
54038 }
54039
54040 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
54041         LDKDirectedChannelTransactionParameters this_arg_conv;
54042         this_arg_conv.inner = untag_ptr(this_arg);
54043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54045         this_arg_conv.is_owned = false;
54046         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
54047         uint64_t ret_ref = 0;
54048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54050         return ret_ref;
54051 }
54052
54053 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
54054         LDKDirectedChannelTransactionParameters this_arg_conv;
54055         this_arg_conv.inner = untag_ptr(this_arg);
54056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54058         this_arg_conv.is_owned = false;
54059         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
54060         return ret_conv;
54061 }
54062
54063 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
54064         LDKDirectedChannelTransactionParameters this_arg_conv;
54065         this_arg_conv.inner = untag_ptr(this_arg);
54066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54068         this_arg_conv.is_owned = false;
54069         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
54070         return ret_conv;
54071 }
54072
54073 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
54074         LDKDirectedChannelTransactionParameters this_arg_conv;
54075         this_arg_conv.inner = untag_ptr(this_arg);
54076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54078         this_arg_conv.is_owned = false;
54079         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
54080         uint64_t ret_ref = 0;
54081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54083         return ret_ref;
54084 }
54085
54086 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_channel_type_features"))) TS_DirectedChannelTransactionParameters_channel_type_features(uint64_t this_arg) {
54087         LDKDirectedChannelTransactionParameters this_arg_conv;
54088         this_arg_conv.inner = untag_ptr(this_arg);
54089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54091         this_arg_conv.is_owned = false;
54092         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
54093         uint64_t ret_ref = 0;
54094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54096         return ret_ref;
54097 }
54098
54099 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
54100         LDKHolderCommitmentTransaction this_obj_conv;
54101         this_obj_conv.inner = untag_ptr(this_obj);
54102         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54104         HolderCommitmentTransaction_free(this_obj_conv);
54105 }
54106
54107 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
54108         LDKHolderCommitmentTransaction this_ptr_conv;
54109         this_ptr_conv.inner = untag_ptr(this_ptr);
54110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54112         this_ptr_conv.is_owned = false;
54113         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54114         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
54115         return ret_arr;
54116 }
54117
54118 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
54119         LDKHolderCommitmentTransaction this_ptr_conv;
54120         this_ptr_conv.inner = untag_ptr(this_ptr);
54121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54123         this_ptr_conv.is_owned = false;
54124         LDKECDSASignature val_ref;
54125         CHECK(val->arr_len == 64);
54126         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
54127         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
54128 }
54129
54130 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
54131         LDKHolderCommitmentTransaction this_ptr_conv;
54132         this_ptr_conv.inner = untag_ptr(this_ptr);
54133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54135         this_ptr_conv.is_owned = false;
54136         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
54137         ptrArray ret_arr = NULL;
54138         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
54139         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
54140         for (size_t m = 0; m < ret_var.datalen; m++) {
54141                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
54142                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
54143                 ret_arr_ptr[m] = ret_conv_12_arr;
54144         }
54145         
54146         FREE(ret_var.data);
54147         return ret_arr;
54148 }
54149
54150 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
54151         LDKHolderCommitmentTransaction 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         LDKCVec_ECDSASignatureZ val_constr;
54157         val_constr.datalen = val->arr_len;
54158         if (val_constr.datalen > 0)
54159                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
54160         else
54161                 val_constr.data = NULL;
54162         int8_tArray* val_vals = (void*) val->elems;
54163         for (size_t m = 0; m < val_constr.datalen; m++) {
54164                 int8_tArray val_conv_12 = val_vals[m];
54165                 LDKECDSASignature val_conv_12_ref;
54166                 CHECK(val_conv_12->arr_len == 64);
54167                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
54168                 val_constr.data[m] = val_conv_12_ref;
54169         }
54170         FREE(val);
54171         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
54172 }
54173
54174 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
54175         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
54176         uint64_t ret_ref = 0;
54177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54179         return ret_ref;
54180 }
54181 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
54182         LDKHolderCommitmentTransaction arg_conv;
54183         arg_conv.inner = untag_ptr(arg);
54184         arg_conv.is_owned = ptr_is_owned(arg);
54185         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54186         arg_conv.is_owned = false;
54187         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
54188         return ret_conv;
54189 }
54190
54191 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
54192         LDKHolderCommitmentTransaction orig_conv;
54193         orig_conv.inner = untag_ptr(orig);
54194         orig_conv.is_owned = ptr_is_owned(orig);
54195         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54196         orig_conv.is_owned = false;
54197         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
54198         uint64_t ret_ref = 0;
54199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54201         return ret_ref;
54202 }
54203
54204 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
54205         LDKHolderCommitmentTransaction obj_conv;
54206         obj_conv.inner = untag_ptr(obj);
54207         obj_conv.is_owned = ptr_is_owned(obj);
54208         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54209         obj_conv.is_owned = false;
54210         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
54211         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54212         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54213         CVec_u8Z_free(ret_var);
54214         return ret_arr;
54215 }
54216
54217 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
54218         LDKu8slice ser_ref;
54219         ser_ref.datalen = ser->arr_len;
54220         ser_ref.data = ser->elems;
54221         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
54222         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
54223         FREE(ser);
54224         return tag_ptr(ret_conv, true);
54225 }
54226
54227 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) {
54228         LDKCommitmentTransaction commitment_tx_conv;
54229         commitment_tx_conv.inner = untag_ptr(commitment_tx);
54230         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
54231         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
54232         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
54233         LDKECDSASignature counterparty_sig_ref;
54234         CHECK(counterparty_sig->arr_len == 64);
54235         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
54236         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
54237         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
54238         if (counterparty_htlc_sigs_constr.datalen > 0)
54239                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
54240         else
54241                 counterparty_htlc_sigs_constr.data = NULL;
54242         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
54243         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
54244                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
54245                 LDKECDSASignature counterparty_htlc_sigs_conv_12_ref;
54246                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
54247                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
54248                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
54249         }
54250         FREE(counterparty_htlc_sigs);
54251         LDKPublicKey holder_funding_key_ref;
54252         CHECK(holder_funding_key->arr_len == 33);
54253         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
54254         LDKPublicKey counterparty_funding_key_ref;
54255         CHECK(counterparty_funding_key->arr_len == 33);
54256         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
54257         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
54258         uint64_t ret_ref = 0;
54259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54261         return ret_ref;
54262 }
54263
54264 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
54265         LDKBuiltCommitmentTransaction this_obj_conv;
54266         this_obj_conv.inner = untag_ptr(this_obj);
54267         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54269         BuiltCommitmentTransaction_free(this_obj_conv);
54270 }
54271
54272 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
54273         LDKBuiltCommitmentTransaction this_ptr_conv;
54274         this_ptr_conv.inner = untag_ptr(this_ptr);
54275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54277         this_ptr_conv.is_owned = false;
54278         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
54279         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54280         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54281         Transaction_free(ret_var);
54282         return ret_arr;
54283 }
54284
54285 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
54286         LDKBuiltCommitmentTransaction this_ptr_conv;
54287         this_ptr_conv.inner = untag_ptr(this_ptr);
54288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54290         this_ptr_conv.is_owned = false;
54291         LDKTransaction val_ref;
54292         val_ref.datalen = val->arr_len;
54293         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
54294         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
54295         val_ref.data_is_owned = true;
54296         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
54297 }
54298
54299 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
54300         LDKBuiltCommitmentTransaction this_ptr_conv;
54301         this_ptr_conv.inner = untag_ptr(this_ptr);
54302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54304         this_ptr_conv.is_owned = false;
54305         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54306         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
54307         return ret_arr;
54308 }
54309
54310 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
54311         LDKBuiltCommitmentTransaction this_ptr_conv;
54312         this_ptr_conv.inner = untag_ptr(this_ptr);
54313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54315         this_ptr_conv.is_owned = false;
54316         LDKThirtyTwoBytes val_ref;
54317         CHECK(val->arr_len == 32);
54318         memcpy(val_ref.data, val->elems, 32); FREE(val);
54319         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
54320 }
54321
54322 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
54323         LDKTransaction transaction_arg_ref;
54324         transaction_arg_ref.datalen = transaction_arg->arr_len;
54325         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
54326         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
54327         transaction_arg_ref.data_is_owned = true;
54328         LDKThirtyTwoBytes txid_arg_ref;
54329         CHECK(txid_arg->arr_len == 32);
54330         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
54331         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
54332         uint64_t ret_ref = 0;
54333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54335         return ret_ref;
54336 }
54337
54338 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
54339         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
54340         uint64_t ret_ref = 0;
54341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54343         return ret_ref;
54344 }
54345 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
54346         LDKBuiltCommitmentTransaction arg_conv;
54347         arg_conv.inner = untag_ptr(arg);
54348         arg_conv.is_owned = ptr_is_owned(arg);
54349         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54350         arg_conv.is_owned = false;
54351         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
54352         return ret_conv;
54353 }
54354
54355 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
54356         LDKBuiltCommitmentTransaction orig_conv;
54357         orig_conv.inner = untag_ptr(orig);
54358         orig_conv.is_owned = ptr_is_owned(orig);
54359         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54360         orig_conv.is_owned = false;
54361         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
54362         uint64_t ret_ref = 0;
54363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54365         return ret_ref;
54366 }
54367
54368 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
54369         LDKBuiltCommitmentTransaction obj_conv;
54370         obj_conv.inner = untag_ptr(obj);
54371         obj_conv.is_owned = ptr_is_owned(obj);
54372         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54373         obj_conv.is_owned = false;
54374         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
54375         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54376         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54377         CVec_u8Z_free(ret_var);
54378         return ret_arr;
54379 }
54380
54381 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
54382         LDKu8slice ser_ref;
54383         ser_ref.datalen = ser->arr_len;
54384         ser_ref.data = ser->elems;
54385         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
54386         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
54387         FREE(ser);
54388         return tag_ptr(ret_conv, true);
54389 }
54390
54391 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) {
54392         LDKBuiltCommitmentTransaction this_arg_conv;
54393         this_arg_conv.inner = untag_ptr(this_arg);
54394         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54396         this_arg_conv.is_owned = false;
54397         LDKu8slice funding_redeemscript_ref;
54398         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
54399         funding_redeemscript_ref.data = funding_redeemscript->elems;
54400         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54401         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
54402         FREE(funding_redeemscript);
54403         return ret_arr;
54404 }
54405
54406 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) {
54407         LDKBuiltCommitmentTransaction this_arg_conv;
54408         this_arg_conv.inner = untag_ptr(this_arg);
54409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54411         this_arg_conv.is_owned = false;
54412         uint8_t funding_key_arr[32];
54413         CHECK(funding_key->arr_len == 32);
54414         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
54415         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
54416         LDKu8slice funding_redeemscript_ref;
54417         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
54418         funding_redeemscript_ref.data = funding_redeemscript->elems;
54419         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54420         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
54421         FREE(funding_redeemscript);
54422         return ret_arr;
54423 }
54424
54425 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) {
54426         LDKBuiltCommitmentTransaction this_arg_conv;
54427         this_arg_conv.inner = untag_ptr(this_arg);
54428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54430         this_arg_conv.is_owned = false;
54431         uint8_t funding_key_arr[32];
54432         CHECK(funding_key->arr_len == 32);
54433         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
54434         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
54435         LDKu8slice funding_redeemscript_ref;
54436         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
54437         funding_redeemscript_ref.data = funding_redeemscript->elems;
54438         void* entropy_source_ptr = untag_ptr(entropy_source);
54439         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
54440         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
54441         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54442         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);
54443         FREE(funding_redeemscript);
54444         return ret_arr;
54445 }
54446
54447 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
54448         LDKClosingTransaction this_obj_conv;
54449         this_obj_conv.inner = untag_ptr(this_obj);
54450         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54452         ClosingTransaction_free(this_obj_conv);
54453 }
54454
54455 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
54456         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
54457         uint64_t ret_ref = 0;
54458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54460         return ret_ref;
54461 }
54462 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
54463         LDKClosingTransaction arg_conv;
54464         arg_conv.inner = untag_ptr(arg);
54465         arg_conv.is_owned = ptr_is_owned(arg);
54466         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54467         arg_conv.is_owned = false;
54468         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
54469         return ret_conv;
54470 }
54471
54472 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
54473         LDKClosingTransaction orig_conv;
54474         orig_conv.inner = untag_ptr(orig);
54475         orig_conv.is_owned = ptr_is_owned(orig);
54476         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54477         orig_conv.is_owned = false;
54478         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
54479         uint64_t ret_ref = 0;
54480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54482         return ret_ref;
54483 }
54484
54485 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
54486         LDKClosingTransaction o_conv;
54487         o_conv.inner = untag_ptr(o);
54488         o_conv.is_owned = ptr_is_owned(o);
54489         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54490         o_conv.is_owned = false;
54491         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
54492         return ret_conv;
54493 }
54494
54495 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
54496         LDKClosingTransaction a_conv;
54497         a_conv.inner = untag_ptr(a);
54498         a_conv.is_owned = ptr_is_owned(a);
54499         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54500         a_conv.is_owned = false;
54501         LDKClosingTransaction b_conv;
54502         b_conv.inner = untag_ptr(b);
54503         b_conv.is_owned = ptr_is_owned(b);
54504         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54505         b_conv.is_owned = false;
54506         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
54507         return ret_conv;
54508 }
54509
54510 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) {
54511         LDKCVec_u8Z to_holder_script_ref;
54512         to_holder_script_ref.datalen = to_holder_script->arr_len;
54513         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
54514         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
54515         LDKCVec_u8Z to_counterparty_script_ref;
54516         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
54517         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
54518         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
54519         LDKOutPoint funding_outpoint_conv;
54520         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
54521         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
54522         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
54523         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
54524         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
54525         uint64_t ret_ref = 0;
54526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54528         return ret_ref;
54529 }
54530
54531 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
54532         LDKClosingTransaction this_arg_conv;
54533         this_arg_conv.inner = untag_ptr(this_arg);
54534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54536         this_arg_conv.is_owned = false;
54537         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
54538         uint64_t ret_ref = 0;
54539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54541         return ret_ref;
54542 }
54543
54544 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
54545         LDKClosingTransaction this_arg_conv;
54546         this_arg_conv.inner = untag_ptr(this_arg);
54547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54549         this_arg_conv.is_owned = false;
54550         LDKOutPoint funding_outpoint_conv;
54551         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
54552         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
54553         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
54554         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
54555         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
54556         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
54557         return tag_ptr(ret_conv, true);
54558 }
54559
54560 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
54561         LDKClosingTransaction this_arg_conv;
54562         this_arg_conv.inner = untag_ptr(this_arg);
54563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54565         this_arg_conv.is_owned = false;
54566         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
54567         return ret_conv;
54568 }
54569
54570 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
54571         LDKClosingTransaction this_arg_conv;
54572         this_arg_conv.inner = untag_ptr(this_arg);
54573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54575         this_arg_conv.is_owned = false;
54576         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
54577         return ret_conv;
54578 }
54579
54580 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
54581         LDKClosingTransaction this_arg_conv;
54582         this_arg_conv.inner = untag_ptr(this_arg);
54583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54585         this_arg_conv.is_owned = false;
54586         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
54587         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54588         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54589         return ret_arr;
54590 }
54591
54592 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
54593         LDKClosingTransaction this_arg_conv;
54594         this_arg_conv.inner = untag_ptr(this_arg);
54595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54597         this_arg_conv.is_owned = false;
54598         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
54599         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54600         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54601         return ret_arr;
54602 }
54603
54604 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
54605         LDKTrustedClosingTransaction this_obj_conv;
54606         this_obj_conv.inner = untag_ptr(this_obj);
54607         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54609         TrustedClosingTransaction_free(this_obj_conv);
54610 }
54611
54612 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
54613         LDKTrustedClosingTransaction this_arg_conv;
54614         this_arg_conv.inner = untag_ptr(this_arg);
54615         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54617         this_arg_conv.is_owned = false;
54618         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
54619         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54620         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54621         Transaction_free(ret_var);
54622         return ret_arr;
54623 }
54624
54625 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) {
54626         LDKTrustedClosingTransaction this_arg_conv;
54627         this_arg_conv.inner = untag_ptr(this_arg);
54628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54630         this_arg_conv.is_owned = false;
54631         LDKu8slice funding_redeemscript_ref;
54632         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
54633         funding_redeemscript_ref.data = funding_redeemscript->elems;
54634         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54635         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
54636         FREE(funding_redeemscript);
54637         return ret_arr;
54638 }
54639
54640 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) {
54641         LDKTrustedClosingTransaction this_arg_conv;
54642         this_arg_conv.inner = untag_ptr(this_arg);
54643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54645         this_arg_conv.is_owned = false;
54646         uint8_t funding_key_arr[32];
54647         CHECK(funding_key->arr_len == 32);
54648         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
54649         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
54650         LDKu8slice funding_redeemscript_ref;
54651         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
54652         funding_redeemscript_ref.data = funding_redeemscript->elems;
54653         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54654         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
54655         FREE(funding_redeemscript);
54656         return ret_arr;
54657 }
54658
54659 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
54660         LDKCommitmentTransaction this_obj_conv;
54661         this_obj_conv.inner = untag_ptr(this_obj);
54662         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54664         CommitmentTransaction_free(this_obj_conv);
54665 }
54666
54667 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
54668         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
54669         uint64_t ret_ref = 0;
54670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54672         return ret_ref;
54673 }
54674 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
54675         LDKCommitmentTransaction arg_conv;
54676         arg_conv.inner = untag_ptr(arg);
54677         arg_conv.is_owned = ptr_is_owned(arg);
54678         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54679         arg_conv.is_owned = false;
54680         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
54681         return ret_conv;
54682 }
54683
54684 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
54685         LDKCommitmentTransaction orig_conv;
54686         orig_conv.inner = untag_ptr(orig);
54687         orig_conv.is_owned = ptr_is_owned(orig);
54688         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54689         orig_conv.is_owned = false;
54690         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
54691         uint64_t ret_ref = 0;
54692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54694         return ret_ref;
54695 }
54696
54697 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
54698         LDKCommitmentTransaction obj_conv;
54699         obj_conv.inner = untag_ptr(obj);
54700         obj_conv.is_owned = ptr_is_owned(obj);
54701         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54702         obj_conv.is_owned = false;
54703         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
54704         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54705         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54706         CVec_u8Z_free(ret_var);
54707         return ret_arr;
54708 }
54709
54710 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
54711         LDKu8slice ser_ref;
54712         ser_ref.datalen = ser->arr_len;
54713         ser_ref.data = ser->elems;
54714         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
54715         *ret_conv = CommitmentTransaction_read(ser_ref);
54716         FREE(ser);
54717         return tag_ptr(ret_conv, true);
54718 }
54719
54720 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
54721         LDKCommitmentTransaction this_arg_conv;
54722         this_arg_conv.inner = untag_ptr(this_arg);
54723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54725         this_arg_conv.is_owned = false;
54726         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
54727         return ret_conv;
54728 }
54729
54730 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_per_commitment_point"))) TS_CommitmentTransaction_per_commitment_point(uint64_t this_arg) {
54731         LDKCommitmentTransaction this_arg_conv;
54732         this_arg_conv.inner = untag_ptr(this_arg);
54733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54735         this_arg_conv.is_owned = false;
54736         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54737         memcpy(ret_arr->elems, CommitmentTransaction_per_commitment_point(&this_arg_conv).compressed_form, 33);
54738         return ret_arr;
54739 }
54740
54741 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
54742         LDKCommitmentTransaction this_arg_conv;
54743         this_arg_conv.inner = untag_ptr(this_arg);
54744         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54746         this_arg_conv.is_owned = false;
54747         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
54748         return ret_conv;
54749 }
54750
54751 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
54752         LDKCommitmentTransaction this_arg_conv;
54753         this_arg_conv.inner = untag_ptr(this_arg);
54754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54756         this_arg_conv.is_owned = false;
54757         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
54758         return ret_conv;
54759 }
54760
54761 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
54762         LDKCommitmentTransaction this_arg_conv;
54763         this_arg_conv.inner = untag_ptr(this_arg);
54764         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54766         this_arg_conv.is_owned = false;
54767         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
54768         return ret_conv;
54769 }
54770
54771 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
54772         LDKCommitmentTransaction this_arg_conv;
54773         this_arg_conv.inner = untag_ptr(this_arg);
54774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54776         this_arg_conv.is_owned = false;
54777         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
54778         uint64_t ret_ref = 0;
54779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54781         return ret_ref;
54782 }
54783
54784 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) {
54785         LDKCommitmentTransaction this_arg_conv;
54786         this_arg_conv.inner = untag_ptr(this_arg);
54787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54789         this_arg_conv.is_owned = false;
54790         LDKDirectedChannelTransactionParameters channel_parameters_conv;
54791         channel_parameters_conv.inner = untag_ptr(channel_parameters);
54792         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
54793         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
54794         channel_parameters_conv.is_owned = false;
54795         LDKChannelPublicKeys broadcaster_keys_conv;
54796         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
54797         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
54798         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
54799         broadcaster_keys_conv.is_owned = false;
54800         LDKChannelPublicKeys countersignatory_keys_conv;
54801         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
54802         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
54803         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
54804         countersignatory_keys_conv.is_owned = false;
54805         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
54806         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
54807         return tag_ptr(ret_conv, true);
54808 }
54809
54810 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
54811         LDKTrustedCommitmentTransaction this_obj_conv;
54812         this_obj_conv.inner = untag_ptr(this_obj);
54813         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54815         TrustedCommitmentTransaction_free(this_obj_conv);
54816 }
54817
54818 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
54819         LDKTrustedCommitmentTransaction this_arg_conv;
54820         this_arg_conv.inner = untag_ptr(this_arg);
54821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54823         this_arg_conv.is_owned = false;
54824         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54825         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
54826         return ret_arr;
54827 }
54828
54829 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
54830         LDKTrustedCommitmentTransaction this_arg_conv;
54831         this_arg_conv.inner = untag_ptr(this_arg);
54832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54834         this_arg_conv.is_owned = false;
54835         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
54836         uint64_t ret_ref = 0;
54837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54839         return ret_ref;
54840 }
54841
54842 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
54843         LDKTrustedCommitmentTransaction this_arg_conv;
54844         this_arg_conv.inner = untag_ptr(this_arg);
54845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54847         this_arg_conv.is_owned = false;
54848         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
54849         uint64_t ret_ref = 0;
54850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54852         return ret_ref;
54853 }
54854
54855 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_channel_type_features"))) TS_TrustedCommitmentTransaction_channel_type_features(uint64_t this_arg) {
54856         LDKTrustedCommitmentTransaction this_arg_conv;
54857         this_arg_conv.inner = untag_ptr(this_arg);
54858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54860         this_arg_conv.is_owned = false;
54861         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
54862         uint64_t ret_ref = 0;
54863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54865         return ret_ref;
54866 }
54867
54868 uint64_t  __attribute__((export_name("TS_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) {
54869         LDKTrustedCommitmentTransaction this_arg_conv;
54870         this_arg_conv.inner = untag_ptr(this_arg);
54871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54873         this_arg_conv.is_owned = false;
54874         uint8_t htlc_base_key_arr[32];
54875         CHECK(htlc_base_key->arr_len == 32);
54876         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
54877         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
54878         LDKDirectedChannelTransactionParameters channel_parameters_conv;
54879         channel_parameters_conv.inner = untag_ptr(channel_parameters);
54880         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
54881         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
54882         channel_parameters_conv.is_owned = false;
54883         void* entropy_source_ptr = untag_ptr(entropy_source);
54884         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
54885         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
54886         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
54887         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
54888         return tag_ptr(ret_conv, true);
54889 }
54890
54891 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_revokeable_output_index"))) TS_TrustedCommitmentTransaction_revokeable_output_index(uint64_t this_arg) {
54892         LDKTrustedCommitmentTransaction this_arg_conv;
54893         this_arg_conv.inner = untag_ptr(this_arg);
54894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54896         this_arg_conv.is_owned = false;
54897         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
54898         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
54899         uint64_t ret_ref = tag_ptr(ret_copy, true);
54900         return ret_ref;
54901 }
54902
54903 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_build_to_local_justice_tx"))) TS_TrustedCommitmentTransaction_build_to_local_justice_tx(uint64_t this_arg, int64_t feerate_per_kw, int8_tArray destination_script) {
54904         LDKTrustedCommitmentTransaction this_arg_conv;
54905         this_arg_conv.inner = untag_ptr(this_arg);
54906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54908         this_arg_conv.is_owned = false;
54909         LDKCVec_u8Z destination_script_ref;
54910         destination_script_ref.datalen = destination_script->arr_len;
54911         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
54912         memcpy(destination_script_ref.data, destination_script->elems, destination_script_ref.datalen); FREE(destination_script);
54913         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
54914         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
54915         return tag_ptr(ret_conv, true);
54916 }
54917
54918 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) {
54919         LDKPublicKey broadcaster_payment_basepoint_ref;
54920         CHECK(broadcaster_payment_basepoint->arr_len == 33);
54921         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
54922         LDKPublicKey countersignatory_payment_basepoint_ref;
54923         CHECK(countersignatory_payment_basepoint->arr_len == 33);
54924         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
54925         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
54926         return ret_conv;
54927 }
54928
54929 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
54930         LDKInitFeatures a_conv;
54931         a_conv.inner = untag_ptr(a);
54932         a_conv.is_owned = ptr_is_owned(a);
54933         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54934         a_conv.is_owned = false;
54935         LDKInitFeatures b_conv;
54936         b_conv.inner = untag_ptr(b);
54937         b_conv.is_owned = ptr_is_owned(b);
54938         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54939         b_conv.is_owned = false;
54940         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
54941         return ret_conv;
54942 }
54943
54944 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
54945         LDKNodeFeatures a_conv;
54946         a_conv.inner = untag_ptr(a);
54947         a_conv.is_owned = ptr_is_owned(a);
54948         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54949         a_conv.is_owned = false;
54950         LDKNodeFeatures b_conv;
54951         b_conv.inner = untag_ptr(b);
54952         b_conv.is_owned = ptr_is_owned(b);
54953         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54954         b_conv.is_owned = false;
54955         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
54956         return ret_conv;
54957 }
54958
54959 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
54960         LDKChannelFeatures a_conv;
54961         a_conv.inner = untag_ptr(a);
54962         a_conv.is_owned = ptr_is_owned(a);
54963         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54964         a_conv.is_owned = false;
54965         LDKChannelFeatures b_conv;
54966         b_conv.inner = untag_ptr(b);
54967         b_conv.is_owned = ptr_is_owned(b);
54968         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54969         b_conv.is_owned = false;
54970         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
54971         return ret_conv;
54972 }
54973
54974 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_eq"))) TS_Bolt11InvoiceFeatures_eq(uint64_t a, uint64_t b) {
54975         LDKBolt11InvoiceFeatures a_conv;
54976         a_conv.inner = untag_ptr(a);
54977         a_conv.is_owned = ptr_is_owned(a);
54978         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54979         a_conv.is_owned = false;
54980         LDKBolt11InvoiceFeatures b_conv;
54981         b_conv.inner = untag_ptr(b);
54982         b_conv.is_owned = ptr_is_owned(b);
54983         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54984         b_conv.is_owned = false;
54985         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
54986         return ret_conv;
54987 }
54988
54989 jboolean  __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) {
54990         LDKOfferFeatures a_conv;
54991         a_conv.inner = untag_ptr(a);
54992         a_conv.is_owned = ptr_is_owned(a);
54993         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54994         a_conv.is_owned = false;
54995         LDKOfferFeatures b_conv;
54996         b_conv.inner = untag_ptr(b);
54997         b_conv.is_owned = ptr_is_owned(b);
54998         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54999         b_conv.is_owned = false;
55000         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
55001         return ret_conv;
55002 }
55003
55004 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) {
55005         LDKInvoiceRequestFeatures a_conv;
55006         a_conv.inner = untag_ptr(a);
55007         a_conv.is_owned = ptr_is_owned(a);
55008         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55009         a_conv.is_owned = false;
55010         LDKInvoiceRequestFeatures b_conv;
55011         b_conv.inner = untag_ptr(b);
55012         b_conv.is_owned = ptr_is_owned(b);
55013         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55014         b_conv.is_owned = false;
55015         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
55016         return ret_conv;
55017 }
55018
55019 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_eq"))) TS_Bolt12InvoiceFeatures_eq(uint64_t a, uint64_t b) {
55020         LDKBolt12InvoiceFeatures a_conv;
55021         a_conv.inner = untag_ptr(a);
55022         a_conv.is_owned = ptr_is_owned(a);
55023         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55024         a_conv.is_owned = false;
55025         LDKBolt12InvoiceFeatures b_conv;
55026         b_conv.inner = untag_ptr(b);
55027         b_conv.is_owned = ptr_is_owned(b);
55028         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55029         b_conv.is_owned = false;
55030         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
55031         return ret_conv;
55032 }
55033
55034 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_eq"))) TS_BlindedHopFeatures_eq(uint64_t a, uint64_t b) {
55035         LDKBlindedHopFeatures a_conv;
55036         a_conv.inner = untag_ptr(a);
55037         a_conv.is_owned = ptr_is_owned(a);
55038         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55039         a_conv.is_owned = false;
55040         LDKBlindedHopFeatures b_conv;
55041         b_conv.inner = untag_ptr(b);
55042         b_conv.is_owned = ptr_is_owned(b);
55043         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55044         b_conv.is_owned = false;
55045         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
55046         return ret_conv;
55047 }
55048
55049 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
55050         LDKChannelTypeFeatures a_conv;
55051         a_conv.inner = untag_ptr(a);
55052         a_conv.is_owned = ptr_is_owned(a);
55053         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55054         a_conv.is_owned = false;
55055         LDKChannelTypeFeatures b_conv;
55056         b_conv.inner = untag_ptr(b);
55057         b_conv.is_owned = ptr_is_owned(b);
55058         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55059         b_conv.is_owned = false;
55060         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
55061         return ret_conv;
55062 }
55063
55064 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
55065         LDKInitFeatures ret_var = InitFeatures_clone(arg);
55066         uint64_t ret_ref = 0;
55067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55069         return ret_ref;
55070 }
55071 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
55072         LDKInitFeatures arg_conv;
55073         arg_conv.inner = untag_ptr(arg);
55074         arg_conv.is_owned = ptr_is_owned(arg);
55075         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55076         arg_conv.is_owned = false;
55077         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
55078         return ret_conv;
55079 }
55080
55081 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
55082         LDKInitFeatures orig_conv;
55083         orig_conv.inner = untag_ptr(orig);
55084         orig_conv.is_owned = ptr_is_owned(orig);
55085         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55086         orig_conv.is_owned = false;
55087         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
55088         uint64_t ret_ref = 0;
55089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55091         return ret_ref;
55092 }
55093
55094 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
55095         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
55096         uint64_t ret_ref = 0;
55097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55099         return ret_ref;
55100 }
55101 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
55102         LDKNodeFeatures arg_conv;
55103         arg_conv.inner = untag_ptr(arg);
55104         arg_conv.is_owned = ptr_is_owned(arg);
55105         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55106         arg_conv.is_owned = false;
55107         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
55108         return ret_conv;
55109 }
55110
55111 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
55112         LDKNodeFeatures orig_conv;
55113         orig_conv.inner = untag_ptr(orig);
55114         orig_conv.is_owned = ptr_is_owned(orig);
55115         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55116         orig_conv.is_owned = false;
55117         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
55118         uint64_t ret_ref = 0;
55119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55121         return ret_ref;
55122 }
55123
55124 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
55125         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
55126         uint64_t ret_ref = 0;
55127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55129         return ret_ref;
55130 }
55131 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
55132         LDKChannelFeatures arg_conv;
55133         arg_conv.inner = untag_ptr(arg);
55134         arg_conv.is_owned = ptr_is_owned(arg);
55135         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55136         arg_conv.is_owned = false;
55137         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
55138         return ret_conv;
55139 }
55140
55141 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
55142         LDKChannelFeatures orig_conv;
55143         orig_conv.inner = untag_ptr(orig);
55144         orig_conv.is_owned = ptr_is_owned(orig);
55145         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55146         orig_conv.is_owned = false;
55147         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
55148         uint64_t ret_ref = 0;
55149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55151         return ret_ref;
55152 }
55153
55154 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
55155         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
55156         uint64_t ret_ref = 0;
55157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55159         return ret_ref;
55160 }
55161 int64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone_ptr"))) TS_Bolt11InvoiceFeatures_clone_ptr(uint64_t arg) {
55162         LDKBolt11InvoiceFeatures arg_conv;
55163         arg_conv.inner = untag_ptr(arg);
55164         arg_conv.is_owned = ptr_is_owned(arg);
55165         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55166         arg_conv.is_owned = false;
55167         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
55168         return ret_conv;
55169 }
55170
55171 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone"))) TS_Bolt11InvoiceFeatures_clone(uint64_t orig) {
55172         LDKBolt11InvoiceFeatures orig_conv;
55173         orig_conv.inner = untag_ptr(orig);
55174         orig_conv.is_owned = ptr_is_owned(orig);
55175         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55176         orig_conv.is_owned = false;
55177         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
55178         uint64_t ret_ref = 0;
55179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55181         return ret_ref;
55182 }
55183
55184 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
55185         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
55186         uint64_t ret_ref = 0;
55187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55189         return ret_ref;
55190 }
55191 int64_t  __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) {
55192         LDKOfferFeatures arg_conv;
55193         arg_conv.inner = untag_ptr(arg);
55194         arg_conv.is_owned = ptr_is_owned(arg);
55195         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55196         arg_conv.is_owned = false;
55197         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
55198         return ret_conv;
55199 }
55200
55201 uint64_t  __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) {
55202         LDKOfferFeatures orig_conv;
55203         orig_conv.inner = untag_ptr(orig);
55204         orig_conv.is_owned = ptr_is_owned(orig);
55205         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55206         orig_conv.is_owned = false;
55207         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
55208         uint64_t ret_ref = 0;
55209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55211         return ret_ref;
55212 }
55213
55214 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
55215         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
55216         uint64_t ret_ref = 0;
55217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55219         return ret_ref;
55220 }
55221 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) {
55222         LDKInvoiceRequestFeatures arg_conv;
55223         arg_conv.inner = untag_ptr(arg);
55224         arg_conv.is_owned = ptr_is_owned(arg);
55225         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55226         arg_conv.is_owned = false;
55227         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
55228         return ret_conv;
55229 }
55230
55231 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) {
55232         LDKInvoiceRequestFeatures orig_conv;
55233         orig_conv.inner = untag_ptr(orig);
55234         orig_conv.is_owned = ptr_is_owned(orig);
55235         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55236         orig_conv.is_owned = false;
55237         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
55238         uint64_t ret_ref = 0;
55239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55241         return ret_ref;
55242 }
55243
55244 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
55245         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
55246         uint64_t ret_ref = 0;
55247         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55248         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55249         return ret_ref;
55250 }
55251 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone_ptr"))) TS_Bolt12InvoiceFeatures_clone_ptr(uint64_t arg) {
55252         LDKBolt12InvoiceFeatures arg_conv;
55253         arg_conv.inner = untag_ptr(arg);
55254         arg_conv.is_owned = ptr_is_owned(arg);
55255         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55256         arg_conv.is_owned = false;
55257         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
55258         return ret_conv;
55259 }
55260
55261 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone"))) TS_Bolt12InvoiceFeatures_clone(uint64_t orig) {
55262         LDKBolt12InvoiceFeatures orig_conv;
55263         orig_conv.inner = untag_ptr(orig);
55264         orig_conv.is_owned = ptr_is_owned(orig);
55265         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55266         orig_conv.is_owned = false;
55267         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
55268         uint64_t ret_ref = 0;
55269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55271         return ret_ref;
55272 }
55273
55274 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
55275         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
55276         uint64_t ret_ref = 0;
55277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55279         return ret_ref;
55280 }
55281 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone_ptr"))) TS_BlindedHopFeatures_clone_ptr(uint64_t arg) {
55282         LDKBlindedHopFeatures arg_conv;
55283         arg_conv.inner = untag_ptr(arg);
55284         arg_conv.is_owned = ptr_is_owned(arg);
55285         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55286         arg_conv.is_owned = false;
55287         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
55288         return ret_conv;
55289 }
55290
55291 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone"))) TS_BlindedHopFeatures_clone(uint64_t orig) {
55292         LDKBlindedHopFeatures orig_conv;
55293         orig_conv.inner = untag_ptr(orig);
55294         orig_conv.is_owned = ptr_is_owned(orig);
55295         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55296         orig_conv.is_owned = false;
55297         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
55298         uint64_t ret_ref = 0;
55299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55301         return ret_ref;
55302 }
55303
55304 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
55305         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
55306         uint64_t ret_ref = 0;
55307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55309         return ret_ref;
55310 }
55311 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
55312         LDKChannelTypeFeatures arg_conv;
55313         arg_conv.inner = untag_ptr(arg);
55314         arg_conv.is_owned = ptr_is_owned(arg);
55315         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55316         arg_conv.is_owned = false;
55317         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
55318         return ret_conv;
55319 }
55320
55321 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
55322         LDKChannelTypeFeatures orig_conv;
55323         orig_conv.inner = untag_ptr(orig);
55324         orig_conv.is_owned = ptr_is_owned(orig);
55325         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55326         orig_conv.is_owned = false;
55327         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
55328         uint64_t ret_ref = 0;
55329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55331         return ret_ref;
55332 }
55333
55334 int64_t  __attribute__((export_name("TS_InitFeatures_hash"))) TS_InitFeatures_hash(uint64_t o) {
55335         LDKInitFeatures o_conv;
55336         o_conv.inner = untag_ptr(o);
55337         o_conv.is_owned = ptr_is_owned(o);
55338         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55339         o_conv.is_owned = false;
55340         int64_t ret_conv = InitFeatures_hash(&o_conv);
55341         return ret_conv;
55342 }
55343
55344 int64_t  __attribute__((export_name("TS_NodeFeatures_hash"))) TS_NodeFeatures_hash(uint64_t o) {
55345         LDKNodeFeatures o_conv;
55346         o_conv.inner = untag_ptr(o);
55347         o_conv.is_owned = ptr_is_owned(o);
55348         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55349         o_conv.is_owned = false;
55350         int64_t ret_conv = NodeFeatures_hash(&o_conv);
55351         return ret_conv;
55352 }
55353
55354 int64_t  __attribute__((export_name("TS_ChannelFeatures_hash"))) TS_ChannelFeatures_hash(uint64_t o) {
55355         LDKChannelFeatures o_conv;
55356         o_conv.inner = untag_ptr(o);
55357         o_conv.is_owned = ptr_is_owned(o);
55358         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55359         o_conv.is_owned = false;
55360         int64_t ret_conv = ChannelFeatures_hash(&o_conv);
55361         return ret_conv;
55362 }
55363
55364 int64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_hash"))) TS_Bolt11InvoiceFeatures_hash(uint64_t o) {
55365         LDKBolt11InvoiceFeatures o_conv;
55366         o_conv.inner = untag_ptr(o);
55367         o_conv.is_owned = ptr_is_owned(o);
55368         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55369         o_conv.is_owned = false;
55370         int64_t ret_conv = Bolt11InvoiceFeatures_hash(&o_conv);
55371         return ret_conv;
55372 }
55373
55374 int64_t  __attribute__((export_name("TS_OfferFeatures_hash"))) TS_OfferFeatures_hash(uint64_t o) {
55375         LDKOfferFeatures o_conv;
55376         o_conv.inner = untag_ptr(o);
55377         o_conv.is_owned = ptr_is_owned(o);
55378         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55379         o_conv.is_owned = false;
55380         int64_t ret_conv = OfferFeatures_hash(&o_conv);
55381         return ret_conv;
55382 }
55383
55384 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_hash"))) TS_InvoiceRequestFeatures_hash(uint64_t o) {
55385         LDKInvoiceRequestFeatures o_conv;
55386         o_conv.inner = untag_ptr(o);
55387         o_conv.is_owned = ptr_is_owned(o);
55388         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55389         o_conv.is_owned = false;
55390         int64_t ret_conv = InvoiceRequestFeatures_hash(&o_conv);
55391         return ret_conv;
55392 }
55393
55394 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_hash"))) TS_Bolt12InvoiceFeatures_hash(uint64_t o) {
55395         LDKBolt12InvoiceFeatures o_conv;
55396         o_conv.inner = untag_ptr(o);
55397         o_conv.is_owned = ptr_is_owned(o);
55398         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55399         o_conv.is_owned = false;
55400         int64_t ret_conv = Bolt12InvoiceFeatures_hash(&o_conv);
55401         return ret_conv;
55402 }
55403
55404 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_hash"))) TS_BlindedHopFeatures_hash(uint64_t o) {
55405         LDKBlindedHopFeatures o_conv;
55406         o_conv.inner = untag_ptr(o);
55407         o_conv.is_owned = ptr_is_owned(o);
55408         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55409         o_conv.is_owned = false;
55410         int64_t ret_conv = BlindedHopFeatures_hash(&o_conv);
55411         return ret_conv;
55412 }
55413
55414 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_hash"))) TS_ChannelTypeFeatures_hash(uint64_t o) {
55415         LDKChannelTypeFeatures o_conv;
55416         o_conv.inner = untag_ptr(o);
55417         o_conv.is_owned = ptr_is_owned(o);
55418         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55419         o_conv.is_owned = false;
55420         int64_t ret_conv = ChannelTypeFeatures_hash(&o_conv);
55421         return ret_conv;
55422 }
55423
55424 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
55425         LDKInitFeatures this_obj_conv;
55426         this_obj_conv.inner = untag_ptr(this_obj);
55427         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55429         InitFeatures_free(this_obj_conv);
55430 }
55431
55432 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
55433         LDKNodeFeatures this_obj_conv;
55434         this_obj_conv.inner = untag_ptr(this_obj);
55435         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55437         NodeFeatures_free(this_obj_conv);
55438 }
55439
55440 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
55441         LDKChannelFeatures this_obj_conv;
55442         this_obj_conv.inner = untag_ptr(this_obj);
55443         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55445         ChannelFeatures_free(this_obj_conv);
55446 }
55447
55448 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_free"))) TS_Bolt11InvoiceFeatures_free(uint64_t this_obj) {
55449         LDKBolt11InvoiceFeatures this_obj_conv;
55450         this_obj_conv.inner = untag_ptr(this_obj);
55451         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55453         Bolt11InvoiceFeatures_free(this_obj_conv);
55454 }
55455
55456 void  __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) {
55457         LDKOfferFeatures this_obj_conv;
55458         this_obj_conv.inner = untag_ptr(this_obj);
55459         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55461         OfferFeatures_free(this_obj_conv);
55462 }
55463
55464 void  __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) {
55465         LDKInvoiceRequestFeatures this_obj_conv;
55466         this_obj_conv.inner = untag_ptr(this_obj);
55467         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55469         InvoiceRequestFeatures_free(this_obj_conv);
55470 }
55471
55472 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_free"))) TS_Bolt12InvoiceFeatures_free(uint64_t this_obj) {
55473         LDKBolt12InvoiceFeatures this_obj_conv;
55474         this_obj_conv.inner = untag_ptr(this_obj);
55475         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55477         Bolt12InvoiceFeatures_free(this_obj_conv);
55478 }
55479
55480 void  __attribute__((export_name("TS_BlindedHopFeatures_free"))) TS_BlindedHopFeatures_free(uint64_t this_obj) {
55481         LDKBlindedHopFeatures this_obj_conv;
55482         this_obj_conv.inner = untag_ptr(this_obj);
55483         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55485         BlindedHopFeatures_free(this_obj_conv);
55486 }
55487
55488 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
55489         LDKChannelTypeFeatures this_obj_conv;
55490         this_obj_conv.inner = untag_ptr(this_obj);
55491         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55493         ChannelTypeFeatures_free(this_obj_conv);
55494 }
55495
55496 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
55497         LDKInitFeatures ret_var = InitFeatures_empty();
55498         uint64_t ret_ref = 0;
55499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55501         return ret_ref;
55502 }
55503
55504 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits_from"))) TS_InitFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
55505         LDKInitFeatures this_arg_conv;
55506         this_arg_conv.inner = untag_ptr(this_arg);
55507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55509         this_arg_conv.is_owned = false;
55510         LDKInitFeatures other_conv;
55511         other_conv.inner = untag_ptr(other);
55512         other_conv.is_owned = ptr_is_owned(other);
55513         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55514         other_conv.is_owned = false;
55515         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55516         return ret_conv;
55517 }
55518
55519 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
55520         LDKInitFeatures this_arg_conv;
55521         this_arg_conv.inner = untag_ptr(this_arg);
55522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55524         this_arg_conv.is_owned = false;
55525         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
55526         return ret_conv;
55527 }
55528
55529 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_feature_bit"))) TS_InitFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
55530         LDKInitFeatures this_arg_conv;
55531         this_arg_conv.inner = untag_ptr(this_arg);
55532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55534         this_arg_conv.is_owned = false;
55535         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55536         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
55537         return tag_ptr(ret_conv, true);
55538 }
55539
55540 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_feature_bit"))) TS_InitFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
55541         LDKInitFeatures this_arg_conv;
55542         this_arg_conv.inner = untag_ptr(this_arg);
55543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55545         this_arg_conv.is_owned = false;
55546         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55547         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55548         return tag_ptr(ret_conv, true);
55549 }
55550
55551 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_custom_bit"))) TS_InitFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
55552         LDKInitFeatures this_arg_conv;
55553         this_arg_conv.inner = untag_ptr(this_arg);
55554         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55556         this_arg_conv.is_owned = false;
55557         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55558         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
55559         return tag_ptr(ret_conv, true);
55560 }
55561
55562 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_custom_bit"))) TS_InitFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
55563         LDKInitFeatures this_arg_conv;
55564         this_arg_conv.inner = untag_ptr(this_arg);
55565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55567         this_arg_conv.is_owned = false;
55568         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55569         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55570         return tag_ptr(ret_conv, true);
55571 }
55572
55573 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
55574         LDKNodeFeatures ret_var = NodeFeatures_empty();
55575         uint64_t ret_ref = 0;
55576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55578         return ret_ref;
55579 }
55580
55581 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits_from"))) TS_NodeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
55582         LDKNodeFeatures this_arg_conv;
55583         this_arg_conv.inner = untag_ptr(this_arg);
55584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55586         this_arg_conv.is_owned = false;
55587         LDKNodeFeatures other_conv;
55588         other_conv.inner = untag_ptr(other);
55589         other_conv.is_owned = ptr_is_owned(other);
55590         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55591         other_conv.is_owned = false;
55592         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55593         return ret_conv;
55594 }
55595
55596 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
55597         LDKNodeFeatures this_arg_conv;
55598         this_arg_conv.inner = untag_ptr(this_arg);
55599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55601         this_arg_conv.is_owned = false;
55602         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
55603         return ret_conv;
55604 }
55605
55606 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_feature_bit"))) TS_NodeFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
55607         LDKNodeFeatures this_arg_conv;
55608         this_arg_conv.inner = untag_ptr(this_arg);
55609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55611         this_arg_conv.is_owned = false;
55612         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55613         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
55614         return tag_ptr(ret_conv, true);
55615 }
55616
55617 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_feature_bit"))) TS_NodeFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
55618         LDKNodeFeatures this_arg_conv;
55619         this_arg_conv.inner = untag_ptr(this_arg);
55620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55622         this_arg_conv.is_owned = false;
55623         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55624         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55625         return tag_ptr(ret_conv, true);
55626 }
55627
55628 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_custom_bit"))) TS_NodeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
55629         LDKNodeFeatures this_arg_conv;
55630         this_arg_conv.inner = untag_ptr(this_arg);
55631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55633         this_arg_conv.is_owned = false;
55634         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55635         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
55636         return tag_ptr(ret_conv, true);
55637 }
55638
55639 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_custom_bit"))) TS_NodeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
55640         LDKNodeFeatures this_arg_conv;
55641         this_arg_conv.inner = untag_ptr(this_arg);
55642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55644         this_arg_conv.is_owned = false;
55645         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55646         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55647         return tag_ptr(ret_conv, true);
55648 }
55649
55650 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
55651         LDKChannelFeatures ret_var = ChannelFeatures_empty();
55652         uint64_t ret_ref = 0;
55653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55655         return ret_ref;
55656 }
55657
55658 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits_from"))) TS_ChannelFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
55659         LDKChannelFeatures this_arg_conv;
55660         this_arg_conv.inner = untag_ptr(this_arg);
55661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55663         this_arg_conv.is_owned = false;
55664         LDKChannelFeatures other_conv;
55665         other_conv.inner = untag_ptr(other);
55666         other_conv.is_owned = ptr_is_owned(other);
55667         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55668         other_conv.is_owned = false;
55669         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55670         return ret_conv;
55671 }
55672
55673 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
55674         LDKChannelFeatures this_arg_conv;
55675         this_arg_conv.inner = untag_ptr(this_arg);
55676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55678         this_arg_conv.is_owned = false;
55679         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
55680         return ret_conv;
55681 }
55682
55683 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_feature_bit"))) TS_ChannelFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
55684         LDKChannelFeatures this_arg_conv;
55685         this_arg_conv.inner = untag_ptr(this_arg);
55686         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55688         this_arg_conv.is_owned = false;
55689         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55690         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
55691         return tag_ptr(ret_conv, true);
55692 }
55693
55694 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_feature_bit"))) TS_ChannelFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
55695         LDKChannelFeatures this_arg_conv;
55696         this_arg_conv.inner = untag_ptr(this_arg);
55697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55699         this_arg_conv.is_owned = false;
55700         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55701         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55702         return tag_ptr(ret_conv, true);
55703 }
55704
55705 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_custom_bit"))) TS_ChannelFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
55706         LDKChannelFeatures this_arg_conv;
55707         this_arg_conv.inner = untag_ptr(this_arg);
55708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55710         this_arg_conv.is_owned = false;
55711         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55712         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
55713         return tag_ptr(ret_conv, true);
55714 }
55715
55716 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_custom_bit"))) TS_ChannelFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
55717         LDKChannelFeatures this_arg_conv;
55718         this_arg_conv.inner = untag_ptr(this_arg);
55719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55721         this_arg_conv.is_owned = false;
55722         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55723         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55724         return tag_ptr(ret_conv, true);
55725 }
55726
55727 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_empty"))) TS_Bolt11InvoiceFeatures_empty() {
55728         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
55729         uint64_t ret_ref = 0;
55730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55732         return ret_ref;
55733 }
55734
55735 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
55736         LDKBolt11InvoiceFeatures this_arg_conv;
55737         this_arg_conv.inner = untag_ptr(this_arg);
55738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55740         this_arg_conv.is_owned = false;
55741         LDKBolt11InvoiceFeatures other_conv;
55742         other_conv.inner = untag_ptr(other);
55743         other_conv.is_owned = ptr_is_owned(other);
55744         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55745         other_conv.is_owned = false;
55746         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55747         return ret_conv;
55748 }
55749
55750 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
55751         LDKBolt11InvoiceFeatures this_arg_conv;
55752         this_arg_conv.inner = untag_ptr(this_arg);
55753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55755         this_arg_conv.is_owned = false;
55756         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
55757         return ret_conv;
55758 }
55759
55760 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_feature_bit"))) TS_Bolt11InvoiceFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
55761         LDKBolt11InvoiceFeatures this_arg_conv;
55762         this_arg_conv.inner = untag_ptr(this_arg);
55763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55765         this_arg_conv.is_owned = false;
55766         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55767         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
55768         return tag_ptr(ret_conv, true);
55769 }
55770
55771 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_feature_bit"))) TS_Bolt11InvoiceFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
55772         LDKBolt11InvoiceFeatures this_arg_conv;
55773         this_arg_conv.inner = untag_ptr(this_arg);
55774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55776         this_arg_conv.is_owned = false;
55777         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55778         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55779         return tag_ptr(ret_conv, true);
55780 }
55781
55782 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_custom_bit"))) TS_Bolt11InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
55783         LDKBolt11InvoiceFeatures this_arg_conv;
55784         this_arg_conv.inner = untag_ptr(this_arg);
55785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55787         this_arg_conv.is_owned = false;
55788         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55789         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
55790         return tag_ptr(ret_conv, true);
55791 }
55792
55793 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt11InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
55794         LDKBolt11InvoiceFeatures this_arg_conv;
55795         this_arg_conv.inner = untag_ptr(this_arg);
55796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55798         this_arg_conv.is_owned = false;
55799         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55800         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55801         return tag_ptr(ret_conv, true);
55802 }
55803
55804 uint64_t  __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() {
55805         LDKOfferFeatures ret_var = OfferFeatures_empty();
55806         uint64_t ret_ref = 0;
55807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55809         return ret_ref;
55810 }
55811
55812 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits_from"))) TS_OfferFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
55813         LDKOfferFeatures this_arg_conv;
55814         this_arg_conv.inner = untag_ptr(this_arg);
55815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55817         this_arg_conv.is_owned = false;
55818         LDKOfferFeatures other_conv;
55819         other_conv.inner = untag_ptr(other);
55820         other_conv.is_owned = ptr_is_owned(other);
55821         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55822         other_conv.is_owned = false;
55823         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55824         return ret_conv;
55825 }
55826
55827 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) {
55828         LDKOfferFeatures this_arg_conv;
55829         this_arg_conv.inner = untag_ptr(this_arg);
55830         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55832         this_arg_conv.is_owned = false;
55833         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
55834         return ret_conv;
55835 }
55836
55837 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_feature_bit"))) TS_OfferFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
55838         LDKOfferFeatures this_arg_conv;
55839         this_arg_conv.inner = untag_ptr(this_arg);
55840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55842         this_arg_conv.is_owned = false;
55843         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55844         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
55845         return tag_ptr(ret_conv, true);
55846 }
55847
55848 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_feature_bit"))) TS_OfferFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
55849         LDKOfferFeatures this_arg_conv;
55850         this_arg_conv.inner = untag_ptr(this_arg);
55851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55853         this_arg_conv.is_owned = false;
55854         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55855         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55856         return tag_ptr(ret_conv, true);
55857 }
55858
55859 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_custom_bit"))) TS_OfferFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
55860         LDKOfferFeatures this_arg_conv;
55861         this_arg_conv.inner = untag_ptr(this_arg);
55862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55864         this_arg_conv.is_owned = false;
55865         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55866         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
55867         return tag_ptr(ret_conv, true);
55868 }
55869
55870 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_custom_bit"))) TS_OfferFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
55871         LDKOfferFeatures this_arg_conv;
55872         this_arg_conv.inner = untag_ptr(this_arg);
55873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55875         this_arg_conv.is_owned = false;
55876         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55877         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55878         return tag_ptr(ret_conv, true);
55879 }
55880
55881 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() {
55882         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
55883         uint64_t ret_ref = 0;
55884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55886         return ret_ref;
55887 }
55888
55889 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits_from"))) TS_InvoiceRequestFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
55890         LDKInvoiceRequestFeatures this_arg_conv;
55891         this_arg_conv.inner = untag_ptr(this_arg);
55892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55894         this_arg_conv.is_owned = false;
55895         LDKInvoiceRequestFeatures other_conv;
55896         other_conv.inner = untag_ptr(other);
55897         other_conv.is_owned = ptr_is_owned(other);
55898         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55899         other_conv.is_owned = false;
55900         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55901         return ret_conv;
55902 }
55903
55904 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) {
55905         LDKInvoiceRequestFeatures this_arg_conv;
55906         this_arg_conv.inner = untag_ptr(this_arg);
55907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55909         this_arg_conv.is_owned = false;
55910         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
55911         return ret_conv;
55912 }
55913
55914 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_feature_bit"))) TS_InvoiceRequestFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
55915         LDKInvoiceRequestFeatures this_arg_conv;
55916         this_arg_conv.inner = untag_ptr(this_arg);
55917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55919         this_arg_conv.is_owned = false;
55920         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55921         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
55922         return tag_ptr(ret_conv, true);
55923 }
55924
55925 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_feature_bit"))) TS_InvoiceRequestFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
55926         LDKInvoiceRequestFeatures this_arg_conv;
55927         this_arg_conv.inner = untag_ptr(this_arg);
55928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55930         this_arg_conv.is_owned = false;
55931         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55932         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55933         return tag_ptr(ret_conv, true);
55934 }
55935
55936 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_custom_bit"))) TS_InvoiceRequestFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
55937         LDKInvoiceRequestFeatures this_arg_conv;
55938         this_arg_conv.inner = untag_ptr(this_arg);
55939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55941         this_arg_conv.is_owned = false;
55942         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55943         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
55944         return tag_ptr(ret_conv, true);
55945 }
55946
55947 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_custom_bit"))) TS_InvoiceRequestFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
55948         LDKInvoiceRequestFeatures this_arg_conv;
55949         this_arg_conv.inner = untag_ptr(this_arg);
55950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55952         this_arg_conv.is_owned = false;
55953         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55954         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55955         return tag_ptr(ret_conv, true);
55956 }
55957
55958 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_empty"))) TS_Bolt12InvoiceFeatures_empty() {
55959         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
55960         uint64_t ret_ref = 0;
55961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55963         return ret_ref;
55964 }
55965
55966 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
55967         LDKBolt12InvoiceFeatures this_arg_conv;
55968         this_arg_conv.inner = untag_ptr(this_arg);
55969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55971         this_arg_conv.is_owned = false;
55972         LDKBolt12InvoiceFeatures other_conv;
55973         other_conv.inner = untag_ptr(other);
55974         other_conv.is_owned = ptr_is_owned(other);
55975         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55976         other_conv.is_owned = false;
55977         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55978         return ret_conv;
55979 }
55980
55981 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
55982         LDKBolt12InvoiceFeatures this_arg_conv;
55983         this_arg_conv.inner = untag_ptr(this_arg);
55984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55986         this_arg_conv.is_owned = false;
55987         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
55988         return ret_conv;
55989 }
55990
55991 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_feature_bit"))) TS_Bolt12InvoiceFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
55992         LDKBolt12InvoiceFeatures this_arg_conv;
55993         this_arg_conv.inner = untag_ptr(this_arg);
55994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55996         this_arg_conv.is_owned = false;
55997         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55998         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
55999         return tag_ptr(ret_conv, true);
56000 }
56001
56002 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_feature_bit"))) TS_Bolt12InvoiceFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
56003         LDKBolt12InvoiceFeatures this_arg_conv;
56004         this_arg_conv.inner = untag_ptr(this_arg);
56005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56007         this_arg_conv.is_owned = false;
56008         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56009         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56010         return tag_ptr(ret_conv, true);
56011 }
56012
56013 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_custom_bit"))) TS_Bolt12InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
56014         LDKBolt12InvoiceFeatures this_arg_conv;
56015         this_arg_conv.inner = untag_ptr(this_arg);
56016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56018         this_arg_conv.is_owned = false;
56019         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56020         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
56021         return tag_ptr(ret_conv, true);
56022 }
56023
56024 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt12InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
56025         LDKBolt12InvoiceFeatures this_arg_conv;
56026         this_arg_conv.inner = untag_ptr(this_arg);
56027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56029         this_arg_conv.is_owned = false;
56030         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56031         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56032         return tag_ptr(ret_conv, true);
56033 }
56034
56035 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_empty"))) TS_BlindedHopFeatures_empty() {
56036         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
56037         uint64_t ret_ref = 0;
56038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56040         return ret_ref;
56041 }
56042
56043 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits_from"))) TS_BlindedHopFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
56044         LDKBlindedHopFeatures this_arg_conv;
56045         this_arg_conv.inner = untag_ptr(this_arg);
56046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56048         this_arg_conv.is_owned = false;
56049         LDKBlindedHopFeatures other_conv;
56050         other_conv.inner = untag_ptr(other);
56051         other_conv.is_owned = ptr_is_owned(other);
56052         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56053         other_conv.is_owned = false;
56054         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56055         return ret_conv;
56056 }
56057
56058 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits"))) TS_BlindedHopFeatures_requires_unknown_bits(uint64_t this_arg) {
56059         LDKBlindedHopFeatures this_arg_conv;
56060         this_arg_conv.inner = untag_ptr(this_arg);
56061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56063         this_arg_conv.is_owned = false;
56064         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
56065         return ret_conv;
56066 }
56067
56068 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_feature_bit"))) TS_BlindedHopFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
56069         LDKBlindedHopFeatures this_arg_conv;
56070         this_arg_conv.inner = untag_ptr(this_arg);
56071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56073         this_arg_conv.is_owned = false;
56074         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56075         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
56076         return tag_ptr(ret_conv, true);
56077 }
56078
56079 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_feature_bit"))) TS_BlindedHopFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
56080         LDKBlindedHopFeatures this_arg_conv;
56081         this_arg_conv.inner = untag_ptr(this_arg);
56082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56084         this_arg_conv.is_owned = false;
56085         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56086         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56087         return tag_ptr(ret_conv, true);
56088 }
56089
56090 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_custom_bit"))) TS_BlindedHopFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
56091         LDKBlindedHopFeatures this_arg_conv;
56092         this_arg_conv.inner = untag_ptr(this_arg);
56093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56095         this_arg_conv.is_owned = false;
56096         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56097         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
56098         return tag_ptr(ret_conv, true);
56099 }
56100
56101 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_custom_bit"))) TS_BlindedHopFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
56102         LDKBlindedHopFeatures this_arg_conv;
56103         this_arg_conv.inner = untag_ptr(this_arg);
56104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56106         this_arg_conv.is_owned = false;
56107         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56108         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56109         return tag_ptr(ret_conv, true);
56110 }
56111
56112 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
56113         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
56114         uint64_t ret_ref = 0;
56115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56117         return ret_ref;
56118 }
56119
56120 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits_from"))) TS_ChannelTypeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
56121         LDKChannelTypeFeatures this_arg_conv;
56122         this_arg_conv.inner = untag_ptr(this_arg);
56123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56125         this_arg_conv.is_owned = false;
56126         LDKChannelTypeFeatures other_conv;
56127         other_conv.inner = untag_ptr(other);
56128         other_conv.is_owned = ptr_is_owned(other);
56129         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56130         other_conv.is_owned = false;
56131         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56132         return ret_conv;
56133 }
56134
56135 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
56136         LDKChannelTypeFeatures this_arg_conv;
56137         this_arg_conv.inner = untag_ptr(this_arg);
56138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56140         this_arg_conv.is_owned = false;
56141         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
56142         return ret_conv;
56143 }
56144
56145 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_feature_bit"))) TS_ChannelTypeFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
56146         LDKChannelTypeFeatures this_arg_conv;
56147         this_arg_conv.inner = untag_ptr(this_arg);
56148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56150         this_arg_conv.is_owned = false;
56151         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56152         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
56153         return tag_ptr(ret_conv, true);
56154 }
56155
56156 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_feature_bit"))) TS_ChannelTypeFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
56157         LDKChannelTypeFeatures this_arg_conv;
56158         this_arg_conv.inner = untag_ptr(this_arg);
56159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56161         this_arg_conv.is_owned = false;
56162         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56163         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56164         return tag_ptr(ret_conv, true);
56165 }
56166
56167 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_custom_bit"))) TS_ChannelTypeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
56168         LDKChannelTypeFeatures this_arg_conv;
56169         this_arg_conv.inner = untag_ptr(this_arg);
56170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56172         this_arg_conv.is_owned = false;
56173         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56174         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
56175         return tag_ptr(ret_conv, true);
56176 }
56177
56178 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_custom_bit"))) TS_ChannelTypeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
56179         LDKChannelTypeFeatures this_arg_conv;
56180         this_arg_conv.inner = untag_ptr(this_arg);
56181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56183         this_arg_conv.is_owned = false;
56184         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56185         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56186         return tag_ptr(ret_conv, true);
56187 }
56188
56189 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
56190         LDKInitFeatures obj_conv;
56191         obj_conv.inner = untag_ptr(obj);
56192         obj_conv.is_owned = ptr_is_owned(obj);
56193         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56194         obj_conv.is_owned = false;
56195         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
56196         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56197         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56198         CVec_u8Z_free(ret_var);
56199         return ret_arr;
56200 }
56201
56202 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
56203         LDKu8slice ser_ref;
56204         ser_ref.datalen = ser->arr_len;
56205         ser_ref.data = ser->elems;
56206         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
56207         *ret_conv = InitFeatures_read(ser_ref);
56208         FREE(ser);
56209         return tag_ptr(ret_conv, true);
56210 }
56211
56212 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
56213         LDKChannelFeatures obj_conv;
56214         obj_conv.inner = untag_ptr(obj);
56215         obj_conv.is_owned = ptr_is_owned(obj);
56216         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56217         obj_conv.is_owned = false;
56218         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
56219         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56220         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56221         CVec_u8Z_free(ret_var);
56222         return ret_arr;
56223 }
56224
56225 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
56226         LDKu8slice ser_ref;
56227         ser_ref.datalen = ser->arr_len;
56228         ser_ref.data = ser->elems;
56229         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
56230         *ret_conv = ChannelFeatures_read(ser_ref);
56231         FREE(ser);
56232         return tag_ptr(ret_conv, true);
56233 }
56234
56235 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
56236         LDKNodeFeatures obj_conv;
56237         obj_conv.inner = untag_ptr(obj);
56238         obj_conv.is_owned = ptr_is_owned(obj);
56239         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56240         obj_conv.is_owned = false;
56241         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
56242         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56243         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56244         CVec_u8Z_free(ret_var);
56245         return ret_arr;
56246 }
56247
56248 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
56249         LDKu8slice ser_ref;
56250         ser_ref.datalen = ser->arr_len;
56251         ser_ref.data = ser->elems;
56252         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
56253         *ret_conv = NodeFeatures_read(ser_ref);
56254         FREE(ser);
56255         return tag_ptr(ret_conv, true);
56256 }
56257
56258 int8_tArray  __attribute__((export_name("TS_Bolt11InvoiceFeatures_write"))) TS_Bolt11InvoiceFeatures_write(uint64_t obj) {
56259         LDKBolt11InvoiceFeatures obj_conv;
56260         obj_conv.inner = untag_ptr(obj);
56261         obj_conv.is_owned = ptr_is_owned(obj);
56262         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56263         obj_conv.is_owned = false;
56264         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
56265         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56266         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56267         CVec_u8Z_free(ret_var);
56268         return ret_arr;
56269 }
56270
56271 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_read"))) TS_Bolt11InvoiceFeatures_read(int8_tArray ser) {
56272         LDKu8slice ser_ref;
56273         ser_ref.datalen = ser->arr_len;
56274         ser_ref.data = ser->elems;
56275         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
56276         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
56277         FREE(ser);
56278         return tag_ptr(ret_conv, true);
56279 }
56280
56281 int8_tArray  __attribute__((export_name("TS_Bolt12InvoiceFeatures_write"))) TS_Bolt12InvoiceFeatures_write(uint64_t obj) {
56282         LDKBolt12InvoiceFeatures obj_conv;
56283         obj_conv.inner = untag_ptr(obj);
56284         obj_conv.is_owned = ptr_is_owned(obj);
56285         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56286         obj_conv.is_owned = false;
56287         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
56288         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56289         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56290         CVec_u8Z_free(ret_var);
56291         return ret_arr;
56292 }
56293
56294 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_read"))) TS_Bolt12InvoiceFeatures_read(int8_tArray ser) {
56295         LDKu8slice ser_ref;
56296         ser_ref.datalen = ser->arr_len;
56297         ser_ref.data = ser->elems;
56298         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
56299         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
56300         FREE(ser);
56301         return tag_ptr(ret_conv, true);
56302 }
56303
56304 int8_tArray  __attribute__((export_name("TS_BlindedHopFeatures_write"))) TS_BlindedHopFeatures_write(uint64_t obj) {
56305         LDKBlindedHopFeatures obj_conv;
56306         obj_conv.inner = untag_ptr(obj);
56307         obj_conv.is_owned = ptr_is_owned(obj);
56308         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56309         obj_conv.is_owned = false;
56310         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
56311         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56312         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56313         CVec_u8Z_free(ret_var);
56314         return ret_arr;
56315 }
56316
56317 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_read"))) TS_BlindedHopFeatures_read(int8_tArray ser) {
56318         LDKu8slice ser_ref;
56319         ser_ref.datalen = ser->arr_len;
56320         ser_ref.data = ser->elems;
56321         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
56322         *ret_conv = BlindedHopFeatures_read(ser_ref);
56323         FREE(ser);
56324         return tag_ptr(ret_conv, true);
56325 }
56326
56327 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
56328         LDKChannelTypeFeatures obj_conv;
56329         obj_conv.inner = untag_ptr(obj);
56330         obj_conv.is_owned = ptr_is_owned(obj);
56331         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56332         obj_conv.is_owned = false;
56333         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
56334         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56335         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56336         CVec_u8Z_free(ret_var);
56337         return ret_arr;
56338 }
56339
56340 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
56341         LDKu8slice ser_ref;
56342         ser_ref.datalen = ser->arr_len;
56343         ser_ref.data = ser->elems;
56344         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
56345         *ret_conv = ChannelTypeFeatures_read(ser_ref);
56346         FREE(ser);
56347         return tag_ptr(ret_conv, true);
56348 }
56349
56350 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
56351         LDKInitFeatures this_arg_conv;
56352         this_arg_conv.inner = untag_ptr(this_arg);
56353         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56355         this_arg_conv.is_owned = false;
56356         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
56357 }
56358
56359 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
56360         LDKInitFeatures this_arg_conv;
56361         this_arg_conv.inner = untag_ptr(this_arg);
56362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56364         this_arg_conv.is_owned = false;
56365         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
56366 }
56367
56368 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
56369         LDKInitFeatures this_arg_conv;
56370         this_arg_conv.inner = untag_ptr(this_arg);
56371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56373         this_arg_conv.is_owned = false;
56374         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
56375         return ret_conv;
56376 }
56377
56378 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
56379         LDKNodeFeatures this_arg_conv;
56380         this_arg_conv.inner = untag_ptr(this_arg);
56381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56383         this_arg_conv.is_owned = false;
56384         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
56385 }
56386
56387 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
56388         LDKNodeFeatures this_arg_conv;
56389         this_arg_conv.inner = untag_ptr(this_arg);
56390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56392         this_arg_conv.is_owned = false;
56393         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
56394 }
56395
56396 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
56397         LDKNodeFeatures this_arg_conv;
56398         this_arg_conv.inner = untag_ptr(this_arg);
56399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56401         this_arg_conv.is_owned = false;
56402         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
56403         return ret_conv;
56404 }
56405
56406 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
56407         LDKInitFeatures this_arg_conv;
56408         this_arg_conv.inner = untag_ptr(this_arg);
56409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56411         this_arg_conv.is_owned = false;
56412         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
56413         return ret_conv;
56414 }
56415
56416 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
56417         LDKNodeFeatures this_arg_conv;
56418         this_arg_conv.inner = untag_ptr(this_arg);
56419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56421         this_arg_conv.is_owned = false;
56422         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
56423         return ret_conv;
56424 }
56425
56426 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
56427         LDKInitFeatures this_arg_conv;
56428         this_arg_conv.inner = untag_ptr(this_arg);
56429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56431         this_arg_conv.is_owned = false;
56432         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
56433 }
56434
56435 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
56436         LDKInitFeatures this_arg_conv;
56437         this_arg_conv.inner = untag_ptr(this_arg);
56438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56440         this_arg_conv.is_owned = false;
56441         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
56442 }
56443
56444 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
56445         LDKInitFeatures this_arg_conv;
56446         this_arg_conv.inner = untag_ptr(this_arg);
56447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56449         this_arg_conv.is_owned = false;
56450         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
56451         return ret_conv;
56452 }
56453
56454 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
56455         LDKInitFeatures this_arg_conv;
56456         this_arg_conv.inner = untag_ptr(this_arg);
56457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56459         this_arg_conv.is_owned = false;
56460         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
56461 }
56462
56463 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
56464         LDKInitFeatures 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         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
56470 }
56471
56472 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
56473         LDKInitFeatures this_arg_conv;
56474         this_arg_conv.inner = untag_ptr(this_arg);
56475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56477         this_arg_conv.is_owned = false;
56478         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
56479         return ret_conv;
56480 }
56481
56482 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
56483         LDKNodeFeatures this_arg_conv;
56484         this_arg_conv.inner = untag_ptr(this_arg);
56485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56487         this_arg_conv.is_owned = false;
56488         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
56489 }
56490
56491 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
56492         LDKNodeFeatures this_arg_conv;
56493         this_arg_conv.inner = untag_ptr(this_arg);
56494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56496         this_arg_conv.is_owned = false;
56497         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
56498 }
56499
56500 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
56501         LDKNodeFeatures this_arg_conv;
56502         this_arg_conv.inner = untag_ptr(this_arg);
56503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56505         this_arg_conv.is_owned = false;
56506         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
56507         return ret_conv;
56508 }
56509
56510 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
56511         LDKInitFeatures this_arg_conv;
56512         this_arg_conv.inner = untag_ptr(this_arg);
56513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56515         this_arg_conv.is_owned = false;
56516         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
56517         return ret_conv;
56518 }
56519
56520 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
56521         LDKNodeFeatures this_arg_conv;
56522         this_arg_conv.inner = untag_ptr(this_arg);
56523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56525         this_arg_conv.is_owned = false;
56526         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
56527         return ret_conv;
56528 }
56529
56530 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
56531         LDKInitFeatures this_arg_conv;
56532         this_arg_conv.inner = untag_ptr(this_arg);
56533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56535         this_arg_conv.is_owned = false;
56536         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
56537 }
56538
56539 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
56540         LDKInitFeatures this_arg_conv;
56541         this_arg_conv.inner = untag_ptr(this_arg);
56542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56544         this_arg_conv.is_owned = false;
56545         InitFeatures_set_gossip_queries_required(&this_arg_conv);
56546 }
56547
56548 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
56549         LDKInitFeatures this_arg_conv;
56550         this_arg_conv.inner = untag_ptr(this_arg);
56551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56553         this_arg_conv.is_owned = false;
56554         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
56555         return ret_conv;
56556 }
56557
56558 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
56559         LDKNodeFeatures this_arg_conv;
56560         this_arg_conv.inner = untag_ptr(this_arg);
56561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56563         this_arg_conv.is_owned = false;
56564         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
56565 }
56566
56567 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
56568         LDKNodeFeatures this_arg_conv;
56569         this_arg_conv.inner = untag_ptr(this_arg);
56570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56572         this_arg_conv.is_owned = false;
56573         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
56574 }
56575
56576 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
56577         LDKNodeFeatures this_arg_conv;
56578         this_arg_conv.inner = untag_ptr(this_arg);
56579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56581         this_arg_conv.is_owned = false;
56582         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
56583         return ret_conv;
56584 }
56585
56586 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
56587         LDKInitFeatures this_arg_conv;
56588         this_arg_conv.inner = untag_ptr(this_arg);
56589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56591         this_arg_conv.is_owned = false;
56592         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
56593         return ret_conv;
56594 }
56595
56596 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
56597         LDKNodeFeatures this_arg_conv;
56598         this_arg_conv.inner = untag_ptr(this_arg);
56599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56601         this_arg_conv.is_owned = false;
56602         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
56603         return ret_conv;
56604 }
56605
56606 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
56607         LDKInitFeatures this_arg_conv;
56608         this_arg_conv.inner = untag_ptr(this_arg);
56609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56611         this_arg_conv.is_owned = false;
56612         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
56613 }
56614
56615 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
56616         LDKInitFeatures this_arg_conv;
56617         this_arg_conv.inner = untag_ptr(this_arg);
56618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56620         this_arg_conv.is_owned = false;
56621         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
56622 }
56623
56624 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
56625         LDKInitFeatures this_arg_conv;
56626         this_arg_conv.inner = untag_ptr(this_arg);
56627         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56629         this_arg_conv.is_owned = false;
56630         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
56631         return ret_conv;
56632 }
56633
56634 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
56635         LDKNodeFeatures this_arg_conv;
56636         this_arg_conv.inner = untag_ptr(this_arg);
56637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56639         this_arg_conv.is_owned = false;
56640         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
56641 }
56642
56643 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
56644         LDKNodeFeatures this_arg_conv;
56645         this_arg_conv.inner = untag_ptr(this_arg);
56646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56648         this_arg_conv.is_owned = false;
56649         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
56650 }
56651
56652 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
56653         LDKNodeFeatures this_arg_conv;
56654         this_arg_conv.inner = untag_ptr(this_arg);
56655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56657         this_arg_conv.is_owned = false;
56658         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
56659         return ret_conv;
56660 }
56661
56662 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
56663         LDKBolt11InvoiceFeatures this_arg_conv;
56664         this_arg_conv.inner = untag_ptr(this_arg);
56665         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56667         this_arg_conv.is_owned = false;
56668         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
56669 }
56670
56671 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_required"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
56672         LDKBolt11InvoiceFeatures 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         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
56678 }
56679
56680 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_variable_length_onion"))) TS_Bolt11InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
56681         LDKBolt11InvoiceFeatures 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         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
56687         return ret_conv;
56688 }
56689
56690 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
56691         LDKInitFeatures this_arg_conv;
56692         this_arg_conv.inner = untag_ptr(this_arg);
56693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56695         this_arg_conv.is_owned = false;
56696         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
56697         return ret_conv;
56698 }
56699
56700 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
56701         LDKNodeFeatures this_arg_conv;
56702         this_arg_conv.inner = untag_ptr(this_arg);
56703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56705         this_arg_conv.is_owned = false;
56706         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
56707         return ret_conv;
56708 }
56709
56710 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_variable_length_onion"))) TS_Bolt11InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
56711         LDKBolt11InvoiceFeatures this_arg_conv;
56712         this_arg_conv.inner = untag_ptr(this_arg);
56713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56715         this_arg_conv.is_owned = false;
56716         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
56717         return ret_conv;
56718 }
56719
56720 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
56721         LDKInitFeatures this_arg_conv;
56722         this_arg_conv.inner = untag_ptr(this_arg);
56723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56725         this_arg_conv.is_owned = false;
56726         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
56727 }
56728
56729 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
56730         LDKInitFeatures this_arg_conv;
56731         this_arg_conv.inner = untag_ptr(this_arg);
56732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56734         this_arg_conv.is_owned = false;
56735         InitFeatures_set_static_remote_key_required(&this_arg_conv);
56736 }
56737
56738 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
56739         LDKInitFeatures this_arg_conv;
56740         this_arg_conv.inner = untag_ptr(this_arg);
56741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56743         this_arg_conv.is_owned = false;
56744         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
56745         return ret_conv;
56746 }
56747
56748 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
56749         LDKNodeFeatures this_arg_conv;
56750         this_arg_conv.inner = untag_ptr(this_arg);
56751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56753         this_arg_conv.is_owned = false;
56754         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
56755 }
56756
56757 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
56758         LDKNodeFeatures this_arg_conv;
56759         this_arg_conv.inner = untag_ptr(this_arg);
56760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56762         this_arg_conv.is_owned = false;
56763         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
56764 }
56765
56766 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
56767         LDKNodeFeatures this_arg_conv;
56768         this_arg_conv.inner = untag_ptr(this_arg);
56769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56771         this_arg_conv.is_owned = false;
56772         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
56773         return ret_conv;
56774 }
56775
56776 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
56777         LDKChannelTypeFeatures this_arg_conv;
56778         this_arg_conv.inner = untag_ptr(this_arg);
56779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56781         this_arg_conv.is_owned = false;
56782         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
56783 }
56784
56785 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
56786         LDKChannelTypeFeatures this_arg_conv;
56787         this_arg_conv.inner = untag_ptr(this_arg);
56788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56790         this_arg_conv.is_owned = false;
56791         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
56792 }
56793
56794 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
56795         LDKChannelTypeFeatures this_arg_conv;
56796         this_arg_conv.inner = untag_ptr(this_arg);
56797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56799         this_arg_conv.is_owned = false;
56800         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
56801         return ret_conv;
56802 }
56803
56804 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
56805         LDKInitFeatures this_arg_conv;
56806         this_arg_conv.inner = untag_ptr(this_arg);
56807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56809         this_arg_conv.is_owned = false;
56810         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
56811         return ret_conv;
56812 }
56813
56814 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
56815         LDKNodeFeatures this_arg_conv;
56816         this_arg_conv.inner = untag_ptr(this_arg);
56817         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56819         this_arg_conv.is_owned = false;
56820         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
56821         return ret_conv;
56822 }
56823
56824 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
56825         LDKChannelTypeFeatures this_arg_conv;
56826         this_arg_conv.inner = untag_ptr(this_arg);
56827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56829         this_arg_conv.is_owned = false;
56830         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
56831         return ret_conv;
56832 }
56833
56834 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
56835         LDKInitFeatures this_arg_conv;
56836         this_arg_conv.inner = untag_ptr(this_arg);
56837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56839         this_arg_conv.is_owned = false;
56840         InitFeatures_set_payment_secret_optional(&this_arg_conv);
56841 }
56842
56843 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
56844         LDKInitFeatures this_arg_conv;
56845         this_arg_conv.inner = untag_ptr(this_arg);
56846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56848         this_arg_conv.is_owned = false;
56849         InitFeatures_set_payment_secret_required(&this_arg_conv);
56850 }
56851
56852 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
56853         LDKInitFeatures this_arg_conv;
56854         this_arg_conv.inner = untag_ptr(this_arg);
56855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56857         this_arg_conv.is_owned = false;
56858         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
56859         return ret_conv;
56860 }
56861
56862 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
56863         LDKNodeFeatures this_arg_conv;
56864         this_arg_conv.inner = untag_ptr(this_arg);
56865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56867         this_arg_conv.is_owned = false;
56868         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
56869 }
56870
56871 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
56872         LDKNodeFeatures this_arg_conv;
56873         this_arg_conv.inner = untag_ptr(this_arg);
56874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56876         this_arg_conv.is_owned = false;
56877         NodeFeatures_set_payment_secret_required(&this_arg_conv);
56878 }
56879
56880 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
56881         LDKNodeFeatures this_arg_conv;
56882         this_arg_conv.inner = untag_ptr(this_arg);
56883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56885         this_arg_conv.is_owned = false;
56886         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
56887         return ret_conv;
56888 }
56889
56890 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_optional"))) TS_Bolt11InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
56891         LDKBolt11InvoiceFeatures this_arg_conv;
56892         this_arg_conv.inner = untag_ptr(this_arg);
56893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56895         this_arg_conv.is_owned = false;
56896         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
56897 }
56898
56899 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_required"))) TS_Bolt11InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
56900         LDKBolt11InvoiceFeatures this_arg_conv;
56901         this_arg_conv.inner = untag_ptr(this_arg);
56902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56904         this_arg_conv.is_owned = false;
56905         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
56906 }
56907
56908 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_secret"))) TS_Bolt11InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
56909         LDKBolt11InvoiceFeatures this_arg_conv;
56910         this_arg_conv.inner = untag_ptr(this_arg);
56911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56913         this_arg_conv.is_owned = false;
56914         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
56915         return ret_conv;
56916 }
56917
56918 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
56919         LDKInitFeatures this_arg_conv;
56920         this_arg_conv.inner = untag_ptr(this_arg);
56921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56923         this_arg_conv.is_owned = false;
56924         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
56925         return ret_conv;
56926 }
56927
56928 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
56929         LDKNodeFeatures this_arg_conv;
56930         this_arg_conv.inner = untag_ptr(this_arg);
56931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56933         this_arg_conv.is_owned = false;
56934         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
56935         return ret_conv;
56936 }
56937
56938 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_secret"))) TS_Bolt11InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
56939         LDKBolt11InvoiceFeatures this_arg_conv;
56940         this_arg_conv.inner = untag_ptr(this_arg);
56941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56943         this_arg_conv.is_owned = false;
56944         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
56945         return ret_conv;
56946 }
56947
56948 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
56949         LDKInitFeatures this_arg_conv;
56950         this_arg_conv.inner = untag_ptr(this_arg);
56951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56953         this_arg_conv.is_owned = false;
56954         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
56955 }
56956
56957 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
56958         LDKInitFeatures this_arg_conv;
56959         this_arg_conv.inner = untag_ptr(this_arg);
56960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56962         this_arg_conv.is_owned = false;
56963         InitFeatures_set_basic_mpp_required(&this_arg_conv);
56964 }
56965
56966 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
56967         LDKInitFeatures this_arg_conv;
56968         this_arg_conv.inner = untag_ptr(this_arg);
56969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56971         this_arg_conv.is_owned = false;
56972         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
56973         return ret_conv;
56974 }
56975
56976 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
56977         LDKNodeFeatures this_arg_conv;
56978         this_arg_conv.inner = untag_ptr(this_arg);
56979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56981         this_arg_conv.is_owned = false;
56982         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
56983 }
56984
56985 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
56986         LDKNodeFeatures this_arg_conv;
56987         this_arg_conv.inner = untag_ptr(this_arg);
56988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56990         this_arg_conv.is_owned = false;
56991         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
56992 }
56993
56994 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
56995         LDKNodeFeatures this_arg_conv;
56996         this_arg_conv.inner = untag_ptr(this_arg);
56997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56999         this_arg_conv.is_owned = false;
57000         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
57001         return ret_conv;
57002 }
57003
57004 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
57005         LDKBolt11InvoiceFeatures this_arg_conv;
57006         this_arg_conv.inner = untag_ptr(this_arg);
57007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57009         this_arg_conv.is_owned = false;
57010         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
57011 }
57012
57013 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
57014         LDKBolt11InvoiceFeatures this_arg_conv;
57015         this_arg_conv.inner = untag_ptr(this_arg);
57016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57018         this_arg_conv.is_owned = false;
57019         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
57020 }
57021
57022 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_basic_mpp"))) TS_Bolt11InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
57023         LDKBolt11InvoiceFeatures this_arg_conv;
57024         this_arg_conv.inner = untag_ptr(this_arg);
57025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57027         this_arg_conv.is_owned = false;
57028         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
57029         return ret_conv;
57030 }
57031
57032 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
57033         LDKBolt12InvoiceFeatures this_arg_conv;
57034         this_arg_conv.inner = untag_ptr(this_arg);
57035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57037         this_arg_conv.is_owned = false;
57038         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
57039 }
57040
57041 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
57042         LDKBolt12InvoiceFeatures this_arg_conv;
57043         this_arg_conv.inner = untag_ptr(this_arg);
57044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57046         this_arg_conv.is_owned = false;
57047         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
57048 }
57049
57050 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_supports_basic_mpp"))) TS_Bolt12InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
57051         LDKBolt12InvoiceFeatures this_arg_conv;
57052         this_arg_conv.inner = untag_ptr(this_arg);
57053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57055         this_arg_conv.is_owned = false;
57056         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
57057         return ret_conv;
57058 }
57059
57060 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
57061         LDKInitFeatures this_arg_conv;
57062         this_arg_conv.inner = untag_ptr(this_arg);
57063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57065         this_arg_conv.is_owned = false;
57066         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
57067         return ret_conv;
57068 }
57069
57070 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
57071         LDKNodeFeatures this_arg_conv;
57072         this_arg_conv.inner = untag_ptr(this_arg);
57073         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57075         this_arg_conv.is_owned = false;
57076         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
57077         return ret_conv;
57078 }
57079
57080 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_basic_mpp"))) TS_Bolt11InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
57081         LDKBolt11InvoiceFeatures this_arg_conv;
57082         this_arg_conv.inner = untag_ptr(this_arg);
57083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57085         this_arg_conv.is_owned = false;
57086         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
57087         return ret_conv;
57088 }
57089
57090 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_basic_mpp"))) TS_Bolt12InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
57091         LDKBolt12InvoiceFeatures this_arg_conv;
57092         this_arg_conv.inner = untag_ptr(this_arg);
57093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57095         this_arg_conv.is_owned = false;
57096         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
57097         return ret_conv;
57098 }
57099
57100 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
57101         LDKInitFeatures this_arg_conv;
57102         this_arg_conv.inner = untag_ptr(this_arg);
57103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57105         this_arg_conv.is_owned = false;
57106         InitFeatures_set_wumbo_optional(&this_arg_conv);
57107 }
57108
57109 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
57110         LDKInitFeatures this_arg_conv;
57111         this_arg_conv.inner = untag_ptr(this_arg);
57112         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57114         this_arg_conv.is_owned = false;
57115         InitFeatures_set_wumbo_required(&this_arg_conv);
57116 }
57117
57118 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
57119         LDKInitFeatures this_arg_conv;
57120         this_arg_conv.inner = untag_ptr(this_arg);
57121         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57123         this_arg_conv.is_owned = false;
57124         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
57125         return ret_conv;
57126 }
57127
57128 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
57129         LDKNodeFeatures this_arg_conv;
57130         this_arg_conv.inner = untag_ptr(this_arg);
57131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57133         this_arg_conv.is_owned = false;
57134         NodeFeatures_set_wumbo_optional(&this_arg_conv);
57135 }
57136
57137 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
57138         LDKNodeFeatures this_arg_conv;
57139         this_arg_conv.inner = untag_ptr(this_arg);
57140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57142         this_arg_conv.is_owned = false;
57143         NodeFeatures_set_wumbo_required(&this_arg_conv);
57144 }
57145
57146 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
57147         LDKNodeFeatures this_arg_conv;
57148         this_arg_conv.inner = untag_ptr(this_arg);
57149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57151         this_arg_conv.is_owned = false;
57152         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
57153         return ret_conv;
57154 }
57155
57156 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
57157         LDKInitFeatures this_arg_conv;
57158         this_arg_conv.inner = untag_ptr(this_arg);
57159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57161         this_arg_conv.is_owned = false;
57162         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
57163         return ret_conv;
57164 }
57165
57166 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
57167         LDKNodeFeatures this_arg_conv;
57168         this_arg_conv.inner = untag_ptr(this_arg);
57169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57171         this_arg_conv.is_owned = false;
57172         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
57173         return ret_conv;
57174 }
57175
57176 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) {
57177         LDKInitFeatures this_arg_conv;
57178         this_arg_conv.inner = untag_ptr(this_arg);
57179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57181         this_arg_conv.is_owned = false;
57182         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
57183 }
57184
57185 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) {
57186         LDKInitFeatures this_arg_conv;
57187         this_arg_conv.inner = untag_ptr(this_arg);
57188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57190         this_arg_conv.is_owned = false;
57191         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
57192 }
57193
57194 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
57195         LDKInitFeatures this_arg_conv;
57196         this_arg_conv.inner = untag_ptr(this_arg);
57197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57199         this_arg_conv.is_owned = false;
57200         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57201         return ret_conv;
57202 }
57203
57204 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) {
57205         LDKNodeFeatures this_arg_conv;
57206         this_arg_conv.inner = untag_ptr(this_arg);
57207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57209         this_arg_conv.is_owned = false;
57210         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
57211 }
57212
57213 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) {
57214         LDKNodeFeatures this_arg_conv;
57215         this_arg_conv.inner = untag_ptr(this_arg);
57216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57218         this_arg_conv.is_owned = false;
57219         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
57220 }
57221
57222 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
57223         LDKNodeFeatures this_arg_conv;
57224         this_arg_conv.inner = untag_ptr(this_arg);
57225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57227         this_arg_conv.is_owned = false;
57228         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57229         return ret_conv;
57230 }
57231
57232 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) {
57233         LDKChannelTypeFeatures this_arg_conv;
57234         this_arg_conv.inner = untag_ptr(this_arg);
57235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57237         this_arg_conv.is_owned = false;
57238         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
57239 }
57240
57241 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) {
57242         LDKChannelTypeFeatures this_arg_conv;
57243         this_arg_conv.inner = untag_ptr(this_arg);
57244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57246         this_arg_conv.is_owned = false;
57247         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
57248 }
57249
57250 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
57251         LDKChannelTypeFeatures this_arg_conv;
57252         this_arg_conv.inner = untag_ptr(this_arg);
57253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57255         this_arg_conv.is_owned = false;
57256         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57257         return ret_conv;
57258 }
57259
57260 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
57261         LDKInitFeatures this_arg_conv;
57262         this_arg_conv.inner = untag_ptr(this_arg);
57263         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57265         this_arg_conv.is_owned = false;
57266         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57267         return ret_conv;
57268 }
57269
57270 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
57271         LDKNodeFeatures this_arg_conv;
57272         this_arg_conv.inner = untag_ptr(this_arg);
57273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57275         this_arg_conv.is_owned = false;
57276         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57277         return ret_conv;
57278 }
57279
57280 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
57281         LDKChannelTypeFeatures this_arg_conv;
57282         this_arg_conv.inner = untag_ptr(this_arg);
57283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57285         this_arg_conv.is_owned = false;
57286         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57287         return ret_conv;
57288 }
57289
57290 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) {
57291         LDKInitFeatures this_arg_conv;
57292         this_arg_conv.inner = untag_ptr(this_arg);
57293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57295         this_arg_conv.is_owned = false;
57296         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
57297 }
57298
57299 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) {
57300         LDKInitFeatures this_arg_conv;
57301         this_arg_conv.inner = untag_ptr(this_arg);
57302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57304         this_arg_conv.is_owned = false;
57305         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
57306 }
57307
57308 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
57309         LDKInitFeatures this_arg_conv;
57310         this_arg_conv.inner = untag_ptr(this_arg);
57311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57313         this_arg_conv.is_owned = false;
57314         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
57315         return ret_conv;
57316 }
57317
57318 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) {
57319         LDKNodeFeatures this_arg_conv;
57320         this_arg_conv.inner = untag_ptr(this_arg);
57321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57323         this_arg_conv.is_owned = false;
57324         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
57325 }
57326
57327 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) {
57328         LDKNodeFeatures this_arg_conv;
57329         this_arg_conv.inner = untag_ptr(this_arg);
57330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57332         this_arg_conv.is_owned = false;
57333         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
57334 }
57335
57336 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
57337         LDKNodeFeatures this_arg_conv;
57338         this_arg_conv.inner = untag_ptr(this_arg);
57339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57341         this_arg_conv.is_owned = false;
57342         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
57343         return ret_conv;
57344 }
57345
57346 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) {
57347         LDKChannelTypeFeatures this_arg_conv;
57348         this_arg_conv.inner = untag_ptr(this_arg);
57349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57351         this_arg_conv.is_owned = false;
57352         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
57353 }
57354
57355 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) {
57356         LDKChannelTypeFeatures this_arg_conv;
57357         this_arg_conv.inner = untag_ptr(this_arg);
57358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57360         this_arg_conv.is_owned = false;
57361         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
57362 }
57363
57364 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
57365         LDKChannelTypeFeatures this_arg_conv;
57366         this_arg_conv.inner = untag_ptr(this_arg);
57367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57369         this_arg_conv.is_owned = false;
57370         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
57371         return ret_conv;
57372 }
57373
57374 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
57375         LDKInitFeatures this_arg_conv;
57376         this_arg_conv.inner = untag_ptr(this_arg);
57377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57379         this_arg_conv.is_owned = false;
57380         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
57381         return ret_conv;
57382 }
57383
57384 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
57385         LDKNodeFeatures this_arg_conv;
57386         this_arg_conv.inner = untag_ptr(this_arg);
57387         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57389         this_arg_conv.is_owned = false;
57390         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
57391         return ret_conv;
57392 }
57393
57394 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
57395         LDKChannelTypeFeatures this_arg_conv;
57396         this_arg_conv.inner = untag_ptr(this_arg);
57397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57399         this_arg_conv.is_owned = false;
57400         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
57401         return ret_conv;
57402 }
57403
57404 void  __attribute__((export_name("TS_InitFeatures_set_route_blinding_optional"))) TS_InitFeatures_set_route_blinding_optional(uint64_t this_arg) {
57405         LDKInitFeatures this_arg_conv;
57406         this_arg_conv.inner = untag_ptr(this_arg);
57407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57409         this_arg_conv.is_owned = false;
57410         InitFeatures_set_route_blinding_optional(&this_arg_conv);
57411 }
57412
57413 void  __attribute__((export_name("TS_InitFeatures_set_route_blinding_required"))) TS_InitFeatures_set_route_blinding_required(uint64_t this_arg) {
57414         LDKInitFeatures this_arg_conv;
57415         this_arg_conv.inner = untag_ptr(this_arg);
57416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57418         this_arg_conv.is_owned = false;
57419         InitFeatures_set_route_blinding_required(&this_arg_conv);
57420 }
57421
57422 jboolean  __attribute__((export_name("TS_InitFeatures_supports_route_blinding"))) TS_InitFeatures_supports_route_blinding(uint64_t this_arg) {
57423         LDKInitFeatures this_arg_conv;
57424         this_arg_conv.inner = untag_ptr(this_arg);
57425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57427         this_arg_conv.is_owned = false;
57428         jboolean ret_conv = InitFeatures_supports_route_blinding(&this_arg_conv);
57429         return ret_conv;
57430 }
57431
57432 void  __attribute__((export_name("TS_NodeFeatures_set_route_blinding_optional"))) TS_NodeFeatures_set_route_blinding_optional(uint64_t this_arg) {
57433         LDKNodeFeatures this_arg_conv;
57434         this_arg_conv.inner = untag_ptr(this_arg);
57435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57437         this_arg_conv.is_owned = false;
57438         NodeFeatures_set_route_blinding_optional(&this_arg_conv);
57439 }
57440
57441 void  __attribute__((export_name("TS_NodeFeatures_set_route_blinding_required"))) TS_NodeFeatures_set_route_blinding_required(uint64_t this_arg) {
57442         LDKNodeFeatures this_arg_conv;
57443         this_arg_conv.inner = untag_ptr(this_arg);
57444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57446         this_arg_conv.is_owned = false;
57447         NodeFeatures_set_route_blinding_required(&this_arg_conv);
57448 }
57449
57450 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_route_blinding"))) TS_NodeFeatures_supports_route_blinding(uint64_t this_arg) {
57451         LDKNodeFeatures this_arg_conv;
57452         this_arg_conv.inner = untag_ptr(this_arg);
57453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57455         this_arg_conv.is_owned = false;
57456         jboolean ret_conv = NodeFeatures_supports_route_blinding(&this_arg_conv);
57457         return ret_conv;
57458 }
57459
57460 jboolean  __attribute__((export_name("TS_InitFeatures_requires_route_blinding"))) TS_InitFeatures_requires_route_blinding(uint64_t this_arg) {
57461         LDKInitFeatures this_arg_conv;
57462         this_arg_conv.inner = untag_ptr(this_arg);
57463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57465         this_arg_conv.is_owned = false;
57466         jboolean ret_conv = InitFeatures_requires_route_blinding(&this_arg_conv);
57467         return ret_conv;
57468 }
57469
57470 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_route_blinding"))) TS_NodeFeatures_requires_route_blinding(uint64_t this_arg) {
57471         LDKNodeFeatures this_arg_conv;
57472         this_arg_conv.inner = untag_ptr(this_arg);
57473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57475         this_arg_conv.is_owned = false;
57476         jboolean ret_conv = NodeFeatures_requires_route_blinding(&this_arg_conv);
57477         return ret_conv;
57478 }
57479
57480 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
57481         LDKInitFeatures this_arg_conv;
57482         this_arg_conv.inner = untag_ptr(this_arg);
57483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57485         this_arg_conv.is_owned = false;
57486         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
57487 }
57488
57489 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
57490         LDKInitFeatures this_arg_conv;
57491         this_arg_conv.inner = untag_ptr(this_arg);
57492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57494         this_arg_conv.is_owned = false;
57495         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
57496 }
57497
57498 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
57499         LDKInitFeatures this_arg_conv;
57500         this_arg_conv.inner = untag_ptr(this_arg);
57501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57503         this_arg_conv.is_owned = false;
57504         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
57505         return ret_conv;
57506 }
57507
57508 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
57509         LDKNodeFeatures this_arg_conv;
57510         this_arg_conv.inner = untag_ptr(this_arg);
57511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57513         this_arg_conv.is_owned = false;
57514         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
57515 }
57516
57517 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
57518         LDKNodeFeatures this_arg_conv;
57519         this_arg_conv.inner = untag_ptr(this_arg);
57520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57522         this_arg_conv.is_owned = false;
57523         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
57524 }
57525
57526 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
57527         LDKNodeFeatures this_arg_conv;
57528         this_arg_conv.inner = untag_ptr(this_arg);
57529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57531         this_arg_conv.is_owned = false;
57532         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
57533         return ret_conv;
57534 }
57535
57536 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
57537         LDKInitFeatures this_arg_conv;
57538         this_arg_conv.inner = untag_ptr(this_arg);
57539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57541         this_arg_conv.is_owned = false;
57542         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
57543         return ret_conv;
57544 }
57545
57546 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
57547         LDKNodeFeatures this_arg_conv;
57548         this_arg_conv.inner = untag_ptr(this_arg);
57549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57551         this_arg_conv.is_owned = false;
57552         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
57553         return ret_conv;
57554 }
57555
57556 void  __attribute__((export_name("TS_InitFeatures_set_taproot_optional"))) TS_InitFeatures_set_taproot_optional(uint64_t this_arg) {
57557         LDKInitFeatures this_arg_conv;
57558         this_arg_conv.inner = untag_ptr(this_arg);
57559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57561         this_arg_conv.is_owned = false;
57562         InitFeatures_set_taproot_optional(&this_arg_conv);
57563 }
57564
57565 void  __attribute__((export_name("TS_InitFeatures_set_taproot_required"))) TS_InitFeatures_set_taproot_required(uint64_t this_arg) {
57566         LDKInitFeatures this_arg_conv;
57567         this_arg_conv.inner = untag_ptr(this_arg);
57568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57570         this_arg_conv.is_owned = false;
57571         InitFeatures_set_taproot_required(&this_arg_conv);
57572 }
57573
57574 jboolean  __attribute__((export_name("TS_InitFeatures_supports_taproot"))) TS_InitFeatures_supports_taproot(uint64_t this_arg) {
57575         LDKInitFeatures this_arg_conv;
57576         this_arg_conv.inner = untag_ptr(this_arg);
57577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57579         this_arg_conv.is_owned = false;
57580         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
57581         return ret_conv;
57582 }
57583
57584 void  __attribute__((export_name("TS_NodeFeatures_set_taproot_optional"))) TS_NodeFeatures_set_taproot_optional(uint64_t this_arg) {
57585         LDKNodeFeatures this_arg_conv;
57586         this_arg_conv.inner = untag_ptr(this_arg);
57587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57589         this_arg_conv.is_owned = false;
57590         NodeFeatures_set_taproot_optional(&this_arg_conv);
57591 }
57592
57593 void  __attribute__((export_name("TS_NodeFeatures_set_taproot_required"))) TS_NodeFeatures_set_taproot_required(uint64_t this_arg) {
57594         LDKNodeFeatures this_arg_conv;
57595         this_arg_conv.inner = untag_ptr(this_arg);
57596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57598         this_arg_conv.is_owned = false;
57599         NodeFeatures_set_taproot_required(&this_arg_conv);
57600 }
57601
57602 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_taproot"))) TS_NodeFeatures_supports_taproot(uint64_t this_arg) {
57603         LDKNodeFeatures this_arg_conv;
57604         this_arg_conv.inner = untag_ptr(this_arg);
57605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57607         this_arg_conv.is_owned = false;
57608         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
57609         return ret_conv;
57610 }
57611
57612 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_taproot_optional"))) TS_ChannelTypeFeatures_set_taproot_optional(uint64_t this_arg) {
57613         LDKChannelTypeFeatures this_arg_conv;
57614         this_arg_conv.inner = untag_ptr(this_arg);
57615         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57617         this_arg_conv.is_owned = false;
57618         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
57619 }
57620
57621 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_taproot_required"))) TS_ChannelTypeFeatures_set_taproot_required(uint64_t this_arg) {
57622         LDKChannelTypeFeatures this_arg_conv;
57623         this_arg_conv.inner = untag_ptr(this_arg);
57624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57626         this_arg_conv.is_owned = false;
57627         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
57628 }
57629
57630 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_taproot"))) TS_ChannelTypeFeatures_supports_taproot(uint64_t this_arg) {
57631         LDKChannelTypeFeatures this_arg_conv;
57632         this_arg_conv.inner = untag_ptr(this_arg);
57633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57635         this_arg_conv.is_owned = false;
57636         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
57637         return ret_conv;
57638 }
57639
57640 jboolean  __attribute__((export_name("TS_InitFeatures_requires_taproot"))) TS_InitFeatures_requires_taproot(uint64_t this_arg) {
57641         LDKInitFeatures this_arg_conv;
57642         this_arg_conv.inner = untag_ptr(this_arg);
57643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57645         this_arg_conv.is_owned = false;
57646         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
57647         return ret_conv;
57648 }
57649
57650 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_taproot"))) TS_NodeFeatures_requires_taproot(uint64_t this_arg) {
57651         LDKNodeFeatures this_arg_conv;
57652         this_arg_conv.inner = untag_ptr(this_arg);
57653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57655         this_arg_conv.is_owned = false;
57656         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
57657         return ret_conv;
57658 }
57659
57660 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_taproot"))) TS_ChannelTypeFeatures_requires_taproot(uint64_t this_arg) {
57661         LDKChannelTypeFeatures this_arg_conv;
57662         this_arg_conv.inner = untag_ptr(this_arg);
57663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57665         this_arg_conv.is_owned = false;
57666         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
57667         return ret_conv;
57668 }
57669
57670 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
57671         LDKInitFeatures this_arg_conv;
57672         this_arg_conv.inner = untag_ptr(this_arg);
57673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57675         this_arg_conv.is_owned = false;
57676         InitFeatures_set_onion_messages_optional(&this_arg_conv);
57677 }
57678
57679 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
57680         LDKInitFeatures this_arg_conv;
57681         this_arg_conv.inner = untag_ptr(this_arg);
57682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57684         this_arg_conv.is_owned = false;
57685         InitFeatures_set_onion_messages_required(&this_arg_conv);
57686 }
57687
57688 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
57689         LDKInitFeatures 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 = InitFeatures_supports_onion_messages(&this_arg_conv);
57695         return ret_conv;
57696 }
57697
57698 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
57699         LDKNodeFeatures 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         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
57705 }
57706
57707 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
57708         LDKNodeFeatures this_arg_conv;
57709         this_arg_conv.inner = untag_ptr(this_arg);
57710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57712         this_arg_conv.is_owned = false;
57713         NodeFeatures_set_onion_messages_required(&this_arg_conv);
57714 }
57715
57716 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
57717         LDKNodeFeatures this_arg_conv;
57718         this_arg_conv.inner = untag_ptr(this_arg);
57719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57721         this_arg_conv.is_owned = false;
57722         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
57723         return ret_conv;
57724 }
57725
57726 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
57727         LDKInitFeatures this_arg_conv;
57728         this_arg_conv.inner = untag_ptr(this_arg);
57729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57731         this_arg_conv.is_owned = false;
57732         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
57733         return ret_conv;
57734 }
57735
57736 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
57737         LDKNodeFeatures this_arg_conv;
57738         this_arg_conv.inner = untag_ptr(this_arg);
57739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57741         this_arg_conv.is_owned = false;
57742         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
57743         return ret_conv;
57744 }
57745
57746 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
57747         LDKInitFeatures this_arg_conv;
57748         this_arg_conv.inner = untag_ptr(this_arg);
57749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57751         this_arg_conv.is_owned = false;
57752         InitFeatures_set_channel_type_optional(&this_arg_conv);
57753 }
57754
57755 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
57756         LDKInitFeatures this_arg_conv;
57757         this_arg_conv.inner = untag_ptr(this_arg);
57758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57760         this_arg_conv.is_owned = false;
57761         InitFeatures_set_channel_type_required(&this_arg_conv);
57762 }
57763
57764 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
57765         LDKInitFeatures this_arg_conv;
57766         this_arg_conv.inner = untag_ptr(this_arg);
57767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57769         this_arg_conv.is_owned = false;
57770         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
57771         return ret_conv;
57772 }
57773
57774 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
57775         LDKNodeFeatures this_arg_conv;
57776         this_arg_conv.inner = untag_ptr(this_arg);
57777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57779         this_arg_conv.is_owned = false;
57780         NodeFeatures_set_channel_type_optional(&this_arg_conv);
57781 }
57782
57783 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
57784         LDKNodeFeatures this_arg_conv;
57785         this_arg_conv.inner = untag_ptr(this_arg);
57786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57788         this_arg_conv.is_owned = false;
57789         NodeFeatures_set_channel_type_required(&this_arg_conv);
57790 }
57791
57792 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
57793         LDKNodeFeatures this_arg_conv;
57794         this_arg_conv.inner = untag_ptr(this_arg);
57795         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57797         this_arg_conv.is_owned = false;
57798         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
57799         return ret_conv;
57800 }
57801
57802 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
57803         LDKInitFeatures this_arg_conv;
57804         this_arg_conv.inner = untag_ptr(this_arg);
57805         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57807         this_arg_conv.is_owned = false;
57808         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
57809         return ret_conv;
57810 }
57811
57812 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
57813         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
57819         return ret_conv;
57820 }
57821
57822 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
57823         LDKInitFeatures this_arg_conv;
57824         this_arg_conv.inner = untag_ptr(this_arg);
57825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57827         this_arg_conv.is_owned = false;
57828         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
57829 }
57830
57831 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
57832         LDKInitFeatures this_arg_conv;
57833         this_arg_conv.inner = untag_ptr(this_arg);
57834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57836         this_arg_conv.is_owned = false;
57837         InitFeatures_set_scid_privacy_required(&this_arg_conv);
57838 }
57839
57840 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
57841         LDKInitFeatures this_arg_conv;
57842         this_arg_conv.inner = untag_ptr(this_arg);
57843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57845         this_arg_conv.is_owned = false;
57846         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
57847         return ret_conv;
57848 }
57849
57850 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
57851         LDKNodeFeatures this_arg_conv;
57852         this_arg_conv.inner = untag_ptr(this_arg);
57853         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57855         this_arg_conv.is_owned = false;
57856         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
57857 }
57858
57859 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
57860         LDKNodeFeatures this_arg_conv;
57861         this_arg_conv.inner = untag_ptr(this_arg);
57862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57864         this_arg_conv.is_owned = false;
57865         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
57866 }
57867
57868 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
57869         LDKNodeFeatures this_arg_conv;
57870         this_arg_conv.inner = untag_ptr(this_arg);
57871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57873         this_arg_conv.is_owned = false;
57874         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
57875         return ret_conv;
57876 }
57877
57878 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
57879         LDKChannelTypeFeatures this_arg_conv;
57880         this_arg_conv.inner = untag_ptr(this_arg);
57881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57883         this_arg_conv.is_owned = false;
57884         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
57885 }
57886
57887 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
57888         LDKChannelTypeFeatures this_arg_conv;
57889         this_arg_conv.inner = untag_ptr(this_arg);
57890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57892         this_arg_conv.is_owned = false;
57893         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
57894 }
57895
57896 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
57897         LDKChannelTypeFeatures this_arg_conv;
57898         this_arg_conv.inner = untag_ptr(this_arg);
57899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57901         this_arg_conv.is_owned = false;
57902         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
57903         return ret_conv;
57904 }
57905
57906 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
57907         LDKInitFeatures this_arg_conv;
57908         this_arg_conv.inner = untag_ptr(this_arg);
57909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57911         this_arg_conv.is_owned = false;
57912         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
57913         return ret_conv;
57914 }
57915
57916 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
57917         LDKNodeFeatures this_arg_conv;
57918         this_arg_conv.inner = untag_ptr(this_arg);
57919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57921         this_arg_conv.is_owned = false;
57922         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
57923         return ret_conv;
57924 }
57925
57926 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
57927         LDKChannelTypeFeatures this_arg_conv;
57928         this_arg_conv.inner = untag_ptr(this_arg);
57929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57931         this_arg_conv.is_owned = false;
57932         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
57933         return ret_conv;
57934 }
57935
57936 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_optional"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_optional(uint64_t this_arg) {
57937         LDKBolt11InvoiceFeatures this_arg_conv;
57938         this_arg_conv.inner = untag_ptr(this_arg);
57939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57941         this_arg_conv.is_owned = false;
57942         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
57943 }
57944
57945 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_required"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_required(uint64_t this_arg) {
57946         LDKBolt11InvoiceFeatures this_arg_conv;
57947         this_arg_conv.inner = untag_ptr(this_arg);
57948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57950         this_arg_conv.is_owned = false;
57951         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
57952 }
57953
57954 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_metadata"))) TS_Bolt11InvoiceFeatures_supports_payment_metadata(uint64_t this_arg) {
57955         LDKBolt11InvoiceFeatures this_arg_conv;
57956         this_arg_conv.inner = untag_ptr(this_arg);
57957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57959         this_arg_conv.is_owned = false;
57960         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
57961         return ret_conv;
57962 }
57963
57964 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_metadata"))) TS_Bolt11InvoiceFeatures_requires_payment_metadata(uint64_t this_arg) {
57965         LDKBolt11InvoiceFeatures this_arg_conv;
57966         this_arg_conv.inner = untag_ptr(this_arg);
57967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57969         this_arg_conv.is_owned = false;
57970         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
57971         return ret_conv;
57972 }
57973
57974 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
57975         LDKInitFeatures this_arg_conv;
57976         this_arg_conv.inner = untag_ptr(this_arg);
57977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57979         this_arg_conv.is_owned = false;
57980         InitFeatures_set_zero_conf_optional(&this_arg_conv);
57981 }
57982
57983 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
57984         LDKInitFeatures 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         InitFeatures_set_zero_conf_required(&this_arg_conv);
57990 }
57991
57992 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
57993         LDKInitFeatures this_arg_conv;
57994         this_arg_conv.inner = untag_ptr(this_arg);
57995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57997         this_arg_conv.is_owned = false;
57998         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
57999         return ret_conv;
58000 }
58001
58002 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
58003         LDKNodeFeatures this_arg_conv;
58004         this_arg_conv.inner = untag_ptr(this_arg);
58005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58007         this_arg_conv.is_owned = false;
58008         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
58009 }
58010
58011 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
58012         LDKNodeFeatures this_arg_conv;
58013         this_arg_conv.inner = untag_ptr(this_arg);
58014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58016         this_arg_conv.is_owned = false;
58017         NodeFeatures_set_zero_conf_required(&this_arg_conv);
58018 }
58019
58020 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
58021         LDKNodeFeatures this_arg_conv;
58022         this_arg_conv.inner = untag_ptr(this_arg);
58023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58025         this_arg_conv.is_owned = false;
58026         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
58027         return ret_conv;
58028 }
58029
58030 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
58031         LDKChannelTypeFeatures this_arg_conv;
58032         this_arg_conv.inner = untag_ptr(this_arg);
58033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58035         this_arg_conv.is_owned = false;
58036         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
58037 }
58038
58039 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
58040         LDKChannelTypeFeatures this_arg_conv;
58041         this_arg_conv.inner = untag_ptr(this_arg);
58042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58044         this_arg_conv.is_owned = false;
58045         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
58046 }
58047
58048 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
58049         LDKChannelTypeFeatures this_arg_conv;
58050         this_arg_conv.inner = untag_ptr(this_arg);
58051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58053         this_arg_conv.is_owned = false;
58054         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
58055         return ret_conv;
58056 }
58057
58058 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
58059         LDKInitFeatures this_arg_conv;
58060         this_arg_conv.inner = untag_ptr(this_arg);
58061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58063         this_arg_conv.is_owned = false;
58064         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
58065         return ret_conv;
58066 }
58067
58068 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
58069         LDKNodeFeatures this_arg_conv;
58070         this_arg_conv.inner = untag_ptr(this_arg);
58071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58073         this_arg_conv.is_owned = false;
58074         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
58075         return ret_conv;
58076 }
58077
58078 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
58079         LDKChannelTypeFeatures this_arg_conv;
58080         this_arg_conv.inner = untag_ptr(this_arg);
58081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58083         this_arg_conv.is_owned = false;
58084         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
58085         return ret_conv;
58086 }
58087
58088 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
58089         LDKNodeFeatures this_arg_conv;
58090         this_arg_conv.inner = untag_ptr(this_arg);
58091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58093         this_arg_conv.is_owned = false;
58094         NodeFeatures_set_keysend_optional(&this_arg_conv);
58095 }
58096
58097 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
58098         LDKNodeFeatures this_arg_conv;
58099         this_arg_conv.inner = untag_ptr(this_arg);
58100         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58102         this_arg_conv.is_owned = false;
58103         NodeFeatures_set_keysend_required(&this_arg_conv);
58104 }
58105
58106 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
58107         LDKNodeFeatures this_arg_conv;
58108         this_arg_conv.inner = untag_ptr(this_arg);
58109         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58111         this_arg_conv.is_owned = false;
58112         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
58113         return ret_conv;
58114 }
58115
58116 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
58117         LDKNodeFeatures this_arg_conv;
58118         this_arg_conv.inner = untag_ptr(this_arg);
58119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58121         this_arg_conv.is_owned = false;
58122         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
58123         return ret_conv;
58124 }
58125
58126 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
58127         LDKShutdownScript this_obj_conv;
58128         this_obj_conv.inner = untag_ptr(this_obj);
58129         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58131         ShutdownScript_free(this_obj_conv);
58132 }
58133
58134 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
58135         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
58136         uint64_t ret_ref = 0;
58137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58139         return ret_ref;
58140 }
58141 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
58142         LDKShutdownScript arg_conv;
58143         arg_conv.inner = untag_ptr(arg);
58144         arg_conv.is_owned = ptr_is_owned(arg);
58145         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58146         arg_conv.is_owned = false;
58147         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
58148         return ret_conv;
58149 }
58150
58151 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
58152         LDKShutdownScript orig_conv;
58153         orig_conv.inner = untag_ptr(orig);
58154         orig_conv.is_owned = ptr_is_owned(orig);
58155         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58156         orig_conv.is_owned = false;
58157         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
58158         uint64_t ret_ref = 0;
58159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58161         return ret_ref;
58162 }
58163
58164 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
58165         LDKShutdownScript a_conv;
58166         a_conv.inner = untag_ptr(a);
58167         a_conv.is_owned = ptr_is_owned(a);
58168         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58169         a_conv.is_owned = false;
58170         LDKShutdownScript b_conv;
58171         b_conv.inner = untag_ptr(b);
58172         b_conv.is_owned = ptr_is_owned(b);
58173         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58174         b_conv.is_owned = false;
58175         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
58176         return ret_conv;
58177 }
58178
58179 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
58180         LDKInvalidShutdownScript this_obj_conv;
58181         this_obj_conv.inner = untag_ptr(this_obj);
58182         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58184         InvalidShutdownScript_free(this_obj_conv);
58185 }
58186
58187 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
58188         LDKInvalidShutdownScript this_ptr_conv;
58189         this_ptr_conv.inner = untag_ptr(this_ptr);
58190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58192         this_ptr_conv.is_owned = false;
58193         LDKCVec_u8Z ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
58194         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58195         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58196         CVec_u8Z_free(ret_var);
58197         return ret_arr;
58198 }
58199
58200 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
58201         LDKInvalidShutdownScript this_ptr_conv;
58202         this_ptr_conv.inner = untag_ptr(this_ptr);
58203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58205         this_ptr_conv.is_owned = false;
58206         LDKCVec_u8Z val_ref;
58207         val_ref.datalen = val->arr_len;
58208         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
58209         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
58210         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
58211 }
58212
58213 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
58214         LDKCVec_u8Z script_arg_ref;
58215         script_arg_ref.datalen = script_arg->arr_len;
58216         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
58217         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
58218         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
58219         uint64_t ret_ref = 0;
58220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58222         return ret_ref;
58223 }
58224
58225 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
58226         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
58227         uint64_t ret_ref = 0;
58228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58230         return ret_ref;
58231 }
58232 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
58233         LDKInvalidShutdownScript arg_conv;
58234         arg_conv.inner = untag_ptr(arg);
58235         arg_conv.is_owned = ptr_is_owned(arg);
58236         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58237         arg_conv.is_owned = false;
58238         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
58239         return ret_conv;
58240 }
58241
58242 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
58243         LDKInvalidShutdownScript orig_conv;
58244         orig_conv.inner = untag_ptr(orig);
58245         orig_conv.is_owned = ptr_is_owned(orig);
58246         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58247         orig_conv.is_owned = false;
58248         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
58249         uint64_t ret_ref = 0;
58250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58252         return ret_ref;
58253 }
58254
58255 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
58256         LDKShutdownScript obj_conv;
58257         obj_conv.inner = untag_ptr(obj);
58258         obj_conv.is_owned = ptr_is_owned(obj);
58259         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58260         obj_conv.is_owned = false;
58261         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
58262         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58263         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58264         CVec_u8Z_free(ret_var);
58265         return ret_arr;
58266 }
58267
58268 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
58269         LDKu8slice ser_ref;
58270         ser_ref.datalen = ser->arr_len;
58271         ser_ref.data = ser->elems;
58272         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
58273         *ret_conv = ShutdownScript_read(ser_ref);
58274         FREE(ser);
58275         return tag_ptr(ret_conv, true);
58276 }
58277
58278 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
58279         uint8_t pubkey_hash_arr[20];
58280         CHECK(pubkey_hash->arr_len == 20);
58281         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
58282         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
58283         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
58284         uint64_t ret_ref = 0;
58285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58287         return ret_ref;
58288 }
58289
58290 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
58291         uint8_t script_hash_arr[32];
58292         CHECK(script_hash->arr_len == 32);
58293         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
58294         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
58295         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
58296         uint64_t ret_ref = 0;
58297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58299         return ret_ref;
58300 }
58301
58302 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(uint64_t witness_program) {
58303         void* witness_program_ptr = untag_ptr(witness_program);
58304         CHECK_ACCESS(witness_program_ptr);
58305         LDKWitnessProgram witness_program_conv = *(LDKWitnessProgram*)(witness_program_ptr);
58306         witness_program_conv = WitnessProgram_clone((LDKWitnessProgram*)untag_ptr(witness_program));
58307         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
58308         *ret_conv = ShutdownScript_new_witness_program(witness_program_conv);
58309         return tag_ptr(ret_conv, true);
58310 }
58311
58312 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
58313         LDKShutdownScript this_arg_conv;
58314         this_arg_conv.inner = untag_ptr(this_arg);
58315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58317         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
58318         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
58319         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58320         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58321         CVec_u8Z_free(ret_var);
58322         return ret_arr;
58323 }
58324
58325 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
58326         LDKShutdownScript this_arg_conv;
58327         this_arg_conv.inner = untag_ptr(this_arg);
58328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58330         this_arg_conv.is_owned = false;
58331         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
58332         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
58333         return ret_arr;
58334 }
58335
58336 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
58337         LDKShutdownScript this_arg_conv;
58338         this_arg_conv.inner = untag_ptr(this_arg);
58339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58341         this_arg_conv.is_owned = false;
58342         LDKInitFeatures features_conv;
58343         features_conv.inner = untag_ptr(features);
58344         features_conv.is_owned = ptr_is_owned(features);
58345         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
58346         features_conv.is_owned = false;
58347         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
58348         return ret_conv;
58349 }
58350
58351 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
58352         if (!ptr_is_owned(this_ptr)) return;
58353         void* this_ptr_ptr = untag_ptr(this_ptr);
58354         CHECK_ACCESS(this_ptr_ptr);
58355         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
58356         FREE(untag_ptr(this_ptr));
58357         Retry_free(this_ptr_conv);
58358 }
58359
58360 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
58361         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58362         *ret_copy = Retry_clone(arg);
58363         uint64_t ret_ref = tag_ptr(ret_copy, true);
58364         return ret_ref;
58365 }
58366 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
58367         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
58368         int64_t ret_conv = Retry_clone_ptr(arg_conv);
58369         return ret_conv;
58370 }
58371
58372 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
58373         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
58374         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58375         *ret_copy = Retry_clone(orig_conv);
58376         uint64_t ret_ref = tag_ptr(ret_copy, true);
58377         return ret_ref;
58378 }
58379
58380 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(int32_t a) {
58381         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58382         *ret_copy = Retry_attempts(a);
58383         uint64_t ret_ref = tag_ptr(ret_copy, true);
58384         return ret_ref;
58385 }
58386
58387 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
58388         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
58389         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
58390         jboolean ret_conv = Retry_eq(a_conv, b_conv);
58391         return ret_conv;
58392 }
58393
58394 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
58395         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
58396         int64_t ret_conv = Retry_hash(o_conv);
58397         return ret_conv;
58398 }
58399
58400 int8_tArray  __attribute__((export_name("TS_Retry_write"))) TS_Retry_write(uint64_t obj) {
58401         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
58402         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
58403         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58404         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58405         CVec_u8Z_free(ret_var);
58406         return ret_arr;
58407 }
58408
58409 uint64_t  __attribute__((export_name("TS_Retry_read"))) TS_Retry_read(int8_tArray ser) {
58410         LDKu8slice ser_ref;
58411         ser_ref.datalen = ser->arr_len;
58412         ser_ref.data = ser->elems;
58413         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
58414         *ret_conv = Retry_read(ser_ref);
58415         FREE(ser);
58416         return tag_ptr(ret_conv, true);
58417 }
58418
58419 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_clone"))) TS_RetryableSendFailure_clone(uint64_t orig) {
58420         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
58421         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_clone(orig_conv));
58422         return ret_conv;
58423 }
58424
58425 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_payment_expired"))) TS_RetryableSendFailure_payment_expired() {
58426         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_payment_expired());
58427         return ret_conv;
58428 }
58429
58430 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_route_not_found"))) TS_RetryableSendFailure_route_not_found() {
58431         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_route_not_found());
58432         return ret_conv;
58433 }
58434
58435 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_duplicate_payment"))) TS_RetryableSendFailure_duplicate_payment() {
58436         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_duplicate_payment());
58437         return ret_conv;
58438 }
58439
58440 jboolean  __attribute__((export_name("TS_RetryableSendFailure_eq"))) TS_RetryableSendFailure_eq(uint64_t a, uint64_t b) {
58441         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
58442         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
58443         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
58444         return ret_conv;
58445 }
58446
58447 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
58448         if (!ptr_is_owned(this_ptr)) return;
58449         void* this_ptr_ptr = untag_ptr(this_ptr);
58450         CHECK_ACCESS(this_ptr_ptr);
58451         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
58452         FREE(untag_ptr(this_ptr));
58453         PaymentSendFailure_free(this_ptr_conv);
58454 }
58455
58456 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
58457         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58458         *ret_copy = PaymentSendFailure_clone(arg);
58459         uint64_t ret_ref = tag_ptr(ret_copy, true);
58460         return ret_ref;
58461 }
58462 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
58463         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
58464         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
58465         return ret_conv;
58466 }
58467
58468 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
58469         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
58470         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58471         *ret_copy = PaymentSendFailure_clone(orig_conv);
58472         uint64_t ret_ref = tag_ptr(ret_copy, true);
58473         return ret_ref;
58474 }
58475
58476 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
58477         void* a_ptr = untag_ptr(a);
58478         CHECK_ACCESS(a_ptr);
58479         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
58480         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
58481         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58482         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
58483         uint64_t ret_ref = tag_ptr(ret_copy, true);
58484         return ret_ref;
58485 }
58486
58487 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
58488         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
58489         a_constr.datalen = a->arr_len;
58490         if (a_constr.datalen > 0)
58491                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
58492         else
58493                 a_constr.data = NULL;
58494         uint64_t* a_vals = a->elems;
58495         for (size_t w = 0; w < a_constr.datalen; w++) {
58496                 uint64_t a_conv_22 = a_vals[w];
58497                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
58498                 CHECK_ACCESS(a_conv_22_ptr);
58499                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
58500                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
58501                 a_constr.data[w] = a_conv_22_conv;
58502         }
58503         FREE(a);
58504         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58505         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
58506         uint64_t ret_ref = tag_ptr(ret_copy, true);
58507         return ret_ref;
58508 }
58509
58510 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) {
58511         LDKCVec_APIErrorZ a_constr;
58512         a_constr.datalen = a->arr_len;
58513         if (a_constr.datalen > 0)
58514                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
58515         else
58516                 a_constr.data = NULL;
58517         uint64_t* a_vals = a->elems;
58518         for (size_t k = 0; k < a_constr.datalen; k++) {
58519                 uint64_t a_conv_10 = a_vals[k];
58520                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
58521                 CHECK_ACCESS(a_conv_10_ptr);
58522                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
58523                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
58524                 a_constr.data[k] = a_conv_10_conv;
58525         }
58526         FREE(a);
58527         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58528         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
58529         uint64_t ret_ref = tag_ptr(ret_copy, true);
58530         return ret_ref;
58531 }
58532
58533 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() {
58534         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58535         *ret_copy = PaymentSendFailure_duplicate_payment();
58536         uint64_t ret_ref = tag_ptr(ret_copy, true);
58537         return ret_ref;
58538 }
58539
58540 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) {
58541         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
58542         results_constr.datalen = results->arr_len;
58543         if (results_constr.datalen > 0)
58544                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
58545         else
58546                 results_constr.data = NULL;
58547         uint64_t* results_vals = results->elems;
58548         for (size_t w = 0; w < results_constr.datalen; w++) {
58549                 uint64_t results_conv_22 = results_vals[w];
58550                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
58551                 CHECK_ACCESS(results_conv_22_ptr);
58552                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
58553                 results_constr.data[w] = results_conv_22_conv;
58554         }
58555         FREE(results);
58556         LDKRouteParameters failed_paths_retry_conv;
58557         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
58558         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
58559         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
58560         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
58561         LDKThirtyTwoBytes payment_id_ref;
58562         CHECK(payment_id->arr_len == 32);
58563         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
58564         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58565         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
58566         uint64_t ret_ref = tag_ptr(ret_copy, true);
58567         return ret_ref;
58568 }
58569
58570 jboolean  __attribute__((export_name("TS_PaymentSendFailure_eq"))) TS_PaymentSendFailure_eq(uint64_t a, uint64_t b) {
58571         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
58572         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
58573         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
58574         return ret_conv;
58575 }
58576
58577 void  __attribute__((export_name("TS_ProbeSendFailure_free"))) TS_ProbeSendFailure_free(uint64_t this_ptr) {
58578         if (!ptr_is_owned(this_ptr)) return;
58579         void* this_ptr_ptr = untag_ptr(this_ptr);
58580         CHECK_ACCESS(this_ptr_ptr);
58581         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
58582         FREE(untag_ptr(this_ptr));
58583         ProbeSendFailure_free(this_ptr_conv);
58584 }
58585
58586 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
58587         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
58588         *ret_copy = ProbeSendFailure_clone(arg);
58589         uint64_t ret_ref = tag_ptr(ret_copy, true);
58590         return ret_ref;
58591 }
58592 int64_t  __attribute__((export_name("TS_ProbeSendFailure_clone_ptr"))) TS_ProbeSendFailure_clone_ptr(uint64_t arg) {
58593         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
58594         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
58595         return ret_conv;
58596 }
58597
58598 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_clone"))) TS_ProbeSendFailure_clone(uint64_t orig) {
58599         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
58600         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
58601         *ret_copy = ProbeSendFailure_clone(orig_conv);
58602         uint64_t ret_ref = tag_ptr(ret_copy, true);
58603         return ret_ref;
58604 }
58605
58606 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_route_not_found"))) TS_ProbeSendFailure_route_not_found() {
58607         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
58608         *ret_copy = ProbeSendFailure_route_not_found();
58609         uint64_t ret_ref = tag_ptr(ret_copy, true);
58610         return ret_ref;
58611 }
58612
58613 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_sending_failed"))) TS_ProbeSendFailure_sending_failed(uint64_t a) {
58614         void* a_ptr = untag_ptr(a);
58615         CHECK_ACCESS(a_ptr);
58616         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
58617         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
58618         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
58619         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
58620         uint64_t ret_ref = tag_ptr(ret_copy, true);
58621         return ret_ref;
58622 }
58623
58624 jboolean  __attribute__((export_name("TS_ProbeSendFailure_eq"))) TS_ProbeSendFailure_eq(uint64_t a, uint64_t b) {
58625         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
58626         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
58627         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
58628         return ret_conv;
58629 }
58630
58631 void  __attribute__((export_name("TS_RecipientOnionFields_free"))) TS_RecipientOnionFields_free(uint64_t this_obj) {
58632         LDKRecipientOnionFields this_obj_conv;
58633         this_obj_conv.inner = untag_ptr(this_obj);
58634         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58636         RecipientOnionFields_free(this_obj_conv);
58637 }
58638
58639 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_secret"))) TS_RecipientOnionFields_get_payment_secret(uint64_t this_ptr) {
58640         LDKRecipientOnionFields this_ptr_conv;
58641         this_ptr_conv.inner = untag_ptr(this_ptr);
58642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58644         this_ptr_conv.is_owned = false;
58645         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
58646         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
58647         uint64_t ret_ref = tag_ptr(ret_copy, true);
58648         return ret_ref;
58649 }
58650
58651 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_secret"))) TS_RecipientOnionFields_set_payment_secret(uint64_t this_ptr, uint64_t val) {
58652         LDKRecipientOnionFields this_ptr_conv;
58653         this_ptr_conv.inner = untag_ptr(this_ptr);
58654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58656         this_ptr_conv.is_owned = false;
58657         void* val_ptr = untag_ptr(val);
58658         CHECK_ACCESS(val_ptr);
58659         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
58660         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
58661         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
58662 }
58663
58664 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_metadata"))) TS_RecipientOnionFields_get_payment_metadata(uint64_t this_ptr) {
58665         LDKRecipientOnionFields this_ptr_conv;
58666         this_ptr_conv.inner = untag_ptr(this_ptr);
58667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58669         this_ptr_conv.is_owned = false;
58670         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
58671         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
58672         uint64_t ret_ref = tag_ptr(ret_copy, true);
58673         return ret_ref;
58674 }
58675
58676 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_metadata"))) TS_RecipientOnionFields_set_payment_metadata(uint64_t this_ptr, uint64_t val) {
58677         LDKRecipientOnionFields this_ptr_conv;
58678         this_ptr_conv.inner = untag_ptr(this_ptr);
58679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58681         this_ptr_conv.is_owned = false;
58682         void* val_ptr = untag_ptr(val);
58683         CHECK_ACCESS(val_ptr);
58684         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
58685         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
58686         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
58687 }
58688
58689 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
58690         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
58691         uint64_t ret_ref = 0;
58692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58694         return ret_ref;
58695 }
58696 int64_t  __attribute__((export_name("TS_RecipientOnionFields_clone_ptr"))) TS_RecipientOnionFields_clone_ptr(uint64_t arg) {
58697         LDKRecipientOnionFields arg_conv;
58698         arg_conv.inner = untag_ptr(arg);
58699         arg_conv.is_owned = ptr_is_owned(arg);
58700         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58701         arg_conv.is_owned = false;
58702         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
58703         return ret_conv;
58704 }
58705
58706 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_clone"))) TS_RecipientOnionFields_clone(uint64_t orig) {
58707         LDKRecipientOnionFields orig_conv;
58708         orig_conv.inner = untag_ptr(orig);
58709         orig_conv.is_owned = ptr_is_owned(orig);
58710         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58711         orig_conv.is_owned = false;
58712         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
58713         uint64_t ret_ref = 0;
58714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58716         return ret_ref;
58717 }
58718
58719 jboolean  __attribute__((export_name("TS_RecipientOnionFields_eq"))) TS_RecipientOnionFields_eq(uint64_t a, uint64_t b) {
58720         LDKRecipientOnionFields a_conv;
58721         a_conv.inner = untag_ptr(a);
58722         a_conv.is_owned = ptr_is_owned(a);
58723         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58724         a_conv.is_owned = false;
58725         LDKRecipientOnionFields b_conv;
58726         b_conv.inner = untag_ptr(b);
58727         b_conv.is_owned = ptr_is_owned(b);
58728         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58729         b_conv.is_owned = false;
58730         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
58731         return ret_conv;
58732 }
58733
58734 int8_tArray  __attribute__((export_name("TS_RecipientOnionFields_write"))) TS_RecipientOnionFields_write(uint64_t obj) {
58735         LDKRecipientOnionFields obj_conv;
58736         obj_conv.inner = untag_ptr(obj);
58737         obj_conv.is_owned = ptr_is_owned(obj);
58738         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58739         obj_conv.is_owned = false;
58740         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
58741         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58742         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58743         CVec_u8Z_free(ret_var);
58744         return ret_arr;
58745 }
58746
58747 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_read"))) TS_RecipientOnionFields_read(int8_tArray ser) {
58748         LDKu8slice ser_ref;
58749         ser_ref.datalen = ser->arr_len;
58750         ser_ref.data = ser->elems;
58751         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
58752         *ret_conv = RecipientOnionFields_read(ser_ref);
58753         FREE(ser);
58754         return tag_ptr(ret_conv, true);
58755 }
58756
58757 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_secret_only"))) TS_RecipientOnionFields_secret_only(int8_tArray payment_secret) {
58758         LDKThirtyTwoBytes payment_secret_ref;
58759         CHECK(payment_secret->arr_len == 32);
58760         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
58761         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
58762         uint64_t ret_ref = 0;
58763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58765         return ret_ref;
58766 }
58767
58768 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_spontaneous_empty"))) TS_RecipientOnionFields_spontaneous_empty() {
58769         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
58770         uint64_t ret_ref = 0;
58771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58773         return ret_ref;
58774 }
58775
58776 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_with_custom_tlvs"))) TS_RecipientOnionFields_with_custom_tlvs(uint64_t this_arg, uint64_tArray custom_tlvs) {
58777         LDKRecipientOnionFields this_arg_conv;
58778         this_arg_conv.inner = untag_ptr(this_arg);
58779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58781         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
58782         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
58783         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
58784         if (custom_tlvs_constr.datalen > 0)
58785                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
58786         else
58787                 custom_tlvs_constr.data = NULL;
58788         uint64_t* custom_tlvs_vals = custom_tlvs->elems;
58789         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
58790                 uint64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
58791                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
58792                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
58793                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
58794                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
58795                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
58796         }
58797         FREE(custom_tlvs);
58798         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
58799         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
58800         return tag_ptr(ret_conv, true);
58801 }
58802
58803 uint64_tArray  __attribute__((export_name("TS_RecipientOnionFields_custom_tlvs"))) TS_RecipientOnionFields_custom_tlvs(uint64_t this_arg) {
58804         LDKRecipientOnionFields this_arg_conv;
58805         this_arg_conv.inner = untag_ptr(this_arg);
58806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58808         this_arg_conv.is_owned = false;
58809         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
58810         uint64_tArray ret_arr = NULL;
58811         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
58812         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
58813         for (size_t x = 0; x < ret_var.datalen; x++) {
58814                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
58815                 *ret_conv_23_conv = ret_var.data[x];
58816                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
58817         }
58818         
58819         FREE(ret_var.data);
58820         return ret_arr;
58821 }
58822
58823 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
58824         if (!ptr_is_owned(this_ptr)) return;
58825         void* this_ptr_ptr = untag_ptr(this_ptr);
58826         CHECK_ACCESS(this_ptr_ptr);
58827         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
58828         FREE(untag_ptr(this_ptr));
58829         CustomMessageReader_free(this_ptr_conv);
58830 }
58831
58832 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
58833         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
58834         *ret_ret = Type_clone(arg);
58835         return tag_ptr(ret_ret, true);
58836 }
58837 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
58838         void* arg_ptr = untag_ptr(arg);
58839         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
58840         LDKType* arg_conv = (LDKType*)arg_ptr;
58841         int64_t ret_conv = Type_clone_ptr(arg_conv);
58842         return ret_conv;
58843 }
58844
58845 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
58846         void* orig_ptr = untag_ptr(orig);
58847         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
58848         LDKType* orig_conv = (LDKType*)orig_ptr;
58849         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
58850         *ret_ret = Type_clone(orig_conv);
58851         return tag_ptr(ret_ret, true);
58852 }
58853
58854 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
58855         if (!ptr_is_owned(this_ptr)) return;
58856         void* this_ptr_ptr = untag_ptr(this_ptr);
58857         CHECK_ACCESS(this_ptr_ptr);
58858         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
58859         FREE(untag_ptr(this_ptr));
58860         Type_free(this_ptr_conv);
58861 }
58862
58863 void  __attribute__((export_name("TS_Offer_free"))) TS_Offer_free(uint64_t this_obj) {
58864         LDKOffer this_obj_conv;
58865         this_obj_conv.inner = untag_ptr(this_obj);
58866         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58868         Offer_free(this_obj_conv);
58869 }
58870
58871 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
58872         LDKOffer ret_var = Offer_clone(arg);
58873         uint64_t ret_ref = 0;
58874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58876         return ret_ref;
58877 }
58878 int64_t  __attribute__((export_name("TS_Offer_clone_ptr"))) TS_Offer_clone_ptr(uint64_t arg) {
58879         LDKOffer arg_conv;
58880         arg_conv.inner = untag_ptr(arg);
58881         arg_conv.is_owned = ptr_is_owned(arg);
58882         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58883         arg_conv.is_owned = false;
58884         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
58885         return ret_conv;
58886 }
58887
58888 uint64_t  __attribute__((export_name("TS_Offer_clone"))) TS_Offer_clone(uint64_t orig) {
58889         LDKOffer orig_conv;
58890         orig_conv.inner = untag_ptr(orig);
58891         orig_conv.is_owned = ptr_is_owned(orig);
58892         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58893         orig_conv.is_owned = false;
58894         LDKOffer ret_var = Offer_clone(&orig_conv);
58895         uint64_t ret_ref = 0;
58896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58898         return ret_ref;
58899 }
58900
58901 ptrArray  __attribute__((export_name("TS_Offer_chains"))) TS_Offer_chains(uint64_t this_arg) {
58902         LDKOffer this_arg_conv;
58903         this_arg_conv.inner = untag_ptr(this_arg);
58904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58906         this_arg_conv.is_owned = false;
58907         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
58908         ptrArray ret_arr = NULL;
58909         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
58910         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
58911         for (size_t m = 0; m < ret_var.datalen; m++) {
58912                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
58913                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
58914                 ret_arr_ptr[m] = ret_conv_12_arr;
58915         }
58916         
58917         FREE(ret_var.data);
58918         return ret_arr;
58919 }
58920
58921 uint64_t  __attribute__((export_name("TS_Offer_metadata"))) TS_Offer_metadata(uint64_t this_arg) {
58922         LDKOffer this_arg_conv;
58923         this_arg_conv.inner = untag_ptr(this_arg);
58924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58926         this_arg_conv.is_owned = false;
58927         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
58928         *ret_copy = Offer_metadata(&this_arg_conv);
58929         uint64_t ret_ref = tag_ptr(ret_copy, true);
58930         return ret_ref;
58931 }
58932
58933 uint64_t  __attribute__((export_name("TS_Offer_amount"))) TS_Offer_amount(uint64_t this_arg) {
58934         LDKOffer this_arg_conv;
58935         this_arg_conv.inner = untag_ptr(this_arg);
58936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58938         this_arg_conv.is_owned = false;
58939         LDKAmount ret_var = Offer_amount(&this_arg_conv);
58940         uint64_t ret_ref = 0;
58941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58943         return ret_ref;
58944 }
58945
58946 uint64_t  __attribute__((export_name("TS_Offer_description"))) TS_Offer_description(uint64_t this_arg) {
58947         LDKOffer this_arg_conv;
58948         this_arg_conv.inner = untag_ptr(this_arg);
58949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58951         this_arg_conv.is_owned = false;
58952         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
58953         uint64_t ret_ref = 0;
58954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58956         return ret_ref;
58957 }
58958
58959 uint64_t  __attribute__((export_name("TS_Offer_offer_features"))) TS_Offer_offer_features(uint64_t this_arg) {
58960         LDKOffer this_arg_conv;
58961         this_arg_conv.inner = untag_ptr(this_arg);
58962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58964         this_arg_conv.is_owned = false;
58965         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
58966         uint64_t ret_ref = 0;
58967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58969         return ret_ref;
58970 }
58971
58972 uint64_t  __attribute__((export_name("TS_Offer_absolute_expiry"))) TS_Offer_absolute_expiry(uint64_t this_arg) {
58973         LDKOffer this_arg_conv;
58974         this_arg_conv.inner = untag_ptr(this_arg);
58975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58977         this_arg_conv.is_owned = false;
58978         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
58979         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
58980         uint64_t ret_ref = tag_ptr(ret_copy, true);
58981         return ret_ref;
58982 }
58983
58984 uint64_t  __attribute__((export_name("TS_Offer_issuer"))) TS_Offer_issuer(uint64_t this_arg) {
58985         LDKOffer this_arg_conv;
58986         this_arg_conv.inner = untag_ptr(this_arg);
58987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58989         this_arg_conv.is_owned = false;
58990         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
58991         uint64_t ret_ref = 0;
58992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58994         return ret_ref;
58995 }
58996
58997 uint64_tArray  __attribute__((export_name("TS_Offer_paths"))) TS_Offer_paths(uint64_t this_arg) {
58998         LDKOffer this_arg_conv;
58999         this_arg_conv.inner = untag_ptr(this_arg);
59000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59002         this_arg_conv.is_owned = false;
59003         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
59004         uint64_tArray ret_arr = NULL;
59005         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
59006         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
59007         for (size_t n = 0; n < ret_var.datalen; n++) {
59008                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
59009                 uint64_t ret_conv_13_ref = 0;
59010                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
59011                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
59012                 ret_arr_ptr[n] = ret_conv_13_ref;
59013         }
59014         
59015         FREE(ret_var.data);
59016         return ret_arr;
59017 }
59018
59019 uint64_t  __attribute__((export_name("TS_Offer_supported_quantity"))) TS_Offer_supported_quantity(uint64_t this_arg) {
59020         LDKOffer this_arg_conv;
59021         this_arg_conv.inner = untag_ptr(this_arg);
59022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59024         this_arg_conv.is_owned = false;
59025         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
59026         uint64_t ret_ref = 0;
59027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59029         return ret_ref;
59030 }
59031
59032 int8_tArray  __attribute__((export_name("TS_Offer_signing_pubkey"))) TS_Offer_signing_pubkey(uint64_t this_arg) {
59033         LDKOffer this_arg_conv;
59034         this_arg_conv.inner = untag_ptr(this_arg);
59035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59037         this_arg_conv.is_owned = false;
59038         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
59039         memcpy(ret_arr->elems, Offer_signing_pubkey(&this_arg_conv).compressed_form, 33);
59040         return ret_arr;
59041 }
59042
59043 jboolean  __attribute__((export_name("TS_Offer_supports_chain"))) TS_Offer_supports_chain(uint64_t this_arg, int8_tArray chain) {
59044         LDKOffer this_arg_conv;
59045         this_arg_conv.inner = untag_ptr(this_arg);
59046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59048         this_arg_conv.is_owned = false;
59049         LDKThirtyTwoBytes chain_ref;
59050         CHECK(chain->arr_len == 32);
59051         memcpy(chain_ref.data, chain->elems, 32); FREE(chain);
59052         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
59053         return ret_conv;
59054 }
59055
59056 jboolean  __attribute__((export_name("TS_Offer_is_expired_no_std"))) TS_Offer_is_expired_no_std(uint64_t this_arg, int64_t duration_since_epoch) {
59057         LDKOffer this_arg_conv;
59058         this_arg_conv.inner = untag_ptr(this_arg);
59059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59061         this_arg_conv.is_owned = false;
59062         jboolean ret_conv = Offer_is_expired_no_std(&this_arg_conv, duration_since_epoch);
59063         return ret_conv;
59064 }
59065
59066 jboolean  __attribute__((export_name("TS_Offer_is_valid_quantity"))) TS_Offer_is_valid_quantity(uint64_t this_arg, int64_t quantity) {
59067         LDKOffer this_arg_conv;
59068         this_arg_conv.inner = untag_ptr(this_arg);
59069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59071         this_arg_conv.is_owned = false;
59072         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
59073         return ret_conv;
59074 }
59075
59076 jboolean  __attribute__((export_name("TS_Offer_expects_quantity"))) TS_Offer_expects_quantity(uint64_t this_arg) {
59077         LDKOffer this_arg_conv;
59078         this_arg_conv.inner = untag_ptr(this_arg);
59079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59081         this_arg_conv.is_owned = false;
59082         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
59083         return ret_conv;
59084 }
59085
59086 int8_tArray  __attribute__((export_name("TS_Offer_write"))) TS_Offer_write(uint64_t obj) {
59087         LDKOffer obj_conv;
59088         obj_conv.inner = untag_ptr(obj);
59089         obj_conv.is_owned = ptr_is_owned(obj);
59090         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59091         obj_conv.is_owned = false;
59092         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
59093         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59094         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59095         CVec_u8Z_free(ret_var);
59096         return ret_arr;
59097 }
59098
59099 void  __attribute__((export_name("TS_Amount_free"))) TS_Amount_free(uint64_t this_obj) {
59100         LDKAmount this_obj_conv;
59101         this_obj_conv.inner = untag_ptr(this_obj);
59102         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59104         Amount_free(this_obj_conv);
59105 }
59106
59107 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
59108         LDKAmount ret_var = Amount_clone(arg);
59109         uint64_t ret_ref = 0;
59110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59112         return ret_ref;
59113 }
59114 int64_t  __attribute__((export_name("TS_Amount_clone_ptr"))) TS_Amount_clone_ptr(uint64_t arg) {
59115         LDKAmount arg_conv;
59116         arg_conv.inner = untag_ptr(arg);
59117         arg_conv.is_owned = ptr_is_owned(arg);
59118         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59119         arg_conv.is_owned = false;
59120         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
59121         return ret_conv;
59122 }
59123
59124 uint64_t  __attribute__((export_name("TS_Amount_clone"))) TS_Amount_clone(uint64_t orig) {
59125         LDKAmount orig_conv;
59126         orig_conv.inner = untag_ptr(orig);
59127         orig_conv.is_owned = ptr_is_owned(orig);
59128         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59129         orig_conv.is_owned = false;
59130         LDKAmount ret_var = Amount_clone(&orig_conv);
59131         uint64_t ret_ref = 0;
59132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59134         return ret_ref;
59135 }
59136
59137 void  __attribute__((export_name("TS_Quantity_free"))) TS_Quantity_free(uint64_t this_obj) {
59138         LDKQuantity this_obj_conv;
59139         this_obj_conv.inner = untag_ptr(this_obj);
59140         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59142         Quantity_free(this_obj_conv);
59143 }
59144
59145 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
59146         LDKQuantity ret_var = Quantity_clone(arg);
59147         uint64_t ret_ref = 0;
59148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59150         return ret_ref;
59151 }
59152 int64_t  __attribute__((export_name("TS_Quantity_clone_ptr"))) TS_Quantity_clone_ptr(uint64_t arg) {
59153         LDKQuantity arg_conv;
59154         arg_conv.inner = untag_ptr(arg);
59155         arg_conv.is_owned = ptr_is_owned(arg);
59156         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59157         arg_conv.is_owned = false;
59158         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
59159         return ret_conv;
59160 }
59161
59162 uint64_t  __attribute__((export_name("TS_Quantity_clone"))) TS_Quantity_clone(uint64_t orig) {
59163         LDKQuantity orig_conv;
59164         orig_conv.inner = untag_ptr(orig);
59165         orig_conv.is_owned = ptr_is_owned(orig);
59166         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59167         orig_conv.is_owned = false;
59168         LDKQuantity ret_var = Quantity_clone(&orig_conv);
59169         uint64_t ret_ref = 0;
59170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59172         return ret_ref;
59173 }
59174
59175 uint64_t  __attribute__((export_name("TS_Offer_from_str"))) TS_Offer_from_str(jstring s) {
59176         LDKStr s_conv = str_ref_to_owned_c(s);
59177         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
59178         *ret_conv = Offer_from_str(s_conv);
59179         return tag_ptr(ret_conv, true);
59180 }
59181
59182 void  __attribute__((export_name("TS_UnsignedBolt12Invoice_free"))) TS_UnsignedBolt12Invoice_free(uint64_t this_obj) {
59183         LDKUnsignedBolt12Invoice this_obj_conv;
59184         this_obj_conv.inner = untag_ptr(this_obj);
59185         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59187         UnsignedBolt12Invoice_free(this_obj_conv);
59188 }
59189
59190 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_tagged_hash"))) TS_UnsignedBolt12Invoice_tagged_hash(uint64_t this_arg) {
59191         LDKUnsignedBolt12Invoice this_arg_conv;
59192         this_arg_conv.inner = untag_ptr(this_arg);
59193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59195         this_arg_conv.is_owned = false;
59196         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
59197         uint64_t ret_ref = 0;
59198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59200         return ret_ref;
59201 }
59202
59203 void  __attribute__((export_name("TS_Bolt12Invoice_free"))) TS_Bolt12Invoice_free(uint64_t this_obj) {
59204         LDKBolt12Invoice this_obj_conv;
59205         this_obj_conv.inner = untag_ptr(this_obj);
59206         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59208         Bolt12Invoice_free(this_obj_conv);
59209 }
59210
59211 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
59212         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
59213         uint64_t ret_ref = 0;
59214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59216         return ret_ref;
59217 }
59218 int64_t  __attribute__((export_name("TS_Bolt12Invoice_clone_ptr"))) TS_Bolt12Invoice_clone_ptr(uint64_t arg) {
59219         LDKBolt12Invoice arg_conv;
59220         arg_conv.inner = untag_ptr(arg);
59221         arg_conv.is_owned = ptr_is_owned(arg);
59222         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59223         arg_conv.is_owned = false;
59224         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
59225         return ret_conv;
59226 }
59227
59228 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_clone"))) TS_Bolt12Invoice_clone(uint64_t orig) {
59229         LDKBolt12Invoice orig_conv;
59230         orig_conv.inner = untag_ptr(orig);
59231         orig_conv.is_owned = ptr_is_owned(orig);
59232         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59233         orig_conv.is_owned = false;
59234         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
59235         uint64_t ret_ref = 0;
59236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59238         return ret_ref;
59239 }
59240
59241 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_offer_chains"))) TS_UnsignedBolt12Invoice_offer_chains(uint64_t this_arg) {
59242         LDKUnsignedBolt12Invoice this_arg_conv;
59243         this_arg_conv.inner = untag_ptr(this_arg);
59244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59246         this_arg_conv.is_owned = false;
59247         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
59248         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
59249         uint64_t ret_ref = tag_ptr(ret_copy, true);
59250         return ret_ref;
59251 }
59252
59253 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_chain"))) TS_UnsignedBolt12Invoice_chain(uint64_t this_arg) {
59254         LDKUnsignedBolt12Invoice this_arg_conv;
59255         this_arg_conv.inner = untag_ptr(this_arg);
59256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59258         this_arg_conv.is_owned = false;
59259         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59260         memcpy(ret_arr->elems, UnsignedBolt12Invoice_chain(&this_arg_conv).data, 32);
59261         return ret_arr;
59262 }
59263
59264 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_metadata"))) TS_UnsignedBolt12Invoice_metadata(uint64_t this_arg) {
59265         LDKUnsignedBolt12Invoice this_arg_conv;
59266         this_arg_conv.inner = untag_ptr(this_arg);
59267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59269         this_arg_conv.is_owned = false;
59270         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59271         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
59272         uint64_t ret_ref = tag_ptr(ret_copy, true);
59273         return ret_ref;
59274 }
59275
59276 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_amount"))) TS_UnsignedBolt12Invoice_amount(uint64_t this_arg) {
59277         LDKUnsignedBolt12Invoice this_arg_conv;
59278         this_arg_conv.inner = untag_ptr(this_arg);
59279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59281         this_arg_conv.is_owned = false;
59282         LDKAmount ret_var = UnsignedBolt12Invoice_amount(&this_arg_conv);
59283         uint64_t ret_ref = 0;
59284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59286         return ret_ref;
59287 }
59288
59289 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_offer_features"))) TS_UnsignedBolt12Invoice_offer_features(uint64_t this_arg) {
59290         LDKUnsignedBolt12Invoice this_arg_conv;
59291         this_arg_conv.inner = untag_ptr(this_arg);
59292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59294         this_arg_conv.is_owned = false;
59295         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
59296         uint64_t ret_ref = 0;
59297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59299         return ret_ref;
59300 }
59301
59302 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_description"))) TS_UnsignedBolt12Invoice_description(uint64_t this_arg) {
59303         LDKUnsignedBolt12Invoice this_arg_conv;
59304         this_arg_conv.inner = untag_ptr(this_arg);
59305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59307         this_arg_conv.is_owned = false;
59308         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
59309         uint64_t ret_ref = 0;
59310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59312         return ret_ref;
59313 }
59314
59315 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_absolute_expiry"))) TS_UnsignedBolt12Invoice_absolute_expiry(uint64_t this_arg) {
59316         LDKUnsignedBolt12Invoice this_arg_conv;
59317         this_arg_conv.inner = untag_ptr(this_arg);
59318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59320         this_arg_conv.is_owned = false;
59321         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59322         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
59323         uint64_t ret_ref = tag_ptr(ret_copy, true);
59324         return ret_ref;
59325 }
59326
59327 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_issuer"))) TS_UnsignedBolt12Invoice_issuer(uint64_t this_arg) {
59328         LDKUnsignedBolt12Invoice this_arg_conv;
59329         this_arg_conv.inner = untag_ptr(this_arg);
59330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59332         this_arg_conv.is_owned = false;
59333         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
59334         uint64_t ret_ref = 0;
59335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59337         return ret_ref;
59338 }
59339
59340 uint64_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_message_paths"))) TS_UnsignedBolt12Invoice_message_paths(uint64_t this_arg) {
59341         LDKUnsignedBolt12Invoice this_arg_conv;
59342         this_arg_conv.inner = untag_ptr(this_arg);
59343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59345         this_arg_conv.is_owned = false;
59346         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
59347         uint64_tArray ret_arr = NULL;
59348         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
59349         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
59350         for (size_t n = 0; n < ret_var.datalen; n++) {
59351                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
59352                 uint64_t ret_conv_13_ref = 0;
59353                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
59354                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
59355                 ret_arr_ptr[n] = ret_conv_13_ref;
59356         }
59357         
59358         FREE(ret_var.data);
59359         return ret_arr;
59360 }
59361
59362 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_supported_quantity"))) TS_UnsignedBolt12Invoice_supported_quantity(uint64_t this_arg) {
59363         LDKUnsignedBolt12Invoice this_arg_conv;
59364         this_arg_conv.inner = untag_ptr(this_arg);
59365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59367         this_arg_conv.is_owned = false;
59368         LDKQuantity ret_var = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
59369         uint64_t ret_ref = 0;
59370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59372         return ret_ref;
59373 }
59374
59375 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_metadata"))) TS_UnsignedBolt12Invoice_payer_metadata(uint64_t this_arg) {
59376         LDKUnsignedBolt12Invoice this_arg_conv;
59377         this_arg_conv.inner = untag_ptr(this_arg);
59378         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59380         this_arg_conv.is_owned = false;
59381         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
59382         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59383         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59384         return ret_arr;
59385 }
59386
59387 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_invoice_request_features"))) TS_UnsignedBolt12Invoice_invoice_request_features(uint64_t this_arg) {
59388         LDKUnsignedBolt12Invoice this_arg_conv;
59389         this_arg_conv.inner = untag_ptr(this_arg);
59390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59392         this_arg_conv.is_owned = false;
59393         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
59394         uint64_t ret_ref = 0;
59395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59397         return ret_ref;
59398 }
59399
59400 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_quantity"))) TS_UnsignedBolt12Invoice_quantity(uint64_t this_arg) {
59401         LDKUnsignedBolt12Invoice this_arg_conv;
59402         this_arg_conv.inner = untag_ptr(this_arg);
59403         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59405         this_arg_conv.is_owned = false;
59406         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59407         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
59408         uint64_t ret_ref = tag_ptr(ret_copy, true);
59409         return ret_ref;
59410 }
59411
59412 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_id"))) TS_UnsignedBolt12Invoice_payer_id(uint64_t this_arg) {
59413         LDKUnsignedBolt12Invoice this_arg_conv;
59414         this_arg_conv.inner = untag_ptr(this_arg);
59415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59417         this_arg_conv.is_owned = false;
59418         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
59419         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
59420         return ret_arr;
59421 }
59422
59423 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_note"))) TS_UnsignedBolt12Invoice_payer_note(uint64_t this_arg) {
59424         LDKUnsignedBolt12Invoice this_arg_conv;
59425         this_arg_conv.inner = untag_ptr(this_arg);
59426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59428         this_arg_conv.is_owned = false;
59429         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
59430         uint64_t ret_ref = 0;
59431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59433         return ret_ref;
59434 }
59435
59436 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_created_at"))) TS_UnsignedBolt12Invoice_created_at(uint64_t this_arg) {
59437         LDKUnsignedBolt12Invoice this_arg_conv;
59438         this_arg_conv.inner = untag_ptr(this_arg);
59439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59441         this_arg_conv.is_owned = false;
59442         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
59443         return ret_conv;
59444 }
59445
59446 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_relative_expiry"))) TS_UnsignedBolt12Invoice_relative_expiry(uint64_t this_arg) {
59447         LDKUnsignedBolt12Invoice this_arg_conv;
59448         this_arg_conv.inner = untag_ptr(this_arg);
59449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59451         this_arg_conv.is_owned = false;
59452         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
59453         return ret_conv;
59454 }
59455
59456 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payment_hash"))) TS_UnsignedBolt12Invoice_payment_hash(uint64_t this_arg) {
59457         LDKUnsignedBolt12Invoice this_arg_conv;
59458         this_arg_conv.inner = untag_ptr(this_arg);
59459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59461         this_arg_conv.is_owned = false;
59462         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59463         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data, 32);
59464         return ret_arr;
59465 }
59466
59467 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_amount_msats"))) TS_UnsignedBolt12Invoice_amount_msats(uint64_t this_arg) {
59468         LDKUnsignedBolt12Invoice this_arg_conv;
59469         this_arg_conv.inner = untag_ptr(this_arg);
59470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59472         this_arg_conv.is_owned = false;
59473         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
59474         return ret_conv;
59475 }
59476
59477 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_invoice_features"))) TS_UnsignedBolt12Invoice_invoice_features(uint64_t this_arg) {
59478         LDKUnsignedBolt12Invoice this_arg_conv;
59479         this_arg_conv.inner = untag_ptr(this_arg);
59480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59482         this_arg_conv.is_owned = false;
59483         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
59484         uint64_t ret_ref = 0;
59485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59487         return ret_ref;
59488 }
59489
59490 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_signing_pubkey"))) TS_UnsignedBolt12Invoice_signing_pubkey(uint64_t this_arg) {
59491         LDKUnsignedBolt12Invoice this_arg_conv;
59492         this_arg_conv.inner = untag_ptr(this_arg);
59493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59495         this_arg_conv.is_owned = false;
59496         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
59497         memcpy(ret_arr->elems, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
59498         return ret_arr;
59499 }
59500
59501 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_offer_chains"))) TS_Bolt12Invoice_offer_chains(uint64_t this_arg) {
59502         LDKBolt12Invoice this_arg_conv;
59503         this_arg_conv.inner = untag_ptr(this_arg);
59504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59506         this_arg_conv.is_owned = false;
59507         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
59508         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
59509         uint64_t ret_ref = tag_ptr(ret_copy, true);
59510         return ret_ref;
59511 }
59512
59513 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_chain"))) TS_Bolt12Invoice_chain(uint64_t this_arg) {
59514         LDKBolt12Invoice this_arg_conv;
59515         this_arg_conv.inner = untag_ptr(this_arg);
59516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59518         this_arg_conv.is_owned = false;
59519         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59520         memcpy(ret_arr->elems, Bolt12Invoice_chain(&this_arg_conv).data, 32);
59521         return ret_arr;
59522 }
59523
59524 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_metadata"))) TS_Bolt12Invoice_metadata(uint64_t this_arg) {
59525         LDKBolt12Invoice this_arg_conv;
59526         this_arg_conv.inner = untag_ptr(this_arg);
59527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59529         this_arg_conv.is_owned = false;
59530         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59531         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
59532         uint64_t ret_ref = tag_ptr(ret_copy, true);
59533         return ret_ref;
59534 }
59535
59536 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_amount"))) TS_Bolt12Invoice_amount(uint64_t this_arg) {
59537         LDKBolt12Invoice this_arg_conv;
59538         this_arg_conv.inner = untag_ptr(this_arg);
59539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59541         this_arg_conv.is_owned = false;
59542         LDKAmount ret_var = Bolt12Invoice_amount(&this_arg_conv);
59543         uint64_t ret_ref = 0;
59544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59546         return ret_ref;
59547 }
59548
59549 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_offer_features"))) TS_Bolt12Invoice_offer_features(uint64_t this_arg) {
59550         LDKBolt12Invoice this_arg_conv;
59551         this_arg_conv.inner = untag_ptr(this_arg);
59552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59554         this_arg_conv.is_owned = false;
59555         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
59556         uint64_t ret_ref = 0;
59557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59559         return ret_ref;
59560 }
59561
59562 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_description"))) TS_Bolt12Invoice_description(uint64_t this_arg) {
59563         LDKBolt12Invoice this_arg_conv;
59564         this_arg_conv.inner = untag_ptr(this_arg);
59565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59567         this_arg_conv.is_owned = false;
59568         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
59569         uint64_t ret_ref = 0;
59570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59572         return ret_ref;
59573 }
59574
59575 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_absolute_expiry"))) TS_Bolt12Invoice_absolute_expiry(uint64_t this_arg) {
59576         LDKBolt12Invoice this_arg_conv;
59577         this_arg_conv.inner = untag_ptr(this_arg);
59578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59580         this_arg_conv.is_owned = false;
59581         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59582         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
59583         uint64_t ret_ref = tag_ptr(ret_copy, true);
59584         return ret_ref;
59585 }
59586
59587 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_issuer"))) TS_Bolt12Invoice_issuer(uint64_t this_arg) {
59588         LDKBolt12Invoice this_arg_conv;
59589         this_arg_conv.inner = untag_ptr(this_arg);
59590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59592         this_arg_conv.is_owned = false;
59593         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
59594         uint64_t ret_ref = 0;
59595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59597         return ret_ref;
59598 }
59599
59600 uint64_tArray  __attribute__((export_name("TS_Bolt12Invoice_message_paths"))) TS_Bolt12Invoice_message_paths(uint64_t this_arg) {
59601         LDKBolt12Invoice this_arg_conv;
59602         this_arg_conv.inner = untag_ptr(this_arg);
59603         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59605         this_arg_conv.is_owned = false;
59606         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
59607         uint64_tArray ret_arr = NULL;
59608         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
59609         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
59610         for (size_t n = 0; n < ret_var.datalen; n++) {
59611                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
59612                 uint64_t ret_conv_13_ref = 0;
59613                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
59614                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
59615                 ret_arr_ptr[n] = ret_conv_13_ref;
59616         }
59617         
59618         FREE(ret_var.data);
59619         return ret_arr;
59620 }
59621
59622 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_supported_quantity"))) TS_Bolt12Invoice_supported_quantity(uint64_t this_arg) {
59623         LDKBolt12Invoice this_arg_conv;
59624         this_arg_conv.inner = untag_ptr(this_arg);
59625         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59627         this_arg_conv.is_owned = false;
59628         LDKQuantity ret_var = Bolt12Invoice_supported_quantity(&this_arg_conv);
59629         uint64_t ret_ref = 0;
59630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59632         return ret_ref;
59633 }
59634
59635 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payer_metadata"))) TS_Bolt12Invoice_payer_metadata(uint64_t this_arg) {
59636         LDKBolt12Invoice this_arg_conv;
59637         this_arg_conv.inner = untag_ptr(this_arg);
59638         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59640         this_arg_conv.is_owned = false;
59641         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
59642         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59643         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59644         return ret_arr;
59645 }
59646
59647 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_invoice_request_features"))) TS_Bolt12Invoice_invoice_request_features(uint64_t this_arg) {
59648         LDKBolt12Invoice this_arg_conv;
59649         this_arg_conv.inner = untag_ptr(this_arg);
59650         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59652         this_arg_conv.is_owned = false;
59653         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
59654         uint64_t ret_ref = 0;
59655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59657         return ret_ref;
59658 }
59659
59660 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_quantity"))) TS_Bolt12Invoice_quantity(uint64_t this_arg) {
59661         LDKBolt12Invoice this_arg_conv;
59662         this_arg_conv.inner = untag_ptr(this_arg);
59663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59665         this_arg_conv.is_owned = false;
59666         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59667         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
59668         uint64_t ret_ref = tag_ptr(ret_copy, true);
59669         return ret_ref;
59670 }
59671
59672 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payer_id"))) TS_Bolt12Invoice_payer_id(uint64_t this_arg) {
59673         LDKBolt12Invoice this_arg_conv;
59674         this_arg_conv.inner = untag_ptr(this_arg);
59675         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59677         this_arg_conv.is_owned = false;
59678         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
59679         memcpy(ret_arr->elems, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
59680         return ret_arr;
59681 }
59682
59683 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_payer_note"))) TS_Bolt12Invoice_payer_note(uint64_t this_arg) {
59684         LDKBolt12Invoice this_arg_conv;
59685         this_arg_conv.inner = untag_ptr(this_arg);
59686         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59688         this_arg_conv.is_owned = false;
59689         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
59690         uint64_t ret_ref = 0;
59691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59693         return ret_ref;
59694 }
59695
59696 int64_t  __attribute__((export_name("TS_Bolt12Invoice_created_at"))) TS_Bolt12Invoice_created_at(uint64_t this_arg) {
59697         LDKBolt12Invoice this_arg_conv;
59698         this_arg_conv.inner = untag_ptr(this_arg);
59699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59701         this_arg_conv.is_owned = false;
59702         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
59703         return ret_conv;
59704 }
59705
59706 int64_t  __attribute__((export_name("TS_Bolt12Invoice_relative_expiry"))) TS_Bolt12Invoice_relative_expiry(uint64_t this_arg) {
59707         LDKBolt12Invoice this_arg_conv;
59708         this_arg_conv.inner = untag_ptr(this_arg);
59709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59711         this_arg_conv.is_owned = false;
59712         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
59713         return ret_conv;
59714 }
59715
59716 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payment_hash"))) TS_Bolt12Invoice_payment_hash(uint64_t this_arg) {
59717         LDKBolt12Invoice this_arg_conv;
59718         this_arg_conv.inner = untag_ptr(this_arg);
59719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59721         this_arg_conv.is_owned = false;
59722         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59723         memcpy(ret_arr->elems, Bolt12Invoice_payment_hash(&this_arg_conv).data, 32);
59724         return ret_arr;
59725 }
59726
59727 int64_t  __attribute__((export_name("TS_Bolt12Invoice_amount_msats"))) TS_Bolt12Invoice_amount_msats(uint64_t this_arg) {
59728         LDKBolt12Invoice this_arg_conv;
59729         this_arg_conv.inner = untag_ptr(this_arg);
59730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59732         this_arg_conv.is_owned = false;
59733         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
59734         return ret_conv;
59735 }
59736
59737 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_invoice_features"))) TS_Bolt12Invoice_invoice_features(uint64_t this_arg) {
59738         LDKBolt12Invoice this_arg_conv;
59739         this_arg_conv.inner = untag_ptr(this_arg);
59740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59742         this_arg_conv.is_owned = false;
59743         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
59744         uint64_t ret_ref = 0;
59745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59747         return ret_ref;
59748 }
59749
59750 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signing_pubkey"))) TS_Bolt12Invoice_signing_pubkey(uint64_t this_arg) {
59751         LDKBolt12Invoice this_arg_conv;
59752         this_arg_conv.inner = untag_ptr(this_arg);
59753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59755         this_arg_conv.is_owned = false;
59756         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
59757         memcpy(ret_arr->elems, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
59758         return ret_arr;
59759 }
59760
59761 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signature"))) TS_Bolt12Invoice_signature(uint64_t this_arg) {
59762         LDKBolt12Invoice this_arg_conv;
59763         this_arg_conv.inner = untag_ptr(this_arg);
59764         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59766         this_arg_conv.is_owned = false;
59767         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
59768         memcpy(ret_arr->elems, Bolt12Invoice_signature(&this_arg_conv).compact_form, 64);
59769         return ret_arr;
59770 }
59771
59772 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signable_hash"))) TS_Bolt12Invoice_signable_hash(uint64_t this_arg) {
59773         LDKBolt12Invoice this_arg_conv;
59774         this_arg_conv.inner = untag_ptr(this_arg);
59775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59777         this_arg_conv.is_owned = false;
59778         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59779         memcpy(ret_arr->elems, Bolt12Invoice_signable_hash(&this_arg_conv).data, 32);
59780         return ret_arr;
59781 }
59782
59783 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_verify"))) TS_Bolt12Invoice_verify(uint64_t this_arg, uint64_t key) {
59784         LDKBolt12Invoice this_arg_conv;
59785         this_arg_conv.inner = untag_ptr(this_arg);
59786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59788         this_arg_conv.is_owned = false;
59789         LDKExpandedKey key_conv;
59790         key_conv.inner = untag_ptr(key);
59791         key_conv.is_owned = ptr_is_owned(key);
59792         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
59793         key_conv.is_owned = false;
59794         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
59795         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
59796         return tag_ptr(ret_conv, true);
59797 }
59798
59799 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_write"))) TS_UnsignedBolt12Invoice_write(uint64_t obj) {
59800         LDKUnsignedBolt12Invoice obj_conv;
59801         obj_conv.inner = untag_ptr(obj);
59802         obj_conv.is_owned = ptr_is_owned(obj);
59803         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59804         obj_conv.is_owned = false;
59805         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
59806         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59807         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59808         CVec_u8Z_free(ret_var);
59809         return ret_arr;
59810 }
59811
59812 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_write"))) TS_Bolt12Invoice_write(uint64_t obj) {
59813         LDKBolt12Invoice obj_conv;
59814         obj_conv.inner = untag_ptr(obj);
59815         obj_conv.is_owned = ptr_is_owned(obj);
59816         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59817         obj_conv.is_owned = false;
59818         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
59819         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59820         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59821         CVec_u8Z_free(ret_var);
59822         return ret_arr;
59823 }
59824
59825 void  __attribute__((export_name("TS_BlindedPayInfo_free"))) TS_BlindedPayInfo_free(uint64_t this_obj) {
59826         LDKBlindedPayInfo this_obj_conv;
59827         this_obj_conv.inner = untag_ptr(this_obj);
59828         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59830         BlindedPayInfo_free(this_obj_conv);
59831 }
59832
59833 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_base_msat"))) TS_BlindedPayInfo_get_fee_base_msat(uint64_t this_ptr) {
59834         LDKBlindedPayInfo this_ptr_conv;
59835         this_ptr_conv.inner = untag_ptr(this_ptr);
59836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59838         this_ptr_conv.is_owned = false;
59839         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
59840         return ret_conv;
59841 }
59842
59843 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_base_msat"))) TS_BlindedPayInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
59844         LDKBlindedPayInfo this_ptr_conv;
59845         this_ptr_conv.inner = untag_ptr(this_ptr);
59846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59848         this_ptr_conv.is_owned = false;
59849         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
59850 }
59851
59852 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_proportional_millionths"))) TS_BlindedPayInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
59853         LDKBlindedPayInfo this_ptr_conv;
59854         this_ptr_conv.inner = untag_ptr(this_ptr);
59855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59857         this_ptr_conv.is_owned = false;
59858         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
59859         return ret_conv;
59860 }
59861
59862 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_proportional_millionths"))) TS_BlindedPayInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
59863         LDKBlindedPayInfo this_ptr_conv;
59864         this_ptr_conv.inner = untag_ptr(this_ptr);
59865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59867         this_ptr_conv.is_owned = false;
59868         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
59869 }
59870
59871 int16_t  __attribute__((export_name("TS_BlindedPayInfo_get_cltv_expiry_delta"))) TS_BlindedPayInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
59872         LDKBlindedPayInfo this_ptr_conv;
59873         this_ptr_conv.inner = untag_ptr(this_ptr);
59874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59876         this_ptr_conv.is_owned = false;
59877         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
59878         return ret_conv;
59879 }
59880
59881 void  __attribute__((export_name("TS_BlindedPayInfo_set_cltv_expiry_delta"))) TS_BlindedPayInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
59882         LDKBlindedPayInfo this_ptr_conv;
59883         this_ptr_conv.inner = untag_ptr(this_ptr);
59884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59886         this_ptr_conv.is_owned = false;
59887         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
59888 }
59889
59890 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_minimum_msat"))) TS_BlindedPayInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
59891         LDKBlindedPayInfo this_ptr_conv;
59892         this_ptr_conv.inner = untag_ptr(this_ptr);
59893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59895         this_ptr_conv.is_owned = false;
59896         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
59897         return ret_conv;
59898 }
59899
59900 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_minimum_msat"))) TS_BlindedPayInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
59901         LDKBlindedPayInfo this_ptr_conv;
59902         this_ptr_conv.inner = untag_ptr(this_ptr);
59903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59905         this_ptr_conv.is_owned = false;
59906         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
59907 }
59908
59909 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_maximum_msat"))) TS_BlindedPayInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
59910         LDKBlindedPayInfo this_ptr_conv;
59911         this_ptr_conv.inner = untag_ptr(this_ptr);
59912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59914         this_ptr_conv.is_owned = false;
59915         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
59916         return ret_conv;
59917 }
59918
59919 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_maximum_msat"))) TS_BlindedPayInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
59920         LDKBlindedPayInfo this_ptr_conv;
59921         this_ptr_conv.inner = untag_ptr(this_ptr);
59922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59924         this_ptr_conv.is_owned = false;
59925         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
59926 }
59927
59928 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_get_features"))) TS_BlindedPayInfo_get_features(uint64_t this_ptr) {
59929         LDKBlindedPayInfo this_ptr_conv;
59930         this_ptr_conv.inner = untag_ptr(this_ptr);
59931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59933         this_ptr_conv.is_owned = false;
59934         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
59935         uint64_t ret_ref = 0;
59936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59938         return ret_ref;
59939 }
59940
59941 void  __attribute__((export_name("TS_BlindedPayInfo_set_features"))) TS_BlindedPayInfo_set_features(uint64_t this_ptr, uint64_t val) {
59942         LDKBlindedPayInfo this_ptr_conv;
59943         this_ptr_conv.inner = untag_ptr(this_ptr);
59944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59946         this_ptr_conv.is_owned = false;
59947         LDKBlindedHopFeatures val_conv;
59948         val_conv.inner = untag_ptr(val);
59949         val_conv.is_owned = ptr_is_owned(val);
59950         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59951         val_conv = BlindedHopFeatures_clone(&val_conv);
59952         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
59953 }
59954
59955 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) {
59956         LDKBlindedHopFeatures features_arg_conv;
59957         features_arg_conv.inner = untag_ptr(features_arg);
59958         features_arg_conv.is_owned = ptr_is_owned(features_arg);
59959         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
59960         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
59961         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);
59962         uint64_t ret_ref = 0;
59963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59965         return ret_ref;
59966 }
59967
59968 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
59969         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
59970         uint64_t ret_ref = 0;
59971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59973         return ret_ref;
59974 }
59975 int64_t  __attribute__((export_name("TS_BlindedPayInfo_clone_ptr"))) TS_BlindedPayInfo_clone_ptr(uint64_t arg) {
59976         LDKBlindedPayInfo arg_conv;
59977         arg_conv.inner = untag_ptr(arg);
59978         arg_conv.is_owned = ptr_is_owned(arg);
59979         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59980         arg_conv.is_owned = false;
59981         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
59982         return ret_conv;
59983 }
59984
59985 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_clone"))) TS_BlindedPayInfo_clone(uint64_t orig) {
59986         LDKBlindedPayInfo orig_conv;
59987         orig_conv.inner = untag_ptr(orig);
59988         orig_conv.is_owned = ptr_is_owned(orig);
59989         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59990         orig_conv.is_owned = false;
59991         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
59992         uint64_t ret_ref = 0;
59993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59995         return ret_ref;
59996 }
59997
59998 int64_t  __attribute__((export_name("TS_BlindedPayInfo_hash"))) TS_BlindedPayInfo_hash(uint64_t o) {
59999         LDKBlindedPayInfo o_conv;
60000         o_conv.inner = untag_ptr(o);
60001         o_conv.is_owned = ptr_is_owned(o);
60002         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60003         o_conv.is_owned = false;
60004         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
60005         return ret_conv;
60006 }
60007
60008 jboolean  __attribute__((export_name("TS_BlindedPayInfo_eq"))) TS_BlindedPayInfo_eq(uint64_t a, uint64_t b) {
60009         LDKBlindedPayInfo a_conv;
60010         a_conv.inner = untag_ptr(a);
60011         a_conv.is_owned = ptr_is_owned(a);
60012         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60013         a_conv.is_owned = false;
60014         LDKBlindedPayInfo b_conv;
60015         b_conv.inner = untag_ptr(b);
60016         b_conv.is_owned = ptr_is_owned(b);
60017         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60018         b_conv.is_owned = false;
60019         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
60020         return ret_conv;
60021 }
60022
60023 int8_tArray  __attribute__((export_name("TS_BlindedPayInfo_write"))) TS_BlindedPayInfo_write(uint64_t obj) {
60024         LDKBlindedPayInfo obj_conv;
60025         obj_conv.inner = untag_ptr(obj);
60026         obj_conv.is_owned = ptr_is_owned(obj);
60027         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60028         obj_conv.is_owned = false;
60029         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
60030         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60031         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60032         CVec_u8Z_free(ret_var);
60033         return ret_arr;
60034 }
60035
60036 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_read"))) TS_BlindedPayInfo_read(int8_tArray ser) {
60037         LDKu8slice ser_ref;
60038         ser_ref.datalen = ser->arr_len;
60039         ser_ref.data = ser->elems;
60040         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
60041         *ret_conv = BlindedPayInfo_read(ser_ref);
60042         FREE(ser);
60043         return tag_ptr(ret_conv, true);
60044 }
60045
60046 void  __attribute__((export_name("TS_InvoiceError_free"))) TS_InvoiceError_free(uint64_t this_obj) {
60047         LDKInvoiceError this_obj_conv;
60048         this_obj_conv.inner = untag_ptr(this_obj);
60049         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60051         InvoiceError_free(this_obj_conv);
60052 }
60053
60054 uint64_t  __attribute__((export_name("TS_InvoiceError_get_erroneous_field"))) TS_InvoiceError_get_erroneous_field(uint64_t this_ptr) {
60055         LDKInvoiceError this_ptr_conv;
60056         this_ptr_conv.inner = untag_ptr(this_ptr);
60057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60059         this_ptr_conv.is_owned = false;
60060         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
60061         uint64_t ret_ref = 0;
60062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60064         return ret_ref;
60065 }
60066
60067 void  __attribute__((export_name("TS_InvoiceError_set_erroneous_field"))) TS_InvoiceError_set_erroneous_field(uint64_t this_ptr, uint64_t val) {
60068         LDKInvoiceError this_ptr_conv;
60069         this_ptr_conv.inner = untag_ptr(this_ptr);
60070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60072         this_ptr_conv.is_owned = false;
60073         LDKErroneousField val_conv;
60074         val_conv.inner = untag_ptr(val);
60075         val_conv.is_owned = ptr_is_owned(val);
60076         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60077         val_conv = ErroneousField_clone(&val_conv);
60078         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
60079 }
60080
60081 uint64_t  __attribute__((export_name("TS_InvoiceError_get_message"))) TS_InvoiceError_get_message(uint64_t this_ptr) {
60082         LDKInvoiceError this_ptr_conv;
60083         this_ptr_conv.inner = untag_ptr(this_ptr);
60084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60086         this_ptr_conv.is_owned = false;
60087         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
60088         uint64_t ret_ref = 0;
60089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60091         return ret_ref;
60092 }
60093
60094 void  __attribute__((export_name("TS_InvoiceError_set_message"))) TS_InvoiceError_set_message(uint64_t this_ptr, uint64_t val) {
60095         LDKInvoiceError this_ptr_conv;
60096         this_ptr_conv.inner = untag_ptr(this_ptr);
60097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60099         this_ptr_conv.is_owned = false;
60100         LDKUntrustedString val_conv;
60101         val_conv.inner = untag_ptr(val);
60102         val_conv.is_owned = ptr_is_owned(val);
60103         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60104         val_conv = UntrustedString_clone(&val_conv);
60105         InvoiceError_set_message(&this_ptr_conv, val_conv);
60106 }
60107
60108 uint64_t  __attribute__((export_name("TS_InvoiceError_new"))) TS_InvoiceError_new(uint64_t erroneous_field_arg, uint64_t message_arg) {
60109         LDKErroneousField erroneous_field_arg_conv;
60110         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
60111         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
60112         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
60113         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
60114         LDKUntrustedString message_arg_conv;
60115         message_arg_conv.inner = untag_ptr(message_arg);
60116         message_arg_conv.is_owned = ptr_is_owned(message_arg);
60117         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
60118         message_arg_conv = UntrustedString_clone(&message_arg_conv);
60119         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
60120         uint64_t ret_ref = 0;
60121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60123         return ret_ref;
60124 }
60125
60126 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
60127         LDKInvoiceError ret_var = InvoiceError_clone(arg);
60128         uint64_t ret_ref = 0;
60129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60131         return ret_ref;
60132 }
60133 int64_t  __attribute__((export_name("TS_InvoiceError_clone_ptr"))) TS_InvoiceError_clone_ptr(uint64_t arg) {
60134         LDKInvoiceError arg_conv;
60135         arg_conv.inner = untag_ptr(arg);
60136         arg_conv.is_owned = ptr_is_owned(arg);
60137         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60138         arg_conv.is_owned = false;
60139         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
60140         return ret_conv;
60141 }
60142
60143 uint64_t  __attribute__((export_name("TS_InvoiceError_clone"))) TS_InvoiceError_clone(uint64_t orig) {
60144         LDKInvoiceError orig_conv;
60145         orig_conv.inner = untag_ptr(orig);
60146         orig_conv.is_owned = ptr_is_owned(orig);
60147         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60148         orig_conv.is_owned = false;
60149         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
60150         uint64_t ret_ref = 0;
60151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60153         return ret_ref;
60154 }
60155
60156 void  __attribute__((export_name("TS_ErroneousField_free"))) TS_ErroneousField_free(uint64_t this_obj) {
60157         LDKErroneousField this_obj_conv;
60158         this_obj_conv.inner = untag_ptr(this_obj);
60159         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60161         ErroneousField_free(this_obj_conv);
60162 }
60163
60164 int64_t  __attribute__((export_name("TS_ErroneousField_get_tlv_fieldnum"))) TS_ErroneousField_get_tlv_fieldnum(uint64_t this_ptr) {
60165         LDKErroneousField this_ptr_conv;
60166         this_ptr_conv.inner = untag_ptr(this_ptr);
60167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60169         this_ptr_conv.is_owned = false;
60170         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
60171         return ret_conv;
60172 }
60173
60174 void  __attribute__((export_name("TS_ErroneousField_set_tlv_fieldnum"))) TS_ErroneousField_set_tlv_fieldnum(uint64_t this_ptr, int64_t val) {
60175         LDKErroneousField this_ptr_conv;
60176         this_ptr_conv.inner = untag_ptr(this_ptr);
60177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60179         this_ptr_conv.is_owned = false;
60180         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
60181 }
60182
60183 uint64_t  __attribute__((export_name("TS_ErroneousField_get_suggested_value"))) TS_ErroneousField_get_suggested_value(uint64_t this_ptr) {
60184         LDKErroneousField this_ptr_conv;
60185         this_ptr_conv.inner = untag_ptr(this_ptr);
60186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60188         this_ptr_conv.is_owned = false;
60189         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60190         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
60191         uint64_t ret_ref = tag_ptr(ret_copy, true);
60192         return ret_ref;
60193 }
60194
60195 void  __attribute__((export_name("TS_ErroneousField_set_suggested_value"))) TS_ErroneousField_set_suggested_value(uint64_t this_ptr, uint64_t val) {
60196         LDKErroneousField this_ptr_conv;
60197         this_ptr_conv.inner = untag_ptr(this_ptr);
60198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60200         this_ptr_conv.is_owned = false;
60201         void* val_ptr = untag_ptr(val);
60202         CHECK_ACCESS(val_ptr);
60203         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
60204         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
60205         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
60206 }
60207
60208 uint64_t  __attribute__((export_name("TS_ErroneousField_new"))) TS_ErroneousField_new(int64_t tlv_fieldnum_arg, uint64_t suggested_value_arg) {
60209         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
60210         CHECK_ACCESS(suggested_value_arg_ptr);
60211         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
60212         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
60213         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
60214         uint64_t ret_ref = 0;
60215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60217         return ret_ref;
60218 }
60219
60220 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
60221         LDKErroneousField ret_var = ErroneousField_clone(arg);
60222         uint64_t ret_ref = 0;
60223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60225         return ret_ref;
60226 }
60227 int64_t  __attribute__((export_name("TS_ErroneousField_clone_ptr"))) TS_ErroneousField_clone_ptr(uint64_t arg) {
60228         LDKErroneousField arg_conv;
60229         arg_conv.inner = untag_ptr(arg);
60230         arg_conv.is_owned = ptr_is_owned(arg);
60231         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60232         arg_conv.is_owned = false;
60233         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
60234         return ret_conv;
60235 }
60236
60237 uint64_t  __attribute__((export_name("TS_ErroneousField_clone"))) TS_ErroneousField_clone(uint64_t orig) {
60238         LDKErroneousField orig_conv;
60239         orig_conv.inner = untag_ptr(orig);
60240         orig_conv.is_owned = ptr_is_owned(orig);
60241         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60242         orig_conv.is_owned = false;
60243         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
60244         uint64_t ret_ref = 0;
60245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60247         return ret_ref;
60248 }
60249
60250 uint64_t  __attribute__((export_name("TS_InvoiceError_from_string"))) TS_InvoiceError_from_string(jstring s) {
60251         LDKStr s_conv = str_ref_to_owned_c(s);
60252         LDKInvoiceError ret_var = InvoiceError_from_string(s_conv);
60253         uint64_t ret_ref = 0;
60254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60256         return ret_ref;
60257 }
60258
60259 int8_tArray  __attribute__((export_name("TS_InvoiceError_write"))) TS_InvoiceError_write(uint64_t obj) {
60260         LDKInvoiceError obj_conv;
60261         obj_conv.inner = untag_ptr(obj);
60262         obj_conv.is_owned = ptr_is_owned(obj);
60263         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60264         obj_conv.is_owned = false;
60265         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
60266         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60267         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60268         CVec_u8Z_free(ret_var);
60269         return ret_arr;
60270 }
60271
60272 uint64_t  __attribute__((export_name("TS_InvoiceError_read"))) TS_InvoiceError_read(int8_tArray ser) {
60273         LDKu8slice ser_ref;
60274         ser_ref.datalen = ser->arr_len;
60275         ser_ref.data = ser->elems;
60276         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
60277         *ret_conv = InvoiceError_read(ser_ref);
60278         FREE(ser);
60279         return tag_ptr(ret_conv, true);
60280 }
60281
60282 void  __attribute__((export_name("TS_UnsignedInvoiceRequest_free"))) TS_UnsignedInvoiceRequest_free(uint64_t this_obj) {
60283         LDKUnsignedInvoiceRequest this_obj_conv;
60284         this_obj_conv.inner = untag_ptr(this_obj);
60285         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60287         UnsignedInvoiceRequest_free(this_obj_conv);
60288 }
60289
60290 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_tagged_hash"))) TS_UnsignedInvoiceRequest_tagged_hash(uint64_t this_arg) {
60291         LDKUnsignedInvoiceRequest this_arg_conv;
60292         this_arg_conv.inner = untag_ptr(this_arg);
60293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60295         this_arg_conv.is_owned = false;
60296         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
60297         uint64_t ret_ref = 0;
60298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60300         return ret_ref;
60301 }
60302
60303 void  __attribute__((export_name("TS_InvoiceRequest_free"))) TS_InvoiceRequest_free(uint64_t this_obj) {
60304         LDKInvoiceRequest this_obj_conv;
60305         this_obj_conv.inner = untag_ptr(this_obj);
60306         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60308         InvoiceRequest_free(this_obj_conv);
60309 }
60310
60311 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
60312         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
60313         uint64_t ret_ref = 0;
60314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60316         return ret_ref;
60317 }
60318 int64_t  __attribute__((export_name("TS_InvoiceRequest_clone_ptr"))) TS_InvoiceRequest_clone_ptr(uint64_t arg) {
60319         LDKInvoiceRequest arg_conv;
60320         arg_conv.inner = untag_ptr(arg);
60321         arg_conv.is_owned = ptr_is_owned(arg);
60322         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60323         arg_conv.is_owned = false;
60324         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
60325         return ret_conv;
60326 }
60327
60328 uint64_t  __attribute__((export_name("TS_InvoiceRequest_clone"))) TS_InvoiceRequest_clone(uint64_t orig) {
60329         LDKInvoiceRequest orig_conv;
60330         orig_conv.inner = untag_ptr(orig);
60331         orig_conv.is_owned = ptr_is_owned(orig);
60332         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60333         orig_conv.is_owned = false;
60334         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
60335         uint64_t ret_ref = 0;
60336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60338         return ret_ref;
60339 }
60340
60341 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_free"))) TS_VerifiedInvoiceRequest_free(uint64_t this_obj) {
60342         LDKVerifiedInvoiceRequest this_obj_conv;
60343         this_obj_conv.inner = untag_ptr(this_obj);
60344         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60346         VerifiedInvoiceRequest_free(this_obj_conv);
60347 }
60348
60349 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_get_keys"))) TS_VerifiedInvoiceRequest_get_keys(uint64_t this_ptr) {
60350         LDKVerifiedInvoiceRequest this_ptr_conv;
60351         this_ptr_conv.inner = untag_ptr(this_ptr);
60352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60354         this_ptr_conv.is_owned = false;
60355         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
60356         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
60357         uint64_t ret_ref = tag_ptr(ret_copy, true);
60358         return ret_ref;
60359 }
60360
60361 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_set_keys"))) TS_VerifiedInvoiceRequest_set_keys(uint64_t this_ptr, uint64_t val) {
60362         LDKVerifiedInvoiceRequest this_ptr_conv;
60363         this_ptr_conv.inner = untag_ptr(this_ptr);
60364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60366         this_ptr_conv.is_owned = false;
60367         void* val_ptr = untag_ptr(val);
60368         CHECK_ACCESS(val_ptr);
60369         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
60370         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
60371         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
60372 }
60373
60374 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
60375         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
60376         uint64_t ret_ref = 0;
60377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60379         return ret_ref;
60380 }
60381 int64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_clone_ptr"))) TS_VerifiedInvoiceRequest_clone_ptr(uint64_t arg) {
60382         LDKVerifiedInvoiceRequest arg_conv;
60383         arg_conv.inner = untag_ptr(arg);
60384         arg_conv.is_owned = ptr_is_owned(arg);
60385         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60386         arg_conv.is_owned = false;
60387         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
60388         return ret_conv;
60389 }
60390
60391 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_clone"))) TS_VerifiedInvoiceRequest_clone(uint64_t orig) {
60392         LDKVerifiedInvoiceRequest orig_conv;
60393         orig_conv.inner = untag_ptr(orig);
60394         orig_conv.is_owned = ptr_is_owned(orig);
60395         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60396         orig_conv.is_owned = false;
60397         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
60398         uint64_t ret_ref = 0;
60399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60401         return ret_ref;
60402 }
60403
60404 ptrArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_chains"))) TS_UnsignedInvoiceRequest_chains(uint64_t this_arg) {
60405         LDKUnsignedInvoiceRequest this_arg_conv;
60406         this_arg_conv.inner = untag_ptr(this_arg);
60407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60409         this_arg_conv.is_owned = false;
60410         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
60411         ptrArray ret_arr = NULL;
60412         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
60413         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
60414         for (size_t m = 0; m < ret_var.datalen; m++) {
60415                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
60416                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
60417                 ret_arr_ptr[m] = ret_conv_12_arr;
60418         }
60419         
60420         FREE(ret_var.data);
60421         return ret_arr;
60422 }
60423
60424 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_metadata"))) TS_UnsignedInvoiceRequest_metadata(uint64_t this_arg) {
60425         LDKUnsignedInvoiceRequest this_arg_conv;
60426         this_arg_conv.inner = untag_ptr(this_arg);
60427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60429         this_arg_conv.is_owned = false;
60430         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60431         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
60432         uint64_t ret_ref = tag_ptr(ret_copy, true);
60433         return ret_ref;
60434 }
60435
60436 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_amount"))) TS_UnsignedInvoiceRequest_amount(uint64_t this_arg) {
60437         LDKUnsignedInvoiceRequest this_arg_conv;
60438         this_arg_conv.inner = untag_ptr(this_arg);
60439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60441         this_arg_conv.is_owned = false;
60442         LDKAmount ret_var = UnsignedInvoiceRequest_amount(&this_arg_conv);
60443         uint64_t ret_ref = 0;
60444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60446         return ret_ref;
60447 }
60448
60449 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_description"))) TS_UnsignedInvoiceRequest_description(uint64_t this_arg) {
60450         LDKUnsignedInvoiceRequest this_arg_conv;
60451         this_arg_conv.inner = untag_ptr(this_arg);
60452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60454         this_arg_conv.is_owned = false;
60455         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
60456         uint64_t ret_ref = 0;
60457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60459         return ret_ref;
60460 }
60461
60462 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_offer_features"))) TS_UnsignedInvoiceRequest_offer_features(uint64_t this_arg) {
60463         LDKUnsignedInvoiceRequest this_arg_conv;
60464         this_arg_conv.inner = untag_ptr(this_arg);
60465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60467         this_arg_conv.is_owned = false;
60468         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
60469         uint64_t ret_ref = 0;
60470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60472         return ret_ref;
60473 }
60474
60475 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_absolute_expiry"))) TS_UnsignedInvoiceRequest_absolute_expiry(uint64_t this_arg) {
60476         LDKUnsignedInvoiceRequest this_arg_conv;
60477         this_arg_conv.inner = untag_ptr(this_arg);
60478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60480         this_arg_conv.is_owned = false;
60481         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60482         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
60483         uint64_t ret_ref = tag_ptr(ret_copy, true);
60484         return ret_ref;
60485 }
60486
60487 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_issuer"))) TS_UnsignedInvoiceRequest_issuer(uint64_t this_arg) {
60488         LDKUnsignedInvoiceRequest this_arg_conv;
60489         this_arg_conv.inner = untag_ptr(this_arg);
60490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60492         this_arg_conv.is_owned = false;
60493         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
60494         uint64_t ret_ref = 0;
60495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60497         return ret_ref;
60498 }
60499
60500 uint64_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_paths"))) TS_UnsignedInvoiceRequest_paths(uint64_t this_arg) {
60501         LDKUnsignedInvoiceRequest this_arg_conv;
60502         this_arg_conv.inner = untag_ptr(this_arg);
60503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60505         this_arg_conv.is_owned = false;
60506         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
60507         uint64_tArray ret_arr = NULL;
60508         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
60509         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
60510         for (size_t n = 0; n < ret_var.datalen; n++) {
60511                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60512                 uint64_t ret_conv_13_ref = 0;
60513                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60514                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60515                 ret_arr_ptr[n] = ret_conv_13_ref;
60516         }
60517         
60518         FREE(ret_var.data);
60519         return ret_arr;
60520 }
60521
60522 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_supported_quantity"))) TS_UnsignedInvoiceRequest_supported_quantity(uint64_t this_arg) {
60523         LDKUnsignedInvoiceRequest this_arg_conv;
60524         this_arg_conv.inner = untag_ptr(this_arg);
60525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60527         this_arg_conv.is_owned = false;
60528         LDKQuantity ret_var = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
60529         uint64_t ret_ref = 0;
60530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60532         return ret_ref;
60533 }
60534
60535 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_signing_pubkey"))) TS_UnsignedInvoiceRequest_signing_pubkey(uint64_t this_arg) {
60536         LDKUnsignedInvoiceRequest this_arg_conv;
60537         this_arg_conv.inner = untag_ptr(this_arg);
60538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60540         this_arg_conv.is_owned = false;
60541         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60542         memcpy(ret_arr->elems, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
60543         return ret_arr;
60544 }
60545
60546 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_metadata"))) TS_UnsignedInvoiceRequest_payer_metadata(uint64_t this_arg) {
60547         LDKUnsignedInvoiceRequest this_arg_conv;
60548         this_arg_conv.inner = untag_ptr(this_arg);
60549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60551         this_arg_conv.is_owned = false;
60552         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
60553         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60554         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60555         return ret_arr;
60556 }
60557
60558 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_chain"))) TS_UnsignedInvoiceRequest_chain(uint64_t this_arg) {
60559         LDKUnsignedInvoiceRequest this_arg_conv;
60560         this_arg_conv.inner = untag_ptr(this_arg);
60561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60563         this_arg_conv.is_owned = false;
60564         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
60565         memcpy(ret_arr->elems, UnsignedInvoiceRequest_chain(&this_arg_conv).data, 32);
60566         return ret_arr;
60567 }
60568
60569 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_amount_msats"))) TS_UnsignedInvoiceRequest_amount_msats(uint64_t this_arg) {
60570         LDKUnsignedInvoiceRequest this_arg_conv;
60571         this_arg_conv.inner = untag_ptr(this_arg);
60572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60574         this_arg_conv.is_owned = false;
60575         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60576         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
60577         uint64_t ret_ref = tag_ptr(ret_copy, true);
60578         return ret_ref;
60579 }
60580
60581 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_invoice_request_features"))) TS_UnsignedInvoiceRequest_invoice_request_features(uint64_t this_arg) {
60582         LDKUnsignedInvoiceRequest this_arg_conv;
60583         this_arg_conv.inner = untag_ptr(this_arg);
60584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60586         this_arg_conv.is_owned = false;
60587         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
60588         uint64_t ret_ref = 0;
60589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60591         return ret_ref;
60592 }
60593
60594 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_quantity"))) TS_UnsignedInvoiceRequest_quantity(uint64_t this_arg) {
60595         LDKUnsignedInvoiceRequest this_arg_conv;
60596         this_arg_conv.inner = untag_ptr(this_arg);
60597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60599         this_arg_conv.is_owned = false;
60600         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60601         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
60602         uint64_t ret_ref = tag_ptr(ret_copy, true);
60603         return ret_ref;
60604 }
60605
60606 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_id"))) TS_UnsignedInvoiceRequest_payer_id(uint64_t this_arg) {
60607         LDKUnsignedInvoiceRequest this_arg_conv;
60608         this_arg_conv.inner = untag_ptr(this_arg);
60609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60611         this_arg_conv.is_owned = false;
60612         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60613         memcpy(ret_arr->elems, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
60614         return ret_arr;
60615 }
60616
60617 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_note"))) TS_UnsignedInvoiceRequest_payer_note(uint64_t this_arg) {
60618         LDKUnsignedInvoiceRequest this_arg_conv;
60619         this_arg_conv.inner = untag_ptr(this_arg);
60620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60622         this_arg_conv.is_owned = false;
60623         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
60624         uint64_t ret_ref = 0;
60625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60627         return ret_ref;
60628 }
60629
60630 ptrArray  __attribute__((export_name("TS_InvoiceRequest_chains"))) TS_InvoiceRequest_chains(uint64_t this_arg) {
60631         LDKInvoiceRequest this_arg_conv;
60632         this_arg_conv.inner = untag_ptr(this_arg);
60633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60635         this_arg_conv.is_owned = false;
60636         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
60637         ptrArray ret_arr = NULL;
60638         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
60639         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
60640         for (size_t m = 0; m < ret_var.datalen; m++) {
60641                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
60642                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
60643                 ret_arr_ptr[m] = ret_conv_12_arr;
60644         }
60645         
60646         FREE(ret_var.data);
60647         return ret_arr;
60648 }
60649
60650 uint64_t  __attribute__((export_name("TS_InvoiceRequest_metadata"))) TS_InvoiceRequest_metadata(uint64_t this_arg) {
60651         LDKInvoiceRequest this_arg_conv;
60652         this_arg_conv.inner = untag_ptr(this_arg);
60653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60655         this_arg_conv.is_owned = false;
60656         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60657         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
60658         uint64_t ret_ref = tag_ptr(ret_copy, true);
60659         return ret_ref;
60660 }
60661
60662 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount"))) TS_InvoiceRequest_amount(uint64_t this_arg) {
60663         LDKInvoiceRequest this_arg_conv;
60664         this_arg_conv.inner = untag_ptr(this_arg);
60665         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60667         this_arg_conv.is_owned = false;
60668         LDKAmount ret_var = InvoiceRequest_amount(&this_arg_conv);
60669         uint64_t ret_ref = 0;
60670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60672         return ret_ref;
60673 }
60674
60675 uint64_t  __attribute__((export_name("TS_InvoiceRequest_description"))) TS_InvoiceRequest_description(uint64_t this_arg) {
60676         LDKInvoiceRequest this_arg_conv;
60677         this_arg_conv.inner = untag_ptr(this_arg);
60678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60680         this_arg_conv.is_owned = false;
60681         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
60682         uint64_t ret_ref = 0;
60683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60685         return ret_ref;
60686 }
60687
60688 uint64_t  __attribute__((export_name("TS_InvoiceRequest_offer_features"))) TS_InvoiceRequest_offer_features(uint64_t this_arg) {
60689         LDKInvoiceRequest this_arg_conv;
60690         this_arg_conv.inner = untag_ptr(this_arg);
60691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60693         this_arg_conv.is_owned = false;
60694         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
60695         uint64_t ret_ref = 0;
60696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60698         return ret_ref;
60699 }
60700
60701 uint64_t  __attribute__((export_name("TS_InvoiceRequest_absolute_expiry"))) TS_InvoiceRequest_absolute_expiry(uint64_t this_arg) {
60702         LDKInvoiceRequest this_arg_conv;
60703         this_arg_conv.inner = untag_ptr(this_arg);
60704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60706         this_arg_conv.is_owned = false;
60707         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60708         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
60709         uint64_t ret_ref = tag_ptr(ret_copy, true);
60710         return ret_ref;
60711 }
60712
60713 uint64_t  __attribute__((export_name("TS_InvoiceRequest_issuer"))) TS_InvoiceRequest_issuer(uint64_t this_arg) {
60714         LDKInvoiceRequest this_arg_conv;
60715         this_arg_conv.inner = untag_ptr(this_arg);
60716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60718         this_arg_conv.is_owned = false;
60719         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
60720         uint64_t ret_ref = 0;
60721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60723         return ret_ref;
60724 }
60725
60726 uint64_tArray  __attribute__((export_name("TS_InvoiceRequest_paths"))) TS_InvoiceRequest_paths(uint64_t this_arg) {
60727         LDKInvoiceRequest this_arg_conv;
60728         this_arg_conv.inner = untag_ptr(this_arg);
60729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60731         this_arg_conv.is_owned = false;
60732         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
60733         uint64_tArray ret_arr = NULL;
60734         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
60735         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
60736         for (size_t n = 0; n < ret_var.datalen; n++) {
60737                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60738                 uint64_t ret_conv_13_ref = 0;
60739                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60740                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60741                 ret_arr_ptr[n] = ret_conv_13_ref;
60742         }
60743         
60744         FREE(ret_var.data);
60745         return ret_arr;
60746 }
60747
60748 uint64_t  __attribute__((export_name("TS_InvoiceRequest_supported_quantity"))) TS_InvoiceRequest_supported_quantity(uint64_t this_arg) {
60749         LDKInvoiceRequest this_arg_conv;
60750         this_arg_conv.inner = untag_ptr(this_arg);
60751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60753         this_arg_conv.is_owned = false;
60754         LDKQuantity ret_var = InvoiceRequest_supported_quantity(&this_arg_conv);
60755         uint64_t ret_ref = 0;
60756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60758         return ret_ref;
60759 }
60760
60761 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_signing_pubkey"))) TS_InvoiceRequest_signing_pubkey(uint64_t this_arg) {
60762         LDKInvoiceRequest this_arg_conv;
60763         this_arg_conv.inner = untag_ptr(this_arg);
60764         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60766         this_arg_conv.is_owned = false;
60767         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60768         memcpy(ret_arr->elems, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
60769         return ret_arr;
60770 }
60771
60772 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_metadata"))) TS_InvoiceRequest_payer_metadata(uint64_t this_arg) {
60773         LDKInvoiceRequest this_arg_conv;
60774         this_arg_conv.inner = untag_ptr(this_arg);
60775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60777         this_arg_conv.is_owned = false;
60778         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
60779         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60780         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60781         return ret_arr;
60782 }
60783
60784 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_chain"))) TS_InvoiceRequest_chain(uint64_t this_arg) {
60785         LDKInvoiceRequest this_arg_conv;
60786         this_arg_conv.inner = untag_ptr(this_arg);
60787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60789         this_arg_conv.is_owned = false;
60790         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
60791         memcpy(ret_arr->elems, InvoiceRequest_chain(&this_arg_conv).data, 32);
60792         return ret_arr;
60793 }
60794
60795 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount_msats"))) TS_InvoiceRequest_amount_msats(uint64_t this_arg) {
60796         LDKInvoiceRequest this_arg_conv;
60797         this_arg_conv.inner = untag_ptr(this_arg);
60798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60800         this_arg_conv.is_owned = false;
60801         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60802         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
60803         uint64_t ret_ref = tag_ptr(ret_copy, true);
60804         return ret_ref;
60805 }
60806
60807 uint64_t  __attribute__((export_name("TS_InvoiceRequest_invoice_request_features"))) TS_InvoiceRequest_invoice_request_features(uint64_t this_arg) {
60808         LDKInvoiceRequest this_arg_conv;
60809         this_arg_conv.inner = untag_ptr(this_arg);
60810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60812         this_arg_conv.is_owned = false;
60813         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
60814         uint64_t ret_ref = 0;
60815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60817         return ret_ref;
60818 }
60819
60820 uint64_t  __attribute__((export_name("TS_InvoiceRequest_quantity"))) TS_InvoiceRequest_quantity(uint64_t this_arg) {
60821         LDKInvoiceRequest this_arg_conv;
60822         this_arg_conv.inner = untag_ptr(this_arg);
60823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60825         this_arg_conv.is_owned = false;
60826         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60827         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
60828         uint64_t ret_ref = tag_ptr(ret_copy, true);
60829         return ret_ref;
60830 }
60831
60832 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_id"))) TS_InvoiceRequest_payer_id(uint64_t this_arg) {
60833         LDKInvoiceRequest this_arg_conv;
60834         this_arg_conv.inner = untag_ptr(this_arg);
60835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60837         this_arg_conv.is_owned = false;
60838         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60839         memcpy(ret_arr->elems, InvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
60840         return ret_arr;
60841 }
60842
60843 uint64_t  __attribute__((export_name("TS_InvoiceRequest_payer_note"))) TS_InvoiceRequest_payer_note(uint64_t this_arg) {
60844         LDKInvoiceRequest this_arg_conv;
60845         this_arg_conv.inner = untag_ptr(this_arg);
60846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60848         this_arg_conv.is_owned = false;
60849         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
60850         uint64_t ret_ref = 0;
60851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60853         return ret_ref;
60854 }
60855
60856 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_signature"))) TS_InvoiceRequest_signature(uint64_t this_arg) {
60857         LDKInvoiceRequest this_arg_conv;
60858         this_arg_conv.inner = untag_ptr(this_arg);
60859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60861         this_arg_conv.is_owned = false;
60862         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
60863         memcpy(ret_arr->elems, InvoiceRequest_signature(&this_arg_conv).compact_form, 64);
60864         return ret_arr;
60865 }
60866
60867 uint64_t  __attribute__((export_name("TS_InvoiceRequest_verify"))) TS_InvoiceRequest_verify(uint64_t this_arg, uint64_t key) {
60868         LDKInvoiceRequest this_arg_conv;
60869         this_arg_conv.inner = untag_ptr(this_arg);
60870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60872         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
60873         LDKExpandedKey key_conv;
60874         key_conv.inner = untag_ptr(key);
60875         key_conv.is_owned = ptr_is_owned(key);
60876         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
60877         key_conv.is_owned = false;
60878         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
60879         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
60880         return tag_ptr(ret_conv, true);
60881 }
60882
60883 ptrArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_chains"))) TS_VerifiedInvoiceRequest_chains(uint64_t this_arg) {
60884         LDKVerifiedInvoiceRequest this_arg_conv;
60885         this_arg_conv.inner = untag_ptr(this_arg);
60886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60888         this_arg_conv.is_owned = false;
60889         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
60890         ptrArray ret_arr = NULL;
60891         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
60892         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
60893         for (size_t m = 0; m < ret_var.datalen; m++) {
60894                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
60895                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
60896                 ret_arr_ptr[m] = ret_conv_12_arr;
60897         }
60898         
60899         FREE(ret_var.data);
60900         return ret_arr;
60901 }
60902
60903 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_metadata"))) TS_VerifiedInvoiceRequest_metadata(uint64_t this_arg) {
60904         LDKVerifiedInvoiceRequest this_arg_conv;
60905         this_arg_conv.inner = untag_ptr(this_arg);
60906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60908         this_arg_conv.is_owned = false;
60909         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60910         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
60911         uint64_t ret_ref = tag_ptr(ret_copy, true);
60912         return ret_ref;
60913 }
60914
60915 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_amount"))) TS_VerifiedInvoiceRequest_amount(uint64_t this_arg) {
60916         LDKVerifiedInvoiceRequest this_arg_conv;
60917         this_arg_conv.inner = untag_ptr(this_arg);
60918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60920         this_arg_conv.is_owned = false;
60921         LDKAmount ret_var = VerifiedInvoiceRequest_amount(&this_arg_conv);
60922         uint64_t ret_ref = 0;
60923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60925         return ret_ref;
60926 }
60927
60928 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_description"))) TS_VerifiedInvoiceRequest_description(uint64_t this_arg) {
60929         LDKVerifiedInvoiceRequest this_arg_conv;
60930         this_arg_conv.inner = untag_ptr(this_arg);
60931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60933         this_arg_conv.is_owned = false;
60934         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
60935         uint64_t ret_ref = 0;
60936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60938         return ret_ref;
60939 }
60940
60941 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_offer_features"))) TS_VerifiedInvoiceRequest_offer_features(uint64_t this_arg) {
60942         LDKVerifiedInvoiceRequest this_arg_conv;
60943         this_arg_conv.inner = untag_ptr(this_arg);
60944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60946         this_arg_conv.is_owned = false;
60947         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
60948         uint64_t ret_ref = 0;
60949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60951         return ret_ref;
60952 }
60953
60954 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_absolute_expiry"))) TS_VerifiedInvoiceRequest_absolute_expiry(uint64_t this_arg) {
60955         LDKVerifiedInvoiceRequest this_arg_conv;
60956         this_arg_conv.inner = untag_ptr(this_arg);
60957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60959         this_arg_conv.is_owned = false;
60960         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60961         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
60962         uint64_t ret_ref = tag_ptr(ret_copy, true);
60963         return ret_ref;
60964 }
60965
60966 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_issuer"))) TS_VerifiedInvoiceRequest_issuer(uint64_t this_arg) {
60967         LDKVerifiedInvoiceRequest this_arg_conv;
60968         this_arg_conv.inner = untag_ptr(this_arg);
60969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60971         this_arg_conv.is_owned = false;
60972         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
60973         uint64_t ret_ref = 0;
60974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60976         return ret_ref;
60977 }
60978
60979 uint64_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_paths"))) TS_VerifiedInvoiceRequest_paths(uint64_t this_arg) {
60980         LDKVerifiedInvoiceRequest this_arg_conv;
60981         this_arg_conv.inner = untag_ptr(this_arg);
60982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60984         this_arg_conv.is_owned = false;
60985         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
60986         uint64_tArray ret_arr = NULL;
60987         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
60988         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
60989         for (size_t n = 0; n < ret_var.datalen; n++) {
60990                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60991                 uint64_t ret_conv_13_ref = 0;
60992                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60993                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60994                 ret_arr_ptr[n] = ret_conv_13_ref;
60995         }
60996         
60997         FREE(ret_var.data);
60998         return ret_arr;
60999 }
61000
61001 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_supported_quantity"))) TS_VerifiedInvoiceRequest_supported_quantity(uint64_t this_arg) {
61002         LDKVerifiedInvoiceRequest this_arg_conv;
61003         this_arg_conv.inner = untag_ptr(this_arg);
61004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61006         this_arg_conv.is_owned = false;
61007         LDKQuantity ret_var = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
61008         uint64_t ret_ref = 0;
61009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61011         return ret_ref;
61012 }
61013
61014 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_signing_pubkey"))) TS_VerifiedInvoiceRequest_signing_pubkey(uint64_t this_arg) {
61015         LDKVerifiedInvoiceRequest this_arg_conv;
61016         this_arg_conv.inner = untag_ptr(this_arg);
61017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61019         this_arg_conv.is_owned = false;
61020         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61021         memcpy(ret_arr->elems, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
61022         return ret_arr;
61023 }
61024
61025 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_metadata"))) TS_VerifiedInvoiceRequest_payer_metadata(uint64_t this_arg) {
61026         LDKVerifiedInvoiceRequest this_arg_conv;
61027         this_arg_conv.inner = untag_ptr(this_arg);
61028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61030         this_arg_conv.is_owned = false;
61031         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
61032         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61033         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61034         return ret_arr;
61035 }
61036
61037 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_chain"))) TS_VerifiedInvoiceRequest_chain(uint64_t this_arg) {
61038         LDKVerifiedInvoiceRequest this_arg_conv;
61039         this_arg_conv.inner = untag_ptr(this_arg);
61040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61042         this_arg_conv.is_owned = false;
61043         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61044         memcpy(ret_arr->elems, VerifiedInvoiceRequest_chain(&this_arg_conv).data, 32);
61045         return ret_arr;
61046 }
61047
61048 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_amount_msats"))) TS_VerifiedInvoiceRequest_amount_msats(uint64_t this_arg) {
61049         LDKVerifiedInvoiceRequest this_arg_conv;
61050         this_arg_conv.inner = untag_ptr(this_arg);
61051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61053         this_arg_conv.is_owned = false;
61054         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61055         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
61056         uint64_t ret_ref = tag_ptr(ret_copy, true);
61057         return ret_ref;
61058 }
61059
61060 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_invoice_request_features"))) TS_VerifiedInvoiceRequest_invoice_request_features(uint64_t this_arg) {
61061         LDKVerifiedInvoiceRequest this_arg_conv;
61062         this_arg_conv.inner = untag_ptr(this_arg);
61063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61065         this_arg_conv.is_owned = false;
61066         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
61067         uint64_t ret_ref = 0;
61068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61070         return ret_ref;
61071 }
61072
61073 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_quantity"))) TS_VerifiedInvoiceRequest_quantity(uint64_t this_arg) {
61074         LDKVerifiedInvoiceRequest this_arg_conv;
61075         this_arg_conv.inner = untag_ptr(this_arg);
61076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61078         this_arg_conv.is_owned = false;
61079         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61080         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
61081         uint64_t ret_ref = tag_ptr(ret_copy, true);
61082         return ret_ref;
61083 }
61084
61085 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_id"))) TS_VerifiedInvoiceRequest_payer_id(uint64_t this_arg) {
61086         LDKVerifiedInvoiceRequest this_arg_conv;
61087         this_arg_conv.inner = untag_ptr(this_arg);
61088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61090         this_arg_conv.is_owned = false;
61091         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61092         memcpy(ret_arr->elems, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
61093         return ret_arr;
61094 }
61095
61096 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_note"))) TS_VerifiedInvoiceRequest_payer_note(uint64_t this_arg) {
61097         LDKVerifiedInvoiceRequest this_arg_conv;
61098         this_arg_conv.inner = untag_ptr(this_arg);
61099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61101         this_arg_conv.is_owned = false;
61102         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
61103         uint64_t ret_ref = 0;
61104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61106         return ret_ref;
61107 }
61108
61109 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_write"))) TS_UnsignedInvoiceRequest_write(uint64_t obj) {
61110         LDKUnsignedInvoiceRequest obj_conv;
61111         obj_conv.inner = untag_ptr(obj);
61112         obj_conv.is_owned = ptr_is_owned(obj);
61113         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61114         obj_conv.is_owned = false;
61115         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
61116         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61117         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61118         CVec_u8Z_free(ret_var);
61119         return ret_arr;
61120 }
61121
61122 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_write"))) TS_InvoiceRequest_write(uint64_t obj) {
61123         LDKInvoiceRequest obj_conv;
61124         obj_conv.inner = untag_ptr(obj);
61125         obj_conv.is_owned = ptr_is_owned(obj);
61126         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61127         obj_conv.is_owned = false;
61128         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
61129         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61130         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61131         CVec_u8Z_free(ret_var);
61132         return ret_arr;
61133 }
61134
61135 void  __attribute__((export_name("TS_TaggedHash_free"))) TS_TaggedHash_free(uint64_t this_obj) {
61136         LDKTaggedHash this_obj_conv;
61137         this_obj_conv.inner = untag_ptr(this_obj);
61138         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61140         TaggedHash_free(this_obj_conv);
61141 }
61142
61143 static inline uint64_t TaggedHash_clone_ptr(LDKTaggedHash *NONNULL_PTR arg) {
61144         LDKTaggedHash ret_var = TaggedHash_clone(arg);
61145         uint64_t ret_ref = 0;
61146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61148         return ret_ref;
61149 }
61150 int64_t  __attribute__((export_name("TS_TaggedHash_clone_ptr"))) TS_TaggedHash_clone_ptr(uint64_t arg) {
61151         LDKTaggedHash arg_conv;
61152         arg_conv.inner = untag_ptr(arg);
61153         arg_conv.is_owned = ptr_is_owned(arg);
61154         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61155         arg_conv.is_owned = false;
61156         int64_t ret_conv = TaggedHash_clone_ptr(&arg_conv);
61157         return ret_conv;
61158 }
61159
61160 uint64_t  __attribute__((export_name("TS_TaggedHash_clone"))) TS_TaggedHash_clone(uint64_t orig) {
61161         LDKTaggedHash orig_conv;
61162         orig_conv.inner = untag_ptr(orig);
61163         orig_conv.is_owned = ptr_is_owned(orig);
61164         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61165         orig_conv.is_owned = false;
61166         LDKTaggedHash ret_var = TaggedHash_clone(&orig_conv);
61167         uint64_t ret_ref = 0;
61168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61170         return ret_ref;
61171 }
61172
61173 int8_tArray  __attribute__((export_name("TS_TaggedHash_as_digest"))) TS_TaggedHash_as_digest(uint64_t this_arg) {
61174         LDKTaggedHash this_arg_conv;
61175         this_arg_conv.inner = untag_ptr(this_arg);
61176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61178         this_arg_conv.is_owned = false;
61179         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61180         memcpy(ret_arr->elems, *TaggedHash_as_digest(&this_arg_conv), 32);
61181         return ret_arr;
61182 }
61183
61184 jstring  __attribute__((export_name("TS_TaggedHash_tag"))) TS_TaggedHash_tag(uint64_t this_arg) {
61185         LDKTaggedHash this_arg_conv;
61186         this_arg_conv.inner = untag_ptr(this_arg);
61187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61189         this_arg_conv.is_owned = false;
61190         LDKStr ret_str = TaggedHash_tag(&this_arg_conv);
61191         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
61192         Str_free(ret_str);
61193         return ret_conv;
61194 }
61195
61196 int8_tArray  __attribute__((export_name("TS_TaggedHash_merkle_root"))) TS_TaggedHash_merkle_root(uint64_t this_arg) {
61197         LDKTaggedHash this_arg_conv;
61198         this_arg_conv.inner = untag_ptr(this_arg);
61199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61201         this_arg_conv.is_owned = false;
61202         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61203         memcpy(ret_arr->elems, TaggedHash_merkle_root(&this_arg_conv).data, 32);
61204         return ret_arr;
61205 }
61206
61207 void  __attribute__((export_name("TS_Bolt12ParseError_free"))) TS_Bolt12ParseError_free(uint64_t this_obj) {
61208         LDKBolt12ParseError this_obj_conv;
61209         this_obj_conv.inner = untag_ptr(this_obj);
61210         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61212         Bolt12ParseError_free(this_obj_conv);
61213 }
61214
61215 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
61216         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
61217         uint64_t ret_ref = 0;
61218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61220         return ret_ref;
61221 }
61222 int64_t  __attribute__((export_name("TS_Bolt12ParseError_clone_ptr"))) TS_Bolt12ParseError_clone_ptr(uint64_t arg) {
61223         LDKBolt12ParseError arg_conv;
61224         arg_conv.inner = untag_ptr(arg);
61225         arg_conv.is_owned = ptr_is_owned(arg);
61226         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61227         arg_conv.is_owned = false;
61228         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
61229         return ret_conv;
61230 }
61231
61232 uint64_t  __attribute__((export_name("TS_Bolt12ParseError_clone"))) TS_Bolt12ParseError_clone(uint64_t orig) {
61233         LDKBolt12ParseError orig_conv;
61234         orig_conv.inner = untag_ptr(orig);
61235         orig_conv.is_owned = ptr_is_owned(orig);
61236         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61237         orig_conv.is_owned = false;
61238         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
61239         uint64_t ret_ref = 0;
61240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61242         return ret_ref;
61243 }
61244
61245 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_clone"))) TS_Bolt12SemanticError_clone(uint64_t orig) {
61246         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
61247         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_clone(orig_conv));
61248         return ret_conv;
61249 }
61250
61251 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_already_expired"))) TS_Bolt12SemanticError_already_expired() {
61252         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_already_expired());
61253         return ret_conv;
61254 }
61255
61256 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_chain"))) TS_Bolt12SemanticError_unsupported_chain() {
61257         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_chain());
61258         return ret_conv;
61259 }
61260
61261 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_chain"))) TS_Bolt12SemanticError_unexpected_chain() {
61262         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_chain());
61263         return ret_conv;
61264 }
61265
61266 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_amount"))) TS_Bolt12SemanticError_missing_amount() {
61267         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_amount());
61268         return ret_conv;
61269 }
61270
61271 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_amount"))) TS_Bolt12SemanticError_invalid_amount() {
61272         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_amount());
61273         return ret_conv;
61274 }
61275
61276 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_insufficient_amount"))) TS_Bolt12SemanticError_insufficient_amount() {
61277         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_insufficient_amount());
61278         return ret_conv;
61279 }
61280
61281 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_amount"))) TS_Bolt12SemanticError_unexpected_amount() {
61282         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_amount());
61283         return ret_conv;
61284 }
61285
61286 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_currency"))) TS_Bolt12SemanticError_unsupported_currency() {
61287         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_currency());
61288         return ret_conv;
61289 }
61290
61291 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unknown_required_features"))) TS_Bolt12SemanticError_unknown_required_features() {
61292         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unknown_required_features());
61293         return ret_conv;
61294 }
61295
61296 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_features"))) TS_Bolt12SemanticError_unexpected_features() {
61297         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_features());
61298         return ret_conv;
61299 }
61300
61301 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_description"))) TS_Bolt12SemanticError_missing_description() {
61302         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_description());
61303         return ret_conv;
61304 }
61305
61306 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signing_pubkey"))) TS_Bolt12SemanticError_missing_signing_pubkey() {
61307         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signing_pubkey());
61308         return ret_conv;
61309 }
61310
61311 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_signing_pubkey"))) TS_Bolt12SemanticError_invalid_signing_pubkey() {
61312         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_signing_pubkey());
61313         return ret_conv;
61314 }
61315
61316 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_signing_pubkey"))) TS_Bolt12SemanticError_unexpected_signing_pubkey() {
61317         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_signing_pubkey());
61318         return ret_conv;
61319 }
61320
61321 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_quantity"))) TS_Bolt12SemanticError_missing_quantity() {
61322         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_quantity());
61323         return ret_conv;
61324 }
61325
61326 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_quantity"))) TS_Bolt12SemanticError_invalid_quantity() {
61327         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_quantity());
61328         return ret_conv;
61329 }
61330
61331 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_quantity"))) TS_Bolt12SemanticError_unexpected_quantity() {
61332         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_quantity());
61333         return ret_conv;
61334 }
61335
61336 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_metadata"))) TS_Bolt12SemanticError_invalid_metadata() {
61337         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_metadata());
61338         return ret_conv;
61339 }
61340
61341 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_metadata"))) TS_Bolt12SemanticError_unexpected_metadata() {
61342         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_metadata());
61343         return ret_conv;
61344 }
61345
61346 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_metadata"))) TS_Bolt12SemanticError_missing_payer_metadata() {
61347         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_metadata());
61348         return ret_conv;
61349 }
61350
61351 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_id"))) TS_Bolt12SemanticError_missing_payer_id() {
61352         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_id());
61353         return ret_conv;
61354 }
61355
61356 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_duplicate_payment_id"))) TS_Bolt12SemanticError_duplicate_payment_id() {
61357         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_duplicate_payment_id());
61358         return ret_conv;
61359 }
61360
61361 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_paths"))) TS_Bolt12SemanticError_missing_paths() {
61362         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_paths());
61363         return ret_conv;
61364 }
61365
61366 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_pay_info"))) TS_Bolt12SemanticError_invalid_pay_info() {
61367         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_pay_info());
61368         return ret_conv;
61369 }
61370
61371 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_creation_time"))) TS_Bolt12SemanticError_missing_creation_time() {
61372         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_creation_time());
61373         return ret_conv;
61374 }
61375
61376 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payment_hash"))) TS_Bolt12SemanticError_missing_payment_hash() {
61377         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payment_hash());
61378         return ret_conv;
61379 }
61380
61381 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signature"))) TS_Bolt12SemanticError_missing_signature() {
61382         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signature());
61383         return ret_conv;
61384 }
61385
61386 void  __attribute__((export_name("TS_Refund_free"))) TS_Refund_free(uint64_t this_obj) {
61387         LDKRefund this_obj_conv;
61388         this_obj_conv.inner = untag_ptr(this_obj);
61389         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61391         Refund_free(this_obj_conv);
61392 }
61393
61394 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
61395         LDKRefund ret_var = Refund_clone(arg);
61396         uint64_t ret_ref = 0;
61397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61399         return ret_ref;
61400 }
61401 int64_t  __attribute__((export_name("TS_Refund_clone_ptr"))) TS_Refund_clone_ptr(uint64_t arg) {
61402         LDKRefund arg_conv;
61403         arg_conv.inner = untag_ptr(arg);
61404         arg_conv.is_owned = ptr_is_owned(arg);
61405         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61406         arg_conv.is_owned = false;
61407         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
61408         return ret_conv;
61409 }
61410
61411 uint64_t  __attribute__((export_name("TS_Refund_clone"))) TS_Refund_clone(uint64_t orig) {
61412         LDKRefund orig_conv;
61413         orig_conv.inner = untag_ptr(orig);
61414         orig_conv.is_owned = ptr_is_owned(orig);
61415         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61416         orig_conv.is_owned = false;
61417         LDKRefund ret_var = Refund_clone(&orig_conv);
61418         uint64_t ret_ref = 0;
61419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61421         return ret_ref;
61422 }
61423
61424 uint64_t  __attribute__((export_name("TS_Refund_description"))) TS_Refund_description(uint64_t this_arg) {
61425         LDKRefund this_arg_conv;
61426         this_arg_conv.inner = untag_ptr(this_arg);
61427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61429         this_arg_conv.is_owned = false;
61430         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
61431         uint64_t ret_ref = 0;
61432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61434         return ret_ref;
61435 }
61436
61437 uint64_t  __attribute__((export_name("TS_Refund_absolute_expiry"))) TS_Refund_absolute_expiry(uint64_t this_arg) {
61438         LDKRefund this_arg_conv;
61439         this_arg_conv.inner = untag_ptr(this_arg);
61440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61442         this_arg_conv.is_owned = false;
61443         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61444         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
61445         uint64_t ret_ref = tag_ptr(ret_copy, true);
61446         return ret_ref;
61447 }
61448
61449 jboolean  __attribute__((export_name("TS_Refund_is_expired_no_std"))) TS_Refund_is_expired_no_std(uint64_t this_arg, int64_t duration_since_epoch) {
61450         LDKRefund this_arg_conv;
61451         this_arg_conv.inner = untag_ptr(this_arg);
61452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61454         this_arg_conv.is_owned = false;
61455         jboolean ret_conv = Refund_is_expired_no_std(&this_arg_conv, duration_since_epoch);
61456         return ret_conv;
61457 }
61458
61459 uint64_t  __attribute__((export_name("TS_Refund_issuer"))) TS_Refund_issuer(uint64_t this_arg) {
61460         LDKRefund this_arg_conv;
61461         this_arg_conv.inner = untag_ptr(this_arg);
61462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61464         this_arg_conv.is_owned = false;
61465         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
61466         uint64_t ret_ref = 0;
61467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61469         return ret_ref;
61470 }
61471
61472 uint64_tArray  __attribute__((export_name("TS_Refund_paths"))) TS_Refund_paths(uint64_t this_arg) {
61473         LDKRefund this_arg_conv;
61474         this_arg_conv.inner = untag_ptr(this_arg);
61475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61477         this_arg_conv.is_owned = false;
61478         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
61479         uint64_tArray ret_arr = NULL;
61480         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
61481         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
61482         for (size_t n = 0; n < ret_var.datalen; n++) {
61483                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
61484                 uint64_t ret_conv_13_ref = 0;
61485                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
61486                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
61487                 ret_arr_ptr[n] = ret_conv_13_ref;
61488         }
61489         
61490         FREE(ret_var.data);
61491         return ret_arr;
61492 }
61493
61494 int8_tArray  __attribute__((export_name("TS_Refund_payer_metadata"))) TS_Refund_payer_metadata(uint64_t this_arg) {
61495         LDKRefund this_arg_conv;
61496         this_arg_conv.inner = untag_ptr(this_arg);
61497         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61499         this_arg_conv.is_owned = false;
61500         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
61501         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61502         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61503         return ret_arr;
61504 }
61505
61506 int8_tArray  __attribute__((export_name("TS_Refund_chain"))) TS_Refund_chain(uint64_t this_arg) {
61507         LDKRefund this_arg_conv;
61508         this_arg_conv.inner = untag_ptr(this_arg);
61509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61511         this_arg_conv.is_owned = false;
61512         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61513         memcpy(ret_arr->elems, Refund_chain(&this_arg_conv).data, 32);
61514         return ret_arr;
61515 }
61516
61517 int64_t  __attribute__((export_name("TS_Refund_amount_msats"))) TS_Refund_amount_msats(uint64_t this_arg) {
61518         LDKRefund this_arg_conv;
61519         this_arg_conv.inner = untag_ptr(this_arg);
61520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61522         this_arg_conv.is_owned = false;
61523         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
61524         return ret_conv;
61525 }
61526
61527 uint64_t  __attribute__((export_name("TS_Refund_features"))) TS_Refund_features(uint64_t this_arg) {
61528         LDKRefund this_arg_conv;
61529         this_arg_conv.inner = untag_ptr(this_arg);
61530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61532         this_arg_conv.is_owned = false;
61533         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
61534         uint64_t ret_ref = 0;
61535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61537         return ret_ref;
61538 }
61539
61540 uint64_t  __attribute__((export_name("TS_Refund_quantity"))) TS_Refund_quantity(uint64_t this_arg) {
61541         LDKRefund this_arg_conv;
61542         this_arg_conv.inner = untag_ptr(this_arg);
61543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61545         this_arg_conv.is_owned = false;
61546         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61547         *ret_copy = Refund_quantity(&this_arg_conv);
61548         uint64_t ret_ref = tag_ptr(ret_copy, true);
61549         return ret_ref;
61550 }
61551
61552 int8_tArray  __attribute__((export_name("TS_Refund_payer_id"))) TS_Refund_payer_id(uint64_t this_arg) {
61553         LDKRefund this_arg_conv;
61554         this_arg_conv.inner = untag_ptr(this_arg);
61555         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61557         this_arg_conv.is_owned = false;
61558         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61559         memcpy(ret_arr->elems, Refund_payer_id(&this_arg_conv).compressed_form, 33);
61560         return ret_arr;
61561 }
61562
61563 uint64_t  __attribute__((export_name("TS_Refund_payer_note"))) TS_Refund_payer_note(uint64_t this_arg) {
61564         LDKRefund this_arg_conv;
61565         this_arg_conv.inner = untag_ptr(this_arg);
61566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61568         this_arg_conv.is_owned = false;
61569         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
61570         uint64_t ret_ref = 0;
61571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61573         return ret_ref;
61574 }
61575
61576 int8_tArray  __attribute__((export_name("TS_Refund_write"))) TS_Refund_write(uint64_t obj) {
61577         LDKRefund obj_conv;
61578         obj_conv.inner = untag_ptr(obj);
61579         obj_conv.is_owned = ptr_is_owned(obj);
61580         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61581         obj_conv.is_owned = false;
61582         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
61583         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61584         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61585         CVec_u8Z_free(ret_var);
61586         return ret_arr;
61587 }
61588
61589 uint64_t  __attribute__((export_name("TS_Refund_from_str"))) TS_Refund_from_str(jstring s) {
61590         LDKStr s_conv = str_ref_to_owned_c(s);
61591         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
61592         *ret_conv = Refund_from_str(s_conv);
61593         return tag_ptr(ret_conv, true);
61594 }
61595
61596 uint32_t  __attribute__((export_name("TS_UtxoLookupError_clone"))) TS_UtxoLookupError_clone(uint64_t orig) {
61597         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
61598         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_clone(orig_conv));
61599         return ret_conv;
61600 }
61601
61602 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_chain"))) TS_UtxoLookupError_unknown_chain() {
61603         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_chain());
61604         return ret_conv;
61605 }
61606
61607 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_tx"))) TS_UtxoLookupError_unknown_tx() {
61608         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_tx());
61609         return ret_conv;
61610 }
61611
61612 void  __attribute__((export_name("TS_UtxoResult_free"))) TS_UtxoResult_free(uint64_t this_ptr) {
61613         if (!ptr_is_owned(this_ptr)) return;
61614         void* this_ptr_ptr = untag_ptr(this_ptr);
61615         CHECK_ACCESS(this_ptr_ptr);
61616         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
61617         FREE(untag_ptr(this_ptr));
61618         UtxoResult_free(this_ptr_conv);
61619 }
61620
61621 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
61622         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
61623         *ret_copy = UtxoResult_clone(arg);
61624         uint64_t ret_ref = tag_ptr(ret_copy, true);
61625         return ret_ref;
61626 }
61627 int64_t  __attribute__((export_name("TS_UtxoResult_clone_ptr"))) TS_UtxoResult_clone_ptr(uint64_t arg) {
61628         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
61629         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
61630         return ret_conv;
61631 }
61632
61633 uint64_t  __attribute__((export_name("TS_UtxoResult_clone"))) TS_UtxoResult_clone(uint64_t orig) {
61634         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
61635         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
61636         *ret_copy = UtxoResult_clone(orig_conv);
61637         uint64_t ret_ref = tag_ptr(ret_copy, true);
61638         return ret_ref;
61639 }
61640
61641 uint64_t  __attribute__((export_name("TS_UtxoResult_sync"))) TS_UtxoResult_sync(uint64_t a) {
61642         void* a_ptr = untag_ptr(a);
61643         CHECK_ACCESS(a_ptr);
61644         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
61645         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
61646         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
61647         *ret_copy = UtxoResult_sync(a_conv);
61648         uint64_t ret_ref = tag_ptr(ret_copy, true);
61649         return ret_ref;
61650 }
61651
61652 uint64_t  __attribute__((export_name("TS_UtxoResult_async"))) TS_UtxoResult_async(uint64_t a) {
61653         LDKUtxoFuture a_conv;
61654         a_conv.inner = untag_ptr(a);
61655         a_conv.is_owned = ptr_is_owned(a);
61656         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61657         a_conv = UtxoFuture_clone(&a_conv);
61658         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
61659         *ret_copy = UtxoResult_async(a_conv);
61660         uint64_t ret_ref = tag_ptr(ret_copy, true);
61661         return ret_ref;
61662 }
61663
61664 void  __attribute__((export_name("TS_UtxoLookup_free"))) TS_UtxoLookup_free(uint64_t this_ptr) {
61665         if (!ptr_is_owned(this_ptr)) return;
61666         void* this_ptr_ptr = untag_ptr(this_ptr);
61667         CHECK_ACCESS(this_ptr_ptr);
61668         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
61669         FREE(untag_ptr(this_ptr));
61670         UtxoLookup_free(this_ptr_conv);
61671 }
61672
61673 void  __attribute__((export_name("TS_UtxoFuture_free"))) TS_UtxoFuture_free(uint64_t this_obj) {
61674         LDKUtxoFuture this_obj_conv;
61675         this_obj_conv.inner = untag_ptr(this_obj);
61676         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61678         UtxoFuture_free(this_obj_conv);
61679 }
61680
61681 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
61682         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
61683         uint64_t ret_ref = 0;
61684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61686         return ret_ref;
61687 }
61688 int64_t  __attribute__((export_name("TS_UtxoFuture_clone_ptr"))) TS_UtxoFuture_clone_ptr(uint64_t arg) {
61689         LDKUtxoFuture arg_conv;
61690         arg_conv.inner = untag_ptr(arg);
61691         arg_conv.is_owned = ptr_is_owned(arg);
61692         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61693         arg_conv.is_owned = false;
61694         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
61695         return ret_conv;
61696 }
61697
61698 uint64_t  __attribute__((export_name("TS_UtxoFuture_clone"))) TS_UtxoFuture_clone(uint64_t orig) {
61699         LDKUtxoFuture orig_conv;
61700         orig_conv.inner = untag_ptr(orig);
61701         orig_conv.is_owned = ptr_is_owned(orig);
61702         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61703         orig_conv.is_owned = false;
61704         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
61705         uint64_t ret_ref = 0;
61706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61708         return ret_ref;
61709 }
61710
61711 uint64_t  __attribute__((export_name("TS_UtxoFuture_new"))) TS_UtxoFuture_new() {
61712         LDKUtxoFuture ret_var = UtxoFuture_new();
61713         uint64_t ret_ref = 0;
61714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61716         return ret_ref;
61717 }
61718
61719 void  __attribute__((export_name("TS_UtxoFuture_resolve_without_forwarding"))) TS_UtxoFuture_resolve_without_forwarding(uint64_t this_arg, uint64_t graph, uint64_t result) {
61720         LDKUtxoFuture this_arg_conv;
61721         this_arg_conv.inner = untag_ptr(this_arg);
61722         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61724         this_arg_conv.is_owned = false;
61725         LDKNetworkGraph graph_conv;
61726         graph_conv.inner = untag_ptr(graph);
61727         graph_conv.is_owned = ptr_is_owned(graph);
61728         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
61729         graph_conv.is_owned = false;
61730         void* result_ptr = untag_ptr(result);
61731         CHECK_ACCESS(result_ptr);
61732         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
61733         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
61734 }
61735
61736 void  __attribute__((export_name("TS_UtxoFuture_resolve"))) TS_UtxoFuture_resolve(uint64_t this_arg, uint64_t graph, uint64_t gossip, uint64_t result) {
61737         LDKUtxoFuture this_arg_conv;
61738         this_arg_conv.inner = untag_ptr(this_arg);
61739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61741         this_arg_conv.is_owned = false;
61742         LDKNetworkGraph graph_conv;
61743         graph_conv.inner = untag_ptr(graph);
61744         graph_conv.is_owned = ptr_is_owned(graph);
61745         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
61746         graph_conv.is_owned = false;
61747         LDKP2PGossipSync gossip_conv;
61748         gossip_conv.inner = untag_ptr(gossip);
61749         gossip_conv.is_owned = ptr_is_owned(gossip);
61750         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
61751         gossip_conv.is_owned = false;
61752         void* result_ptr = untag_ptr(result);
61753         CHECK_ACCESS(result_ptr);
61754         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
61755         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
61756 }
61757
61758 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
61759         LDKNodeId this_obj_conv;
61760         this_obj_conv.inner = untag_ptr(this_obj);
61761         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61763         NodeId_free(this_obj_conv);
61764 }
61765
61766 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
61767         LDKNodeId ret_var = NodeId_clone(arg);
61768         uint64_t ret_ref = 0;
61769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61771         return ret_ref;
61772 }
61773 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
61774         LDKNodeId arg_conv;
61775         arg_conv.inner = untag_ptr(arg);
61776         arg_conv.is_owned = ptr_is_owned(arg);
61777         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61778         arg_conv.is_owned = false;
61779         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
61780         return ret_conv;
61781 }
61782
61783 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
61784         LDKNodeId orig_conv;
61785         orig_conv.inner = untag_ptr(orig);
61786         orig_conv.is_owned = ptr_is_owned(orig);
61787         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61788         orig_conv.is_owned = false;
61789         LDKNodeId ret_var = NodeId_clone(&orig_conv);
61790         uint64_t ret_ref = 0;
61791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61793         return ret_ref;
61794 }
61795
61796 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
61797         LDKPublicKey pubkey_ref;
61798         CHECK(pubkey->arr_len == 33);
61799         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
61800         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
61801         uint64_t ret_ref = 0;
61802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61804         return ret_ref;
61805 }
61806
61807 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
61808         LDKNodeId this_arg_conv;
61809         this_arg_conv.inner = untag_ptr(this_arg);
61810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61812         this_arg_conv.is_owned = false;
61813         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
61814         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61815         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61816         return ret_arr;
61817 }
61818
61819 int8_tArray  __attribute__((export_name("TS_NodeId_as_array"))) TS_NodeId_as_array(uint64_t this_arg) {
61820         LDKNodeId this_arg_conv;
61821         this_arg_conv.inner = untag_ptr(this_arg);
61822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61824         this_arg_conv.is_owned = false;
61825         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61826         memcpy(ret_arr->elems, *NodeId_as_array(&this_arg_conv), 33);
61827         return ret_arr;
61828 }
61829
61830 uint64_t  __attribute__((export_name("TS_NodeId_as_pubkey"))) TS_NodeId_as_pubkey(uint64_t this_arg) {
61831         LDKNodeId this_arg_conv;
61832         this_arg_conv.inner = untag_ptr(this_arg);
61833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61835         this_arg_conv.is_owned = false;
61836         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
61837         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
61838         return tag_ptr(ret_conv, true);
61839 }
61840
61841 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
61842         LDKNodeId o_conv;
61843         o_conv.inner = untag_ptr(o);
61844         o_conv.is_owned = ptr_is_owned(o);
61845         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61846         o_conv.is_owned = false;
61847         int64_t ret_conv = NodeId_hash(&o_conv);
61848         return ret_conv;
61849 }
61850
61851 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
61852         LDKNodeId obj_conv;
61853         obj_conv.inner = untag_ptr(obj);
61854         obj_conv.is_owned = ptr_is_owned(obj);
61855         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61856         obj_conv.is_owned = false;
61857         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
61858         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61859         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61860         CVec_u8Z_free(ret_var);
61861         return ret_arr;
61862 }
61863
61864 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
61865         LDKu8slice ser_ref;
61866         ser_ref.datalen = ser->arr_len;
61867         ser_ref.data = ser->elems;
61868         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
61869         *ret_conv = NodeId_read(ser_ref);
61870         FREE(ser);
61871         return tag_ptr(ret_conv, true);
61872 }
61873
61874 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
61875         LDKNetworkGraph this_obj_conv;
61876         this_obj_conv.inner = untag_ptr(this_obj);
61877         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61879         NetworkGraph_free(this_obj_conv);
61880 }
61881
61882 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
61883         LDKReadOnlyNetworkGraph this_obj_conv;
61884         this_obj_conv.inner = untag_ptr(this_obj);
61885         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61887         ReadOnlyNetworkGraph_free(this_obj_conv);
61888 }
61889
61890 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
61891         if (!ptr_is_owned(this_ptr)) return;
61892         void* this_ptr_ptr = untag_ptr(this_ptr);
61893         CHECK_ACCESS(this_ptr_ptr);
61894         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
61895         FREE(untag_ptr(this_ptr));
61896         NetworkUpdate_free(this_ptr_conv);
61897 }
61898
61899 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
61900         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61901         *ret_copy = NetworkUpdate_clone(arg);
61902         uint64_t ret_ref = tag_ptr(ret_copy, true);
61903         return ret_ref;
61904 }
61905 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
61906         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
61907         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
61908         return ret_conv;
61909 }
61910
61911 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
61912         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
61913         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61914         *ret_copy = NetworkUpdate_clone(orig_conv);
61915         uint64_t ret_ref = tag_ptr(ret_copy, true);
61916         return ret_ref;
61917 }
61918
61919 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
61920         LDKChannelUpdate msg_conv;
61921         msg_conv.inner = untag_ptr(msg);
61922         msg_conv.is_owned = ptr_is_owned(msg);
61923         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
61924         msg_conv = ChannelUpdate_clone(&msg_conv);
61925         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61926         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
61927         uint64_t ret_ref = tag_ptr(ret_copy, true);
61928         return ret_ref;
61929 }
61930
61931 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
61932         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61933         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
61934         uint64_t ret_ref = tag_ptr(ret_copy, true);
61935         return ret_ref;
61936 }
61937
61938 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
61939         LDKPublicKey node_id_ref;
61940         CHECK(node_id->arr_len == 33);
61941         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
61942         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61943         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
61944         uint64_t ret_ref = tag_ptr(ret_copy, true);
61945         return ret_ref;
61946 }
61947
61948 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
61949         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
61950         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
61951         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
61952         return ret_conv;
61953 }
61954
61955 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
61956         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
61957         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
61958         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61959         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61960         CVec_u8Z_free(ret_var);
61961         return ret_arr;
61962 }
61963
61964 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
61965         LDKu8slice ser_ref;
61966         ser_ref.datalen = ser->arr_len;
61967         ser_ref.data = ser->elems;
61968         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
61969         *ret_conv = NetworkUpdate_read(ser_ref);
61970         FREE(ser);
61971         return tag_ptr(ret_conv, true);
61972 }
61973
61974 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
61975         LDKP2PGossipSync this_obj_conv;
61976         this_obj_conv.inner = untag_ptr(this_obj);
61977         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61979         P2PGossipSync_free(this_obj_conv);
61980 }
61981
61982 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t utxo_lookup, uint64_t logger) {
61983         LDKNetworkGraph network_graph_conv;
61984         network_graph_conv.inner = untag_ptr(network_graph);
61985         network_graph_conv.is_owned = ptr_is_owned(network_graph);
61986         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
61987         network_graph_conv.is_owned = false;
61988         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
61989         CHECK_ACCESS(utxo_lookup_ptr);
61990         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
61991         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
61992         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
61993                 // Manually implement clone for Java trait instances
61994                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
61995                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61996                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
61997                 }
61998         }
61999         void* logger_ptr = untag_ptr(logger);
62000         CHECK_ACCESS(logger_ptr);
62001         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
62002         if (logger_conv.free == LDKLogger_JCalls_free) {
62003                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62004                 LDKLogger_JCalls_cloned(&logger_conv);
62005         }
62006         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
62007         uint64_t ret_ref = 0;
62008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62010         return ret_ref;
62011 }
62012
62013 void  __attribute__((export_name("TS_P2PGossipSync_add_utxo_lookup"))) TS_P2PGossipSync_add_utxo_lookup(uint64_t this_arg, uint64_t utxo_lookup) {
62014         LDKP2PGossipSync this_arg_conv;
62015         this_arg_conv.inner = untag_ptr(this_arg);
62016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62018         this_arg_conv.is_owned = false;
62019         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
62020         CHECK_ACCESS(utxo_lookup_ptr);
62021         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
62022         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
62023         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
62024                 // Manually implement clone for Java trait instances
62025                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
62026                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62027                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
62028                 }
62029         }
62030         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
62031 }
62032
62033 void  __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) {
62034         LDKNetworkGraph this_arg_conv;
62035         this_arg_conv.inner = untag_ptr(this_arg);
62036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62038         this_arg_conv.is_owned = false;
62039         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
62040         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
62041 }
62042
62043 int8_tArray  __attribute__((export_name("TS_NetworkGraph_get_chain_hash"))) TS_NetworkGraph_get_chain_hash(uint64_t this_arg) {
62044         LDKNetworkGraph this_arg_conv;
62045         this_arg_conv.inner = untag_ptr(this_arg);
62046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62048         this_arg_conv.is_owned = false;
62049         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62050         memcpy(ret_arr->elems, NetworkGraph_get_chain_hash(&this_arg_conv).data, 32);
62051         return ret_arr;
62052 }
62053
62054 uint64_t  __attribute__((export_name("TS_verify_node_announcement"))) TS_verify_node_announcement(uint64_t msg) {
62055         LDKNodeAnnouncement msg_conv;
62056         msg_conv.inner = untag_ptr(msg);
62057         msg_conv.is_owned = ptr_is_owned(msg);
62058         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62059         msg_conv.is_owned = false;
62060         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62061         *ret_conv = verify_node_announcement(&msg_conv);
62062         return tag_ptr(ret_conv, true);
62063 }
62064
62065 uint64_t  __attribute__((export_name("TS_verify_channel_announcement"))) TS_verify_channel_announcement(uint64_t msg) {
62066         LDKChannelAnnouncement msg_conv;
62067         msg_conv.inner = untag_ptr(msg);
62068         msg_conv.is_owned = ptr_is_owned(msg);
62069         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62070         msg_conv.is_owned = false;
62071         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62072         *ret_conv = verify_channel_announcement(&msg_conv);
62073         return tag_ptr(ret_conv, true);
62074 }
62075
62076 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
62077         LDKP2PGossipSync this_arg_conv;
62078         this_arg_conv.inner = untag_ptr(this_arg);
62079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62081         this_arg_conv.is_owned = false;
62082         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
62083         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
62084         return tag_ptr(ret_ret, true);
62085 }
62086
62087 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
62088         LDKP2PGossipSync this_arg_conv;
62089         this_arg_conv.inner = untag_ptr(this_arg);
62090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62092         this_arg_conv.is_owned = false;
62093         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
62094         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
62095         return tag_ptr(ret_ret, true);
62096 }
62097
62098 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
62099         LDKChannelUpdateInfo this_obj_conv;
62100         this_obj_conv.inner = untag_ptr(this_obj);
62101         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62103         ChannelUpdateInfo_free(this_obj_conv);
62104 }
62105
62106 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
62107         LDKChannelUpdateInfo this_ptr_conv;
62108         this_ptr_conv.inner = untag_ptr(this_ptr);
62109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62111         this_ptr_conv.is_owned = false;
62112         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
62113         return ret_conv;
62114 }
62115
62116 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
62117         LDKChannelUpdateInfo this_ptr_conv;
62118         this_ptr_conv.inner = untag_ptr(this_ptr);
62119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62121         this_ptr_conv.is_owned = false;
62122         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
62123 }
62124
62125 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
62126         LDKChannelUpdateInfo this_ptr_conv;
62127         this_ptr_conv.inner = untag_ptr(this_ptr);
62128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62130         this_ptr_conv.is_owned = false;
62131         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
62132         return ret_conv;
62133 }
62134
62135 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
62136         LDKChannelUpdateInfo this_ptr_conv;
62137         this_ptr_conv.inner = untag_ptr(this_ptr);
62138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62140         this_ptr_conv.is_owned = false;
62141         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
62142 }
62143
62144 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
62145         LDKChannelUpdateInfo this_ptr_conv;
62146         this_ptr_conv.inner = untag_ptr(this_ptr);
62147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62149         this_ptr_conv.is_owned = false;
62150         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
62151         return ret_conv;
62152 }
62153
62154 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
62155         LDKChannelUpdateInfo this_ptr_conv;
62156         this_ptr_conv.inner = untag_ptr(this_ptr);
62157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62159         this_ptr_conv.is_owned = false;
62160         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
62161 }
62162
62163 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
62164         LDKChannelUpdateInfo this_ptr_conv;
62165         this_ptr_conv.inner = untag_ptr(this_ptr);
62166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62168         this_ptr_conv.is_owned = false;
62169         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
62170         return ret_conv;
62171 }
62172
62173 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
62174         LDKChannelUpdateInfo this_ptr_conv;
62175         this_ptr_conv.inner = untag_ptr(this_ptr);
62176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62178         this_ptr_conv.is_owned = false;
62179         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
62180 }
62181
62182 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
62183         LDKChannelUpdateInfo this_ptr_conv;
62184         this_ptr_conv.inner = untag_ptr(this_ptr);
62185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62187         this_ptr_conv.is_owned = false;
62188         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
62189         return ret_conv;
62190 }
62191
62192 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
62193         LDKChannelUpdateInfo this_ptr_conv;
62194         this_ptr_conv.inner = untag_ptr(this_ptr);
62195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62197         this_ptr_conv.is_owned = false;
62198         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
62199 }
62200
62201 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
62202         LDKChannelUpdateInfo this_ptr_conv;
62203         this_ptr_conv.inner = untag_ptr(this_ptr);
62204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62206         this_ptr_conv.is_owned = false;
62207         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
62208         uint64_t ret_ref = 0;
62209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62211         return ret_ref;
62212 }
62213
62214 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
62215         LDKChannelUpdateInfo this_ptr_conv;
62216         this_ptr_conv.inner = untag_ptr(this_ptr);
62217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62219         this_ptr_conv.is_owned = false;
62220         LDKRoutingFees val_conv;
62221         val_conv.inner = untag_ptr(val);
62222         val_conv.is_owned = ptr_is_owned(val);
62223         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62224         val_conv = RoutingFees_clone(&val_conv);
62225         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
62226 }
62227
62228 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
62229         LDKChannelUpdateInfo this_ptr_conv;
62230         this_ptr_conv.inner = untag_ptr(this_ptr);
62231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62233         this_ptr_conv.is_owned = false;
62234         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
62235         uint64_t ret_ref = 0;
62236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62238         return ret_ref;
62239 }
62240
62241 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
62242         LDKChannelUpdateInfo this_ptr_conv;
62243         this_ptr_conv.inner = untag_ptr(this_ptr);
62244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62246         this_ptr_conv.is_owned = false;
62247         LDKChannelUpdate val_conv;
62248         val_conv.inner = untag_ptr(val);
62249         val_conv.is_owned = ptr_is_owned(val);
62250         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62251         val_conv = ChannelUpdate_clone(&val_conv);
62252         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
62253 }
62254
62255 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) {
62256         LDKRoutingFees fees_arg_conv;
62257         fees_arg_conv.inner = untag_ptr(fees_arg);
62258         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
62259         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
62260         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
62261         LDKChannelUpdate last_update_message_arg_conv;
62262         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
62263         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
62264         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
62265         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
62266         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);
62267         uint64_t ret_ref = 0;
62268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62270         return ret_ref;
62271 }
62272
62273 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
62274         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
62275         uint64_t ret_ref = 0;
62276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62278         return ret_ref;
62279 }
62280 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
62281         LDKChannelUpdateInfo arg_conv;
62282         arg_conv.inner = untag_ptr(arg);
62283         arg_conv.is_owned = ptr_is_owned(arg);
62284         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62285         arg_conv.is_owned = false;
62286         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
62287         return ret_conv;
62288 }
62289
62290 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
62291         LDKChannelUpdateInfo orig_conv;
62292         orig_conv.inner = untag_ptr(orig);
62293         orig_conv.is_owned = ptr_is_owned(orig);
62294         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62295         orig_conv.is_owned = false;
62296         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
62297         uint64_t ret_ref = 0;
62298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62300         return ret_ref;
62301 }
62302
62303 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
62304         LDKChannelUpdateInfo a_conv;
62305         a_conv.inner = untag_ptr(a);
62306         a_conv.is_owned = ptr_is_owned(a);
62307         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62308         a_conv.is_owned = false;
62309         LDKChannelUpdateInfo b_conv;
62310         b_conv.inner = untag_ptr(b);
62311         b_conv.is_owned = ptr_is_owned(b);
62312         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62313         b_conv.is_owned = false;
62314         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
62315         return ret_conv;
62316 }
62317
62318 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
62319         LDKChannelUpdateInfo obj_conv;
62320         obj_conv.inner = untag_ptr(obj);
62321         obj_conv.is_owned = ptr_is_owned(obj);
62322         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62323         obj_conv.is_owned = false;
62324         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
62325         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62326         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62327         CVec_u8Z_free(ret_var);
62328         return ret_arr;
62329 }
62330
62331 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
62332         LDKu8slice ser_ref;
62333         ser_ref.datalen = ser->arr_len;
62334         ser_ref.data = ser->elems;
62335         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
62336         *ret_conv = ChannelUpdateInfo_read(ser_ref);
62337         FREE(ser);
62338         return tag_ptr(ret_conv, true);
62339 }
62340
62341 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
62342         LDKChannelInfo this_obj_conv;
62343         this_obj_conv.inner = untag_ptr(this_obj);
62344         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62346         ChannelInfo_free(this_obj_conv);
62347 }
62348
62349 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
62350         LDKChannelInfo this_ptr_conv;
62351         this_ptr_conv.inner = untag_ptr(this_ptr);
62352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62354         this_ptr_conv.is_owned = false;
62355         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
62356         uint64_t ret_ref = 0;
62357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62359         return ret_ref;
62360 }
62361
62362 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
62363         LDKChannelInfo this_ptr_conv;
62364         this_ptr_conv.inner = untag_ptr(this_ptr);
62365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62367         this_ptr_conv.is_owned = false;
62368         LDKChannelFeatures val_conv;
62369         val_conv.inner = untag_ptr(val);
62370         val_conv.is_owned = ptr_is_owned(val);
62371         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62372         val_conv = ChannelFeatures_clone(&val_conv);
62373         ChannelInfo_set_features(&this_ptr_conv, val_conv);
62374 }
62375
62376 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
62377         LDKChannelInfo this_ptr_conv;
62378         this_ptr_conv.inner = untag_ptr(this_ptr);
62379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62381         this_ptr_conv.is_owned = false;
62382         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
62383         uint64_t ret_ref = 0;
62384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62386         return ret_ref;
62387 }
62388
62389 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
62390         LDKChannelInfo this_ptr_conv;
62391         this_ptr_conv.inner = untag_ptr(this_ptr);
62392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62394         this_ptr_conv.is_owned = false;
62395         LDKNodeId val_conv;
62396         val_conv.inner = untag_ptr(val);
62397         val_conv.is_owned = ptr_is_owned(val);
62398         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62399         val_conv = NodeId_clone(&val_conv);
62400         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
62401 }
62402
62403 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
62404         LDKChannelInfo this_ptr_conv;
62405         this_ptr_conv.inner = untag_ptr(this_ptr);
62406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62408         this_ptr_conv.is_owned = false;
62409         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
62410         uint64_t ret_ref = 0;
62411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62413         return ret_ref;
62414 }
62415
62416 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
62417         LDKChannelInfo this_ptr_conv;
62418         this_ptr_conv.inner = untag_ptr(this_ptr);
62419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62421         this_ptr_conv.is_owned = false;
62422         LDKChannelUpdateInfo val_conv;
62423         val_conv.inner = untag_ptr(val);
62424         val_conv.is_owned = ptr_is_owned(val);
62425         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62426         val_conv = ChannelUpdateInfo_clone(&val_conv);
62427         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
62428 }
62429
62430 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
62431         LDKChannelInfo this_ptr_conv;
62432         this_ptr_conv.inner = untag_ptr(this_ptr);
62433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62435         this_ptr_conv.is_owned = false;
62436         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
62437         uint64_t ret_ref = 0;
62438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62440         return ret_ref;
62441 }
62442
62443 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
62444         LDKChannelInfo this_ptr_conv;
62445         this_ptr_conv.inner = untag_ptr(this_ptr);
62446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62448         this_ptr_conv.is_owned = false;
62449         LDKNodeId val_conv;
62450         val_conv.inner = untag_ptr(val);
62451         val_conv.is_owned = ptr_is_owned(val);
62452         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62453         val_conv = NodeId_clone(&val_conv);
62454         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
62455 }
62456
62457 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
62458         LDKChannelInfo this_ptr_conv;
62459         this_ptr_conv.inner = untag_ptr(this_ptr);
62460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62462         this_ptr_conv.is_owned = false;
62463         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
62464         uint64_t ret_ref = 0;
62465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62467         return ret_ref;
62468 }
62469
62470 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
62471         LDKChannelInfo this_ptr_conv;
62472         this_ptr_conv.inner = untag_ptr(this_ptr);
62473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62475         this_ptr_conv.is_owned = false;
62476         LDKChannelUpdateInfo val_conv;
62477         val_conv.inner = untag_ptr(val);
62478         val_conv.is_owned = ptr_is_owned(val);
62479         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62480         val_conv = ChannelUpdateInfo_clone(&val_conv);
62481         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
62482 }
62483
62484 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
62485         LDKChannelInfo this_ptr_conv;
62486         this_ptr_conv.inner = untag_ptr(this_ptr);
62487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62489         this_ptr_conv.is_owned = false;
62490         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
62491         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
62492         uint64_t ret_ref = tag_ptr(ret_copy, true);
62493         return ret_ref;
62494 }
62495
62496 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
62497         LDKChannelInfo this_ptr_conv;
62498         this_ptr_conv.inner = untag_ptr(this_ptr);
62499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62501         this_ptr_conv.is_owned = false;
62502         void* val_ptr = untag_ptr(val);
62503         CHECK_ACCESS(val_ptr);
62504         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
62505         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
62506         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
62507 }
62508
62509 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
62510         LDKChannelInfo this_ptr_conv;
62511         this_ptr_conv.inner = untag_ptr(this_ptr);
62512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62514         this_ptr_conv.is_owned = false;
62515         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
62516         uint64_t ret_ref = 0;
62517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62519         return ret_ref;
62520 }
62521
62522 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
62523         LDKChannelInfo this_ptr_conv;
62524         this_ptr_conv.inner = untag_ptr(this_ptr);
62525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62527         this_ptr_conv.is_owned = false;
62528         LDKChannelAnnouncement val_conv;
62529         val_conv.inner = untag_ptr(val);
62530         val_conv.is_owned = ptr_is_owned(val);
62531         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62532         val_conv = ChannelAnnouncement_clone(&val_conv);
62533         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
62534 }
62535
62536 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
62537         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
62538         uint64_t ret_ref = 0;
62539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62541         return ret_ref;
62542 }
62543 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
62544         LDKChannelInfo arg_conv;
62545         arg_conv.inner = untag_ptr(arg);
62546         arg_conv.is_owned = ptr_is_owned(arg);
62547         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62548         arg_conv.is_owned = false;
62549         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
62550         return ret_conv;
62551 }
62552
62553 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
62554         LDKChannelInfo orig_conv;
62555         orig_conv.inner = untag_ptr(orig);
62556         orig_conv.is_owned = ptr_is_owned(orig);
62557         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62558         orig_conv.is_owned = false;
62559         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
62560         uint64_t ret_ref = 0;
62561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62563         return ret_ref;
62564 }
62565
62566 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
62567         LDKChannelInfo a_conv;
62568         a_conv.inner = untag_ptr(a);
62569         a_conv.is_owned = ptr_is_owned(a);
62570         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62571         a_conv.is_owned = false;
62572         LDKChannelInfo b_conv;
62573         b_conv.inner = untag_ptr(b);
62574         b_conv.is_owned = ptr_is_owned(b);
62575         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62576         b_conv.is_owned = false;
62577         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
62578         return ret_conv;
62579 }
62580
62581 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
62582         LDKChannelInfo this_arg_conv;
62583         this_arg_conv.inner = untag_ptr(this_arg);
62584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62586         this_arg_conv.is_owned = false;
62587         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
62588         uint64_t ret_ref = 0;
62589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62591         return ret_ref;
62592 }
62593
62594 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
62595         LDKChannelInfo obj_conv;
62596         obj_conv.inner = untag_ptr(obj);
62597         obj_conv.is_owned = ptr_is_owned(obj);
62598         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62599         obj_conv.is_owned = false;
62600         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
62601         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62602         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62603         CVec_u8Z_free(ret_var);
62604         return ret_arr;
62605 }
62606
62607 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
62608         LDKu8slice ser_ref;
62609         ser_ref.datalen = ser->arr_len;
62610         ser_ref.data = ser->elems;
62611         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
62612         *ret_conv = ChannelInfo_read(ser_ref);
62613         FREE(ser);
62614         return tag_ptr(ret_conv, true);
62615 }
62616
62617 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
62618         LDKDirectedChannelInfo this_obj_conv;
62619         this_obj_conv.inner = untag_ptr(this_obj);
62620         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62622         DirectedChannelInfo_free(this_obj_conv);
62623 }
62624
62625 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
62626         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
62627         uint64_t ret_ref = 0;
62628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62630         return ret_ref;
62631 }
62632 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
62633         LDKDirectedChannelInfo arg_conv;
62634         arg_conv.inner = untag_ptr(arg);
62635         arg_conv.is_owned = ptr_is_owned(arg);
62636         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62637         arg_conv.is_owned = false;
62638         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
62639         return ret_conv;
62640 }
62641
62642 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
62643         LDKDirectedChannelInfo orig_conv;
62644         orig_conv.inner = untag_ptr(orig);
62645         orig_conv.is_owned = ptr_is_owned(orig);
62646         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62647         orig_conv.is_owned = false;
62648         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
62649         uint64_t ret_ref = 0;
62650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62652         return ret_ref;
62653 }
62654
62655 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
62656         LDKDirectedChannelInfo this_arg_conv;
62657         this_arg_conv.inner = untag_ptr(this_arg);
62658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62660         this_arg_conv.is_owned = false;
62661         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
62662         uint64_t ret_ref = 0;
62663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62665         return ret_ref;
62666 }
62667
62668 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
62669         LDKDirectedChannelInfo this_arg_conv;
62670         this_arg_conv.inner = untag_ptr(this_arg);
62671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62673         this_arg_conv.is_owned = false;
62674         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62675         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
62676         uint64_t ret_ref = tag_ptr(ret_copy, true);
62677         return ret_ref;
62678 }
62679
62680 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
62681         if (!ptr_is_owned(this_ptr)) return;
62682         void* this_ptr_ptr = untag_ptr(this_ptr);
62683         CHECK_ACCESS(this_ptr_ptr);
62684         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
62685         FREE(untag_ptr(this_ptr));
62686         EffectiveCapacity_free(this_ptr_conv);
62687 }
62688
62689 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
62690         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62691         *ret_copy = EffectiveCapacity_clone(arg);
62692         uint64_t ret_ref = tag_ptr(ret_copy, true);
62693         return ret_ref;
62694 }
62695 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
62696         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
62697         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
62698         return ret_conv;
62699 }
62700
62701 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
62702         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
62703         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62704         *ret_copy = EffectiveCapacity_clone(orig_conv);
62705         uint64_t ret_ref = tag_ptr(ret_copy, true);
62706         return ret_ref;
62707 }
62708
62709 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
62710         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62711         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
62712         uint64_t ret_ref = tag_ptr(ret_copy, true);
62713         return ret_ref;
62714 }
62715
62716 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_advertised_max_htlc"))) TS_EffectiveCapacity_advertised_max_htlc(int64_t amount_msat) {
62717         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62718         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
62719         uint64_t ret_ref = tag_ptr(ret_copy, true);
62720         return ret_ref;
62721 }
62722
62723 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
62724         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62725         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
62726         uint64_t ret_ref = tag_ptr(ret_copy, true);
62727         return ret_ref;
62728 }
62729
62730 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
62731         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62732         *ret_copy = EffectiveCapacity_infinite();
62733         uint64_t ret_ref = tag_ptr(ret_copy, true);
62734         return ret_ref;
62735 }
62736
62737 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_hint_max_htlc"))) TS_EffectiveCapacity_hint_max_htlc(int64_t amount_msat) {
62738         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62739         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
62740         uint64_t ret_ref = tag_ptr(ret_copy, true);
62741         return ret_ref;
62742 }
62743
62744 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
62745         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62746         *ret_copy = EffectiveCapacity_unknown();
62747         uint64_t ret_ref = tag_ptr(ret_copy, true);
62748         return ret_ref;
62749 }
62750
62751 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
62752         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
62753         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
62754         return ret_conv;
62755 }
62756
62757 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
62758         LDKRoutingFees this_obj_conv;
62759         this_obj_conv.inner = untag_ptr(this_obj);
62760         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62762         RoutingFees_free(this_obj_conv);
62763 }
62764
62765 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
62766         LDKRoutingFees this_ptr_conv;
62767         this_ptr_conv.inner = untag_ptr(this_ptr);
62768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62770         this_ptr_conv.is_owned = false;
62771         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
62772         return ret_conv;
62773 }
62774
62775 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
62776         LDKRoutingFees this_ptr_conv;
62777         this_ptr_conv.inner = untag_ptr(this_ptr);
62778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62780         this_ptr_conv.is_owned = false;
62781         RoutingFees_set_base_msat(&this_ptr_conv, val);
62782 }
62783
62784 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
62785         LDKRoutingFees this_ptr_conv;
62786         this_ptr_conv.inner = untag_ptr(this_ptr);
62787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62789         this_ptr_conv.is_owned = false;
62790         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
62791         return ret_conv;
62792 }
62793
62794 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
62795         LDKRoutingFees this_ptr_conv;
62796         this_ptr_conv.inner = untag_ptr(this_ptr);
62797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62799         this_ptr_conv.is_owned = false;
62800         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
62801 }
62802
62803 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
62804         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
62805         uint64_t ret_ref = 0;
62806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62808         return ret_ref;
62809 }
62810
62811 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
62812         LDKRoutingFees a_conv;
62813         a_conv.inner = untag_ptr(a);
62814         a_conv.is_owned = ptr_is_owned(a);
62815         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62816         a_conv.is_owned = false;
62817         LDKRoutingFees b_conv;
62818         b_conv.inner = untag_ptr(b);
62819         b_conv.is_owned = ptr_is_owned(b);
62820         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62821         b_conv.is_owned = false;
62822         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
62823         return ret_conv;
62824 }
62825
62826 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
62827         LDKRoutingFees ret_var = RoutingFees_clone(arg);
62828         uint64_t ret_ref = 0;
62829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62831         return ret_ref;
62832 }
62833 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
62834         LDKRoutingFees arg_conv;
62835         arg_conv.inner = untag_ptr(arg);
62836         arg_conv.is_owned = ptr_is_owned(arg);
62837         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62838         arg_conv.is_owned = false;
62839         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
62840         return ret_conv;
62841 }
62842
62843 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
62844         LDKRoutingFees orig_conv;
62845         orig_conv.inner = untag_ptr(orig);
62846         orig_conv.is_owned = ptr_is_owned(orig);
62847         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62848         orig_conv.is_owned = false;
62849         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
62850         uint64_t ret_ref = 0;
62851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62853         return ret_ref;
62854 }
62855
62856 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
62857         LDKRoutingFees o_conv;
62858         o_conv.inner = untag_ptr(o);
62859         o_conv.is_owned = ptr_is_owned(o);
62860         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62861         o_conv.is_owned = false;
62862         int64_t ret_conv = RoutingFees_hash(&o_conv);
62863         return ret_conv;
62864 }
62865
62866 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
62867         LDKRoutingFees obj_conv;
62868         obj_conv.inner = untag_ptr(obj);
62869         obj_conv.is_owned = ptr_is_owned(obj);
62870         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62871         obj_conv.is_owned = false;
62872         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
62873         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62874         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62875         CVec_u8Z_free(ret_var);
62876         return ret_arr;
62877 }
62878
62879 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
62880         LDKu8slice ser_ref;
62881         ser_ref.datalen = ser->arr_len;
62882         ser_ref.data = ser->elems;
62883         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
62884         *ret_conv = RoutingFees_read(ser_ref);
62885         FREE(ser);
62886         return tag_ptr(ret_conv, true);
62887 }
62888
62889 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
62890         LDKNodeAnnouncementInfo this_obj_conv;
62891         this_obj_conv.inner = untag_ptr(this_obj);
62892         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62894         NodeAnnouncementInfo_free(this_obj_conv);
62895 }
62896
62897 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
62898         LDKNodeAnnouncementInfo this_ptr_conv;
62899         this_ptr_conv.inner = untag_ptr(this_ptr);
62900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62902         this_ptr_conv.is_owned = false;
62903         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
62904         uint64_t ret_ref = 0;
62905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62907         return ret_ref;
62908 }
62909
62910 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
62911         LDKNodeAnnouncementInfo this_ptr_conv;
62912         this_ptr_conv.inner = untag_ptr(this_ptr);
62913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62915         this_ptr_conv.is_owned = false;
62916         LDKNodeFeatures val_conv;
62917         val_conv.inner = untag_ptr(val);
62918         val_conv.is_owned = ptr_is_owned(val);
62919         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62920         val_conv = NodeFeatures_clone(&val_conv);
62921         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
62922 }
62923
62924 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
62925         LDKNodeAnnouncementInfo this_ptr_conv;
62926         this_ptr_conv.inner = untag_ptr(this_ptr);
62927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62929         this_ptr_conv.is_owned = false;
62930         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
62931         return ret_conv;
62932 }
62933
62934 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
62935         LDKNodeAnnouncementInfo this_ptr_conv;
62936         this_ptr_conv.inner = untag_ptr(this_ptr);
62937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62939         this_ptr_conv.is_owned = false;
62940         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
62941 }
62942
62943 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
62944         LDKNodeAnnouncementInfo this_ptr_conv;
62945         this_ptr_conv.inner = untag_ptr(this_ptr);
62946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62948         this_ptr_conv.is_owned = false;
62949         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
62950         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
62951         return ret_arr;
62952 }
62953
62954 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
62955         LDKNodeAnnouncementInfo this_ptr_conv;
62956         this_ptr_conv.inner = untag_ptr(this_ptr);
62957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62959         this_ptr_conv.is_owned = false;
62960         LDKThreeBytes val_ref;
62961         CHECK(val->arr_len == 3);
62962         memcpy(val_ref.data, val->elems, 3); FREE(val);
62963         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
62964 }
62965
62966 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
62967         LDKNodeAnnouncementInfo this_ptr_conv;
62968         this_ptr_conv.inner = untag_ptr(this_ptr);
62969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62971         this_ptr_conv.is_owned = false;
62972         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
62973         uint64_t ret_ref = 0;
62974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62976         return ret_ref;
62977 }
62978
62979 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
62980         LDKNodeAnnouncementInfo this_ptr_conv;
62981         this_ptr_conv.inner = untag_ptr(this_ptr);
62982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62984         this_ptr_conv.is_owned = false;
62985         LDKNodeAlias val_conv;
62986         val_conv.inner = untag_ptr(val);
62987         val_conv.is_owned = ptr_is_owned(val);
62988         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62989         val_conv = NodeAlias_clone(&val_conv);
62990         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
62991 }
62992
62993 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
62994         LDKNodeAnnouncementInfo this_ptr_conv;
62995         this_ptr_conv.inner = untag_ptr(this_ptr);
62996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62998         this_ptr_conv.is_owned = false;
62999         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
63000         uint64_t ret_ref = 0;
63001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63003         return ret_ref;
63004 }
63005
63006 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
63007         LDKNodeAnnouncementInfo this_ptr_conv;
63008         this_ptr_conv.inner = untag_ptr(this_ptr);
63009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63011         this_ptr_conv.is_owned = false;
63012         LDKNodeAnnouncement val_conv;
63013         val_conv.inner = untag_ptr(val);
63014         val_conv.is_owned = ptr_is_owned(val);
63015         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63016         val_conv = NodeAnnouncement_clone(&val_conv);
63017         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
63018 }
63019
63020 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) {
63021         LDKNodeFeatures features_arg_conv;
63022         features_arg_conv.inner = untag_ptr(features_arg);
63023         features_arg_conv.is_owned = ptr_is_owned(features_arg);
63024         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
63025         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
63026         LDKThreeBytes rgb_arg_ref;
63027         CHECK(rgb_arg->arr_len == 3);
63028         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
63029         LDKNodeAlias alias_arg_conv;
63030         alias_arg_conv.inner = untag_ptr(alias_arg);
63031         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
63032         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
63033         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
63034         LDKNodeAnnouncement announcement_message_arg_conv;
63035         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
63036         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
63037         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
63038         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
63039         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
63040         uint64_t ret_ref = 0;
63041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63043         return ret_ref;
63044 }
63045
63046 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
63047         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
63048         uint64_t ret_ref = 0;
63049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63051         return ret_ref;
63052 }
63053 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
63054         LDKNodeAnnouncementInfo arg_conv;
63055         arg_conv.inner = untag_ptr(arg);
63056         arg_conv.is_owned = ptr_is_owned(arg);
63057         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63058         arg_conv.is_owned = false;
63059         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
63060         return ret_conv;
63061 }
63062
63063 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
63064         LDKNodeAnnouncementInfo orig_conv;
63065         orig_conv.inner = untag_ptr(orig);
63066         orig_conv.is_owned = ptr_is_owned(orig);
63067         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63068         orig_conv.is_owned = false;
63069         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
63070         uint64_t ret_ref = 0;
63071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63073         return ret_ref;
63074 }
63075
63076 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
63077         LDKNodeAnnouncementInfo a_conv;
63078         a_conv.inner = untag_ptr(a);
63079         a_conv.is_owned = ptr_is_owned(a);
63080         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63081         a_conv.is_owned = false;
63082         LDKNodeAnnouncementInfo b_conv;
63083         b_conv.inner = untag_ptr(b);
63084         b_conv.is_owned = ptr_is_owned(b);
63085         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63086         b_conv.is_owned = false;
63087         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
63088         return ret_conv;
63089 }
63090
63091 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_addresses"))) TS_NodeAnnouncementInfo_addresses(uint64_t this_arg) {
63092         LDKNodeAnnouncementInfo this_arg_conv;
63093         this_arg_conv.inner = untag_ptr(this_arg);
63094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63096         this_arg_conv.is_owned = false;
63097         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
63098         uint64_tArray ret_arr = NULL;
63099         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
63100         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
63101         for (size_t p = 0; p < ret_var.datalen; p++) {
63102                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
63103                 *ret_conv_15_copy = ret_var.data[p];
63104                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
63105                 ret_arr_ptr[p] = ret_conv_15_ref;
63106         }
63107         
63108         FREE(ret_var.data);
63109         return ret_arr;
63110 }
63111
63112 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
63113         LDKNodeAnnouncementInfo obj_conv;
63114         obj_conv.inner = untag_ptr(obj);
63115         obj_conv.is_owned = ptr_is_owned(obj);
63116         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63117         obj_conv.is_owned = false;
63118         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
63119         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63120         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63121         CVec_u8Z_free(ret_var);
63122         return ret_arr;
63123 }
63124
63125 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
63126         LDKu8slice ser_ref;
63127         ser_ref.datalen = ser->arr_len;
63128         ser_ref.data = ser->elems;
63129         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
63130         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
63131         FREE(ser);
63132         return tag_ptr(ret_conv, true);
63133 }
63134
63135 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
63136         LDKNodeAlias this_obj_conv;
63137         this_obj_conv.inner = untag_ptr(this_obj);
63138         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63140         NodeAlias_free(this_obj_conv);
63141 }
63142
63143 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
63144         LDKNodeAlias this_ptr_conv;
63145         this_ptr_conv.inner = untag_ptr(this_ptr);
63146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63148         this_ptr_conv.is_owned = false;
63149         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63150         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
63151         return ret_arr;
63152 }
63153
63154 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
63155         LDKNodeAlias this_ptr_conv;
63156         this_ptr_conv.inner = untag_ptr(this_ptr);
63157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63159         this_ptr_conv.is_owned = false;
63160         LDKThirtyTwoBytes val_ref;
63161         CHECK(val->arr_len == 32);
63162         memcpy(val_ref.data, val->elems, 32); FREE(val);
63163         NodeAlias_set_a(&this_ptr_conv, val_ref);
63164 }
63165
63166 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
63167         LDKThirtyTwoBytes a_arg_ref;
63168         CHECK(a_arg->arr_len == 32);
63169         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
63170         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
63171         uint64_t ret_ref = 0;
63172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63174         return ret_ref;
63175 }
63176
63177 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
63178         LDKNodeAlias ret_var = NodeAlias_clone(arg);
63179         uint64_t ret_ref = 0;
63180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63182         return ret_ref;
63183 }
63184 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
63185         LDKNodeAlias arg_conv;
63186         arg_conv.inner = untag_ptr(arg);
63187         arg_conv.is_owned = ptr_is_owned(arg);
63188         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63189         arg_conv.is_owned = false;
63190         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
63191         return ret_conv;
63192 }
63193
63194 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
63195         LDKNodeAlias orig_conv;
63196         orig_conv.inner = untag_ptr(orig);
63197         orig_conv.is_owned = ptr_is_owned(orig);
63198         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63199         orig_conv.is_owned = false;
63200         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
63201         uint64_t ret_ref = 0;
63202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63204         return ret_ref;
63205 }
63206
63207 int64_t  __attribute__((export_name("TS_NodeAlias_hash"))) TS_NodeAlias_hash(uint64_t o) {
63208         LDKNodeAlias o_conv;
63209         o_conv.inner = untag_ptr(o);
63210         o_conv.is_owned = ptr_is_owned(o);
63211         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63212         o_conv.is_owned = false;
63213         int64_t ret_conv = NodeAlias_hash(&o_conv);
63214         return ret_conv;
63215 }
63216
63217 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
63218         LDKNodeAlias a_conv;
63219         a_conv.inner = untag_ptr(a);
63220         a_conv.is_owned = ptr_is_owned(a);
63221         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63222         a_conv.is_owned = false;
63223         LDKNodeAlias b_conv;
63224         b_conv.inner = untag_ptr(b);
63225         b_conv.is_owned = ptr_is_owned(b);
63226         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63227         b_conv.is_owned = false;
63228         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
63229         return ret_conv;
63230 }
63231
63232 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
63233         LDKNodeAlias obj_conv;
63234         obj_conv.inner = untag_ptr(obj);
63235         obj_conv.is_owned = ptr_is_owned(obj);
63236         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63237         obj_conv.is_owned = false;
63238         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
63239         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63240         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63241         CVec_u8Z_free(ret_var);
63242         return ret_arr;
63243 }
63244
63245 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
63246         LDKu8slice ser_ref;
63247         ser_ref.datalen = ser->arr_len;
63248         ser_ref.data = ser->elems;
63249         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
63250         *ret_conv = NodeAlias_read(ser_ref);
63251         FREE(ser);
63252         return tag_ptr(ret_conv, true);
63253 }
63254
63255 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
63256         LDKNodeInfo this_obj_conv;
63257         this_obj_conv.inner = untag_ptr(this_obj);
63258         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63260         NodeInfo_free(this_obj_conv);
63261 }
63262
63263 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
63264         LDKNodeInfo this_ptr_conv;
63265         this_ptr_conv.inner = untag_ptr(this_ptr);
63266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63268         this_ptr_conv.is_owned = false;
63269         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
63270         int64_tArray ret_arr = NULL;
63271         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
63272         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
63273         for (size_t i = 0; i < ret_var.datalen; i++) {
63274                 int64_t ret_conv_8_conv = ret_var.data[i];
63275                 ret_arr_ptr[i] = ret_conv_8_conv;
63276         }
63277         
63278         FREE(ret_var.data);
63279         return ret_arr;
63280 }
63281
63282 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
63283         LDKNodeInfo this_ptr_conv;
63284         this_ptr_conv.inner = untag_ptr(this_ptr);
63285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63287         this_ptr_conv.is_owned = false;
63288         LDKCVec_u64Z val_constr;
63289         val_constr.datalen = val->arr_len;
63290         if (val_constr.datalen > 0)
63291                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
63292         else
63293                 val_constr.data = NULL;
63294         int64_t* val_vals = val->elems;
63295         for (size_t i = 0; i < val_constr.datalen; i++) {
63296                 int64_t val_conv_8 = val_vals[i];
63297                 val_constr.data[i] = val_conv_8;
63298         }
63299         FREE(val);
63300         NodeInfo_set_channels(&this_ptr_conv, val_constr);
63301 }
63302
63303 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
63304         LDKNodeInfo this_ptr_conv;
63305         this_ptr_conv.inner = untag_ptr(this_ptr);
63306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63308         this_ptr_conv.is_owned = false;
63309         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
63310         uint64_t ret_ref = 0;
63311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63313         return ret_ref;
63314 }
63315
63316 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
63317         LDKNodeInfo this_ptr_conv;
63318         this_ptr_conv.inner = untag_ptr(this_ptr);
63319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63321         this_ptr_conv.is_owned = false;
63322         LDKNodeAnnouncementInfo val_conv;
63323         val_conv.inner = untag_ptr(val);
63324         val_conv.is_owned = ptr_is_owned(val);
63325         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63326         val_conv = NodeAnnouncementInfo_clone(&val_conv);
63327         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
63328 }
63329
63330 uint64_t  __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t announcement_info_arg) {
63331         LDKCVec_u64Z channels_arg_constr;
63332         channels_arg_constr.datalen = channels_arg->arr_len;
63333         if (channels_arg_constr.datalen > 0)
63334                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
63335         else
63336                 channels_arg_constr.data = NULL;
63337         int64_t* channels_arg_vals = channels_arg->elems;
63338         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
63339                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
63340                 channels_arg_constr.data[i] = channels_arg_conv_8;
63341         }
63342         FREE(channels_arg);
63343         LDKNodeAnnouncementInfo announcement_info_arg_conv;
63344         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
63345         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
63346         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
63347         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
63348         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
63349         uint64_t ret_ref = 0;
63350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63352         return ret_ref;
63353 }
63354
63355 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
63356         LDKNodeInfo ret_var = NodeInfo_clone(arg);
63357         uint64_t ret_ref = 0;
63358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63360         return ret_ref;
63361 }
63362 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
63363         LDKNodeInfo arg_conv;
63364         arg_conv.inner = untag_ptr(arg);
63365         arg_conv.is_owned = ptr_is_owned(arg);
63366         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63367         arg_conv.is_owned = false;
63368         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
63369         return ret_conv;
63370 }
63371
63372 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
63373         LDKNodeInfo orig_conv;
63374         orig_conv.inner = untag_ptr(orig);
63375         orig_conv.is_owned = ptr_is_owned(orig);
63376         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63377         orig_conv.is_owned = false;
63378         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
63379         uint64_t ret_ref = 0;
63380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63382         return ret_ref;
63383 }
63384
63385 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
63386         LDKNodeInfo a_conv;
63387         a_conv.inner = untag_ptr(a);
63388         a_conv.is_owned = ptr_is_owned(a);
63389         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63390         a_conv.is_owned = false;
63391         LDKNodeInfo b_conv;
63392         b_conv.inner = untag_ptr(b);
63393         b_conv.is_owned = ptr_is_owned(b);
63394         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63395         b_conv.is_owned = false;
63396         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
63397         return ret_conv;
63398 }
63399
63400 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
63401         LDKNodeInfo obj_conv;
63402         obj_conv.inner = untag_ptr(obj);
63403         obj_conv.is_owned = ptr_is_owned(obj);
63404         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63405         obj_conv.is_owned = false;
63406         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
63407         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63408         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63409         CVec_u8Z_free(ret_var);
63410         return ret_arr;
63411 }
63412
63413 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
63414         LDKu8slice ser_ref;
63415         ser_ref.datalen = ser->arr_len;
63416         ser_ref.data = ser->elems;
63417         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
63418         *ret_conv = NodeInfo_read(ser_ref);
63419         FREE(ser);
63420         return tag_ptr(ret_conv, true);
63421 }
63422
63423 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
63424         LDKNetworkGraph obj_conv;
63425         obj_conv.inner = untag_ptr(obj);
63426         obj_conv.is_owned = ptr_is_owned(obj);
63427         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63428         obj_conv.is_owned = false;
63429         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
63430         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63431         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63432         CVec_u8Z_free(ret_var);
63433         return ret_arr;
63434 }
63435
63436 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
63437         LDKu8slice ser_ref;
63438         ser_ref.datalen = ser->arr_len;
63439         ser_ref.data = ser->elems;
63440         void* arg_ptr = untag_ptr(arg);
63441         CHECK_ACCESS(arg_ptr);
63442         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
63443         if (arg_conv.free == LDKLogger_JCalls_free) {
63444                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63445                 LDKLogger_JCalls_cloned(&arg_conv);
63446         }
63447         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
63448         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
63449         FREE(ser);
63450         return tag_ptr(ret_conv, true);
63451 }
63452
63453 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(uint32_t network, uint64_t logger) {
63454         LDKNetwork network_conv = LDKNetwork_from_js(network);
63455         void* logger_ptr = untag_ptr(logger);
63456         CHECK_ACCESS(logger_ptr);
63457         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
63458         if (logger_conv.free == LDKLogger_JCalls_free) {
63459                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63460                 LDKLogger_JCalls_cloned(&logger_conv);
63461         }
63462         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
63463         uint64_t ret_ref = 0;
63464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63466         return ret_ref;
63467 }
63468
63469 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
63470         LDKNetworkGraph this_arg_conv;
63471         this_arg_conv.inner = untag_ptr(this_arg);
63472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63474         this_arg_conv.is_owned = false;
63475         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
63476         uint64_t ret_ref = 0;
63477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63479         return ret_ref;
63480 }
63481
63482 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) {
63483         LDKNetworkGraph this_arg_conv;
63484         this_arg_conv.inner = untag_ptr(this_arg);
63485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63487         this_arg_conv.is_owned = false;
63488         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
63489         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
63490         uint64_t ret_ref = tag_ptr(ret_copy, true);
63491         return ret_ref;
63492 }
63493
63494 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) {
63495         LDKNetworkGraph this_arg_conv;
63496         this_arg_conv.inner = untag_ptr(this_arg);
63497         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63499         this_arg_conv.is_owned = false;
63500         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
63501 }
63502
63503 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
63504         LDKNetworkGraph this_arg_conv;
63505         this_arg_conv.inner = untag_ptr(this_arg);
63506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63508         this_arg_conv.is_owned = false;
63509         LDKNodeAnnouncement msg_conv;
63510         msg_conv.inner = untag_ptr(msg);
63511         msg_conv.is_owned = ptr_is_owned(msg);
63512         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63513         msg_conv.is_owned = false;
63514         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63515         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
63516         return tag_ptr(ret_conv, true);
63517 }
63518
63519 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) {
63520         LDKNetworkGraph this_arg_conv;
63521         this_arg_conv.inner = untag_ptr(this_arg);
63522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63524         this_arg_conv.is_owned = false;
63525         LDKUnsignedNodeAnnouncement msg_conv;
63526         msg_conv.inner = untag_ptr(msg);
63527         msg_conv.is_owned = ptr_is_owned(msg);
63528         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63529         msg_conv.is_owned = false;
63530         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63531         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
63532         return tag_ptr(ret_conv, true);
63533 }
63534
63535 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) {
63536         LDKNetworkGraph this_arg_conv;
63537         this_arg_conv.inner = untag_ptr(this_arg);
63538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63540         this_arg_conv.is_owned = false;
63541         LDKChannelAnnouncement msg_conv;
63542         msg_conv.inner = untag_ptr(msg);
63543         msg_conv.is_owned = ptr_is_owned(msg);
63544         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63545         msg_conv.is_owned = false;
63546         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
63547         CHECK_ACCESS(utxo_lookup_ptr);
63548         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
63549         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
63550         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
63551                 // Manually implement clone for Java trait instances
63552                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
63553                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63554                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
63555                 }
63556         }
63557         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63558         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
63559         return tag_ptr(ret_conv, true);
63560 }
63561
63562 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) {
63563         LDKNetworkGraph this_arg_conv;
63564         this_arg_conv.inner = untag_ptr(this_arg);
63565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63567         this_arg_conv.is_owned = false;
63568         LDKChannelAnnouncement msg_conv;
63569         msg_conv.inner = untag_ptr(msg);
63570         msg_conv.is_owned = ptr_is_owned(msg);
63571         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63572         msg_conv.is_owned = false;
63573         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63574         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
63575         return tag_ptr(ret_conv, true);
63576 }
63577
63578 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) {
63579         LDKNetworkGraph this_arg_conv;
63580         this_arg_conv.inner = untag_ptr(this_arg);
63581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63583         this_arg_conv.is_owned = false;
63584         LDKUnsignedChannelAnnouncement msg_conv;
63585         msg_conv.inner = untag_ptr(msg);
63586         msg_conv.is_owned = ptr_is_owned(msg);
63587         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63588         msg_conv.is_owned = false;
63589         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
63590         CHECK_ACCESS(utxo_lookup_ptr);
63591         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
63592         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
63593         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
63594                 // Manually implement clone for Java trait instances
63595                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
63596                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63597                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
63598                 }
63599         }
63600         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63601         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
63602         return tag_ptr(ret_conv, true);
63603 }
63604
63605 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) {
63606         LDKNetworkGraph this_arg_conv;
63607         this_arg_conv.inner = untag_ptr(this_arg);
63608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63610         this_arg_conv.is_owned = false;
63611         LDKChannelFeatures features_conv;
63612         features_conv.inner = untag_ptr(features);
63613         features_conv.is_owned = ptr_is_owned(features);
63614         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
63615         features_conv = ChannelFeatures_clone(&features_conv);
63616         LDKPublicKey node_id_1_ref;
63617         CHECK(node_id_1->arr_len == 33);
63618         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
63619         LDKPublicKey node_id_2_ref;
63620         CHECK(node_id_2->arr_len == 33);
63621         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
63622         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63623         *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);
63624         return tag_ptr(ret_conv, true);
63625 }
63626
63627 void  __attribute__((export_name("TS_NetworkGraph_channel_failed_permanent"))) TS_NetworkGraph_channel_failed_permanent(uint64_t this_arg, int64_t short_channel_id) {
63628         LDKNetworkGraph this_arg_conv;
63629         this_arg_conv.inner = untag_ptr(this_arg);
63630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63632         this_arg_conv.is_owned = false;
63633         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
63634 }
63635
63636 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
63637         LDKNetworkGraph this_arg_conv;
63638         this_arg_conv.inner = untag_ptr(this_arg);
63639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63641         this_arg_conv.is_owned = false;
63642         LDKPublicKey node_id_ref;
63643         CHECK(node_id->arr_len == 33);
63644         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
63645         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
63646 }
63647
63648 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) {
63649         LDKNetworkGraph this_arg_conv;
63650         this_arg_conv.inner = untag_ptr(this_arg);
63651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63653         this_arg_conv.is_owned = false;
63654         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
63655 }
63656
63657 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
63658         LDKNetworkGraph this_arg_conv;
63659         this_arg_conv.inner = untag_ptr(this_arg);
63660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63662         this_arg_conv.is_owned = false;
63663         LDKChannelUpdate msg_conv;
63664         msg_conv.inner = untag_ptr(msg);
63665         msg_conv.is_owned = ptr_is_owned(msg);
63666         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63667         msg_conv.is_owned = false;
63668         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63669         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
63670         return tag_ptr(ret_conv, true);
63671 }
63672
63673 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
63674         LDKNetworkGraph this_arg_conv;
63675         this_arg_conv.inner = untag_ptr(this_arg);
63676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63678         this_arg_conv.is_owned = false;
63679         LDKUnsignedChannelUpdate msg_conv;
63680         msg_conv.inner = untag_ptr(msg);
63681         msg_conv.is_owned = ptr_is_owned(msg);
63682         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63683         msg_conv.is_owned = false;
63684         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63685         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
63686         return tag_ptr(ret_conv, true);
63687 }
63688
63689 uint64_t  __attribute__((export_name("TS_NetworkGraph_verify_channel_update"))) TS_NetworkGraph_verify_channel_update(uint64_t this_arg, uint64_t msg) {
63690         LDKNetworkGraph this_arg_conv;
63691         this_arg_conv.inner = untag_ptr(this_arg);
63692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63694         this_arg_conv.is_owned = false;
63695         LDKChannelUpdate msg_conv;
63696         msg_conv.inner = untag_ptr(msg);
63697         msg_conv.is_owned = ptr_is_owned(msg);
63698         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63699         msg_conv.is_owned = false;
63700         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63701         *ret_conv = NetworkGraph_verify_channel_update(&this_arg_conv, &msg_conv);
63702         return tag_ptr(ret_conv, true);
63703 }
63704
63705 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
63706         LDKReadOnlyNetworkGraph this_arg_conv;
63707         this_arg_conv.inner = untag_ptr(this_arg);
63708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63710         this_arg_conv.is_owned = false;
63711         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
63712         uint64_t ret_ref = 0;
63713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63715         return ret_ref;
63716 }
63717
63718 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
63719         LDKReadOnlyNetworkGraph this_arg_conv;
63720         this_arg_conv.inner = untag_ptr(this_arg);
63721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63723         this_arg_conv.is_owned = false;
63724         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
63725         int64_tArray ret_arr = NULL;
63726         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
63727         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
63728         for (size_t i = 0; i < ret_var.datalen; i++) {
63729                 int64_t ret_conv_8_conv = ret_var.data[i];
63730                 ret_arr_ptr[i] = ret_conv_8_conv;
63731         }
63732         
63733         FREE(ret_var.data);
63734         return ret_arr;
63735 }
63736
63737 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
63738         LDKReadOnlyNetworkGraph this_arg_conv;
63739         this_arg_conv.inner = untag_ptr(this_arg);
63740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63742         this_arg_conv.is_owned = false;
63743         LDKNodeId node_id_conv;
63744         node_id_conv.inner = untag_ptr(node_id);
63745         node_id_conv.is_owned = ptr_is_owned(node_id);
63746         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
63747         node_id_conv.is_owned = false;
63748         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
63749         uint64_t ret_ref = 0;
63750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63752         return ret_ref;
63753 }
63754
63755 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
63756         LDKReadOnlyNetworkGraph this_arg_conv;
63757         this_arg_conv.inner = untag_ptr(this_arg);
63758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63760         this_arg_conv.is_owned = false;
63761         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
63762         uint64_tArray ret_arr = NULL;
63763         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
63764         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
63765         for (size_t i = 0; i < ret_var.datalen; i++) {
63766                 LDKNodeId ret_conv_8_var = ret_var.data[i];
63767                 uint64_t ret_conv_8_ref = 0;
63768                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
63769                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
63770                 ret_arr_ptr[i] = ret_conv_8_ref;
63771         }
63772         
63773         FREE(ret_var.data);
63774         return ret_arr;
63775 }
63776
63777 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
63778         LDKReadOnlyNetworkGraph this_arg_conv;
63779         this_arg_conv.inner = untag_ptr(this_arg);
63780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63782         this_arg_conv.is_owned = false;
63783         LDKPublicKey pubkey_ref;
63784         CHECK(pubkey->arr_len == 33);
63785         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
63786         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
63787         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
63788         uint64_t ret_ref = tag_ptr(ret_copy, true);
63789         return ret_ref;
63790 }
63791
63792 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
63793         LDKDefaultRouter this_obj_conv;
63794         this_obj_conv.inner = untag_ptr(this_obj);
63795         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63797         DefaultRouter_free(this_obj_conv);
63798 }
63799
63800 uint64_t  __attribute__((export_name("TS_DefaultRouter_new"))) TS_DefaultRouter_new(uint64_t network_graph, uint64_t logger, uint64_t entropy_source, uint64_t scorer, uint64_t score_params) {
63801         LDKNetworkGraph network_graph_conv;
63802         network_graph_conv.inner = untag_ptr(network_graph);
63803         network_graph_conv.is_owned = ptr_is_owned(network_graph);
63804         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
63805         network_graph_conv.is_owned = false;
63806         void* logger_ptr = untag_ptr(logger);
63807         CHECK_ACCESS(logger_ptr);
63808         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
63809         if (logger_conv.free == LDKLogger_JCalls_free) {
63810                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63811                 LDKLogger_JCalls_cloned(&logger_conv);
63812         }
63813         void* entropy_source_ptr = untag_ptr(entropy_source);
63814         CHECK_ACCESS(entropy_source_ptr);
63815         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
63816         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
63817                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63818                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
63819         }
63820         void* scorer_ptr = untag_ptr(scorer);
63821         CHECK_ACCESS(scorer_ptr);
63822         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
63823         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
63824                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63825                 LDKLockableScore_JCalls_cloned(&scorer_conv);
63826         }
63827         LDKProbabilisticScoringFeeParameters score_params_conv;
63828         score_params_conv.inner = untag_ptr(score_params);
63829         score_params_conv.is_owned = ptr_is_owned(score_params);
63830         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
63831         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
63832         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, entropy_source_conv, scorer_conv, score_params_conv);
63833         uint64_t ret_ref = 0;
63834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63836         return ret_ref;
63837 }
63838
63839 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
63840         LDKDefaultRouter this_arg_conv;
63841         this_arg_conv.inner = untag_ptr(this_arg);
63842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63844         this_arg_conv.is_owned = false;
63845         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
63846         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
63847         return tag_ptr(ret_ret, true);
63848 }
63849
63850 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_MessageRouter"))) TS_DefaultRouter_as_MessageRouter(uint64_t this_arg) {
63851         LDKDefaultRouter this_arg_conv;
63852         this_arg_conv.inner = untag_ptr(this_arg);
63853         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63855         this_arg_conv.is_owned = false;
63856         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
63857         *ret_ret = DefaultRouter_as_MessageRouter(&this_arg_conv);
63858         return tag_ptr(ret_ret, true);
63859 }
63860
63861 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
63862         if (!ptr_is_owned(this_ptr)) return;
63863         void* this_ptr_ptr = untag_ptr(this_ptr);
63864         CHECK_ACCESS(this_ptr_ptr);
63865         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
63866         FREE(untag_ptr(this_ptr));
63867         Router_free(this_ptr_conv);
63868 }
63869
63870 void  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) {
63871         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
63872         this_obj_conv.inner = untag_ptr(this_obj);
63873         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63875         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
63876 }
63877
63878 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) {
63879         void* scorer_ptr = untag_ptr(scorer);
63880         CHECK_ACCESS(scorer_ptr);
63881         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
63882         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
63883                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63884                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
63885         }
63886         LDKInFlightHtlcs inflight_htlcs_conv;
63887         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
63888         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
63889         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
63890         inflight_htlcs_conv.is_owned = false;
63891         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
63892         uint64_t ret_ref = 0;
63893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63895         return ret_ref;
63896 }
63897
63898 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp"))) TS_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(uint64_t this_arg) {
63899         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
63900         this_arg_conv.inner = untag_ptr(this_arg);
63901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63903         this_arg_conv.is_owned = false;
63904         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
63905         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
63906         return tag_ptr(ret_ret, true);
63907 }
63908
63909 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
63910         LDKInFlightHtlcs this_obj_conv;
63911         this_obj_conv.inner = untag_ptr(this_obj);
63912         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63914         InFlightHtlcs_free(this_obj_conv);
63915 }
63916
63917 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
63918         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
63919         uint64_t ret_ref = 0;
63920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63922         return ret_ref;
63923 }
63924 int64_t  __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) {
63925         LDKInFlightHtlcs arg_conv;
63926         arg_conv.inner = untag_ptr(arg);
63927         arg_conv.is_owned = ptr_is_owned(arg);
63928         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63929         arg_conv.is_owned = false;
63930         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
63931         return ret_conv;
63932 }
63933
63934 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) {
63935         LDKInFlightHtlcs orig_conv;
63936         orig_conv.inner = untag_ptr(orig);
63937         orig_conv.is_owned = ptr_is_owned(orig);
63938         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63939         orig_conv.is_owned = false;
63940         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
63941         uint64_t ret_ref = 0;
63942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63944         return ret_ref;
63945 }
63946
63947 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() {
63948         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
63949         uint64_t ret_ref = 0;
63950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63952         return ret_ref;
63953 }
63954
63955 void  __attribute__((export_name("TS_InFlightHtlcs_process_path"))) TS_InFlightHtlcs_process_path(uint64_t this_arg, uint64_t path, int8_tArray payer_node_id) {
63956         LDKInFlightHtlcs this_arg_conv;
63957         this_arg_conv.inner = untag_ptr(this_arg);
63958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63960         this_arg_conv.is_owned = false;
63961         LDKPath path_conv;
63962         path_conv.inner = untag_ptr(path);
63963         path_conv.is_owned = ptr_is_owned(path);
63964         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
63965         path_conv.is_owned = false;
63966         LDKPublicKey payer_node_id_ref;
63967         CHECK(payer_node_id->arr_len == 33);
63968         memcpy(payer_node_id_ref.compressed_form, payer_node_id->elems, 33); FREE(payer_node_id);
63969         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
63970 }
63971
63972 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) {
63973         LDKInFlightHtlcs this_arg_conv;
63974         this_arg_conv.inner = untag_ptr(this_arg);
63975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63977         this_arg_conv.is_owned = false;
63978         LDKNodeId source_conv;
63979         source_conv.inner = untag_ptr(source);
63980         source_conv.is_owned = ptr_is_owned(source);
63981         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
63982         source_conv.is_owned = false;
63983         LDKNodeId target_conv;
63984         target_conv.inner = untag_ptr(target);
63985         target_conv.is_owned = ptr_is_owned(target);
63986         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
63987         target_conv.is_owned = false;
63988         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
63989 }
63990
63991 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) {
63992         LDKInFlightHtlcs this_arg_conv;
63993         this_arg_conv.inner = untag_ptr(this_arg);
63994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63996         this_arg_conv.is_owned = false;
63997         LDKNodeId source_conv;
63998         source_conv.inner = untag_ptr(source);
63999         source_conv.is_owned = ptr_is_owned(source);
64000         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
64001         source_conv.is_owned = false;
64002         LDKNodeId target_conv;
64003         target_conv.inner = untag_ptr(target);
64004         target_conv.is_owned = ptr_is_owned(target);
64005         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
64006         target_conv.is_owned = false;
64007         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64008         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
64009         uint64_t ret_ref = tag_ptr(ret_copy, true);
64010         return ret_ref;
64011 }
64012
64013 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
64014         LDKInFlightHtlcs obj_conv;
64015         obj_conv.inner = untag_ptr(obj);
64016         obj_conv.is_owned = ptr_is_owned(obj);
64017         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64018         obj_conv.is_owned = false;
64019         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
64020         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64021         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64022         CVec_u8Z_free(ret_var);
64023         return ret_arr;
64024 }
64025
64026 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
64027         LDKu8slice ser_ref;
64028         ser_ref.datalen = ser->arr_len;
64029         ser_ref.data = ser->elems;
64030         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
64031         *ret_conv = InFlightHtlcs_read(ser_ref);
64032         FREE(ser);
64033         return tag_ptr(ret_conv, true);
64034 }
64035
64036 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
64037         LDKRouteHop this_obj_conv;
64038         this_obj_conv.inner = untag_ptr(this_obj);
64039         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64041         RouteHop_free(this_obj_conv);
64042 }
64043
64044 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
64045         LDKRouteHop this_ptr_conv;
64046         this_ptr_conv.inner = untag_ptr(this_ptr);
64047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64049         this_ptr_conv.is_owned = false;
64050         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64051         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
64052         return ret_arr;
64053 }
64054
64055 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
64056         LDKRouteHop this_ptr_conv;
64057         this_ptr_conv.inner = untag_ptr(this_ptr);
64058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64060         this_ptr_conv.is_owned = false;
64061         LDKPublicKey val_ref;
64062         CHECK(val->arr_len == 33);
64063         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
64064         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
64065 }
64066
64067 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
64068         LDKRouteHop this_ptr_conv;
64069         this_ptr_conv.inner = untag_ptr(this_ptr);
64070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64072         this_ptr_conv.is_owned = false;
64073         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
64074         uint64_t ret_ref = 0;
64075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64077         return ret_ref;
64078 }
64079
64080 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
64081         LDKRouteHop this_ptr_conv;
64082         this_ptr_conv.inner = untag_ptr(this_ptr);
64083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64085         this_ptr_conv.is_owned = false;
64086         LDKNodeFeatures val_conv;
64087         val_conv.inner = untag_ptr(val);
64088         val_conv.is_owned = ptr_is_owned(val);
64089         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64090         val_conv = NodeFeatures_clone(&val_conv);
64091         RouteHop_set_node_features(&this_ptr_conv, val_conv);
64092 }
64093
64094 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
64095         LDKRouteHop this_ptr_conv;
64096         this_ptr_conv.inner = untag_ptr(this_ptr);
64097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64099         this_ptr_conv.is_owned = false;
64100         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
64101         return ret_conv;
64102 }
64103
64104 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
64105         LDKRouteHop this_ptr_conv;
64106         this_ptr_conv.inner = untag_ptr(this_ptr);
64107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64109         this_ptr_conv.is_owned = false;
64110         RouteHop_set_short_channel_id(&this_ptr_conv, val);
64111 }
64112
64113 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
64114         LDKRouteHop this_ptr_conv;
64115         this_ptr_conv.inner = untag_ptr(this_ptr);
64116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64118         this_ptr_conv.is_owned = false;
64119         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
64120         uint64_t ret_ref = 0;
64121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64123         return ret_ref;
64124 }
64125
64126 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
64127         LDKRouteHop this_ptr_conv;
64128         this_ptr_conv.inner = untag_ptr(this_ptr);
64129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64131         this_ptr_conv.is_owned = false;
64132         LDKChannelFeatures val_conv;
64133         val_conv.inner = untag_ptr(val);
64134         val_conv.is_owned = ptr_is_owned(val);
64135         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64136         val_conv = ChannelFeatures_clone(&val_conv);
64137         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
64138 }
64139
64140 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
64141         LDKRouteHop this_ptr_conv;
64142         this_ptr_conv.inner = untag_ptr(this_ptr);
64143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64145         this_ptr_conv.is_owned = false;
64146         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
64147         return ret_conv;
64148 }
64149
64150 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
64151         LDKRouteHop this_ptr_conv;
64152         this_ptr_conv.inner = untag_ptr(this_ptr);
64153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64155         this_ptr_conv.is_owned = false;
64156         RouteHop_set_fee_msat(&this_ptr_conv, val);
64157 }
64158
64159 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
64160         LDKRouteHop this_ptr_conv;
64161         this_ptr_conv.inner = untag_ptr(this_ptr);
64162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64164         this_ptr_conv.is_owned = false;
64165         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
64166         return ret_conv;
64167 }
64168
64169 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
64170         LDKRouteHop this_ptr_conv;
64171         this_ptr_conv.inner = untag_ptr(this_ptr);
64172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64174         this_ptr_conv.is_owned = false;
64175         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
64176 }
64177
64178 jboolean  __attribute__((export_name("TS_RouteHop_get_maybe_announced_channel"))) TS_RouteHop_get_maybe_announced_channel(uint64_t this_ptr) {
64179         LDKRouteHop this_ptr_conv;
64180         this_ptr_conv.inner = untag_ptr(this_ptr);
64181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64183         this_ptr_conv.is_owned = false;
64184         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
64185         return ret_conv;
64186 }
64187
64188 void  __attribute__((export_name("TS_RouteHop_set_maybe_announced_channel"))) TS_RouteHop_set_maybe_announced_channel(uint64_t this_ptr, jboolean val) {
64189         LDKRouteHop this_ptr_conv;
64190         this_ptr_conv.inner = untag_ptr(this_ptr);
64191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64193         this_ptr_conv.is_owned = false;
64194         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
64195 }
64196
64197 uint64_t  __attribute__((export_name("TS_RouteHop_new"))) TS_RouteHop_new(int8_tArray pubkey_arg, uint64_t node_features_arg, int64_t short_channel_id_arg, uint64_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg, jboolean maybe_announced_channel_arg) {
64198         LDKPublicKey pubkey_arg_ref;
64199         CHECK(pubkey_arg->arr_len == 33);
64200         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
64201         LDKNodeFeatures node_features_arg_conv;
64202         node_features_arg_conv.inner = untag_ptr(node_features_arg);
64203         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
64204         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
64205         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
64206         LDKChannelFeatures channel_features_arg_conv;
64207         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
64208         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
64209         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
64210         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
64211         LDKRouteHop ret_var = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg, maybe_announced_channel_arg);
64212         uint64_t ret_ref = 0;
64213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64215         return ret_ref;
64216 }
64217
64218 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
64219         LDKRouteHop ret_var = RouteHop_clone(arg);
64220         uint64_t ret_ref = 0;
64221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64223         return ret_ref;
64224 }
64225 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
64226         LDKRouteHop arg_conv;
64227         arg_conv.inner = untag_ptr(arg);
64228         arg_conv.is_owned = ptr_is_owned(arg);
64229         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64230         arg_conv.is_owned = false;
64231         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
64232         return ret_conv;
64233 }
64234
64235 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
64236         LDKRouteHop orig_conv;
64237         orig_conv.inner = untag_ptr(orig);
64238         orig_conv.is_owned = ptr_is_owned(orig);
64239         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64240         orig_conv.is_owned = false;
64241         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
64242         uint64_t ret_ref = 0;
64243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64245         return ret_ref;
64246 }
64247
64248 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
64249         LDKRouteHop o_conv;
64250         o_conv.inner = untag_ptr(o);
64251         o_conv.is_owned = ptr_is_owned(o);
64252         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64253         o_conv.is_owned = false;
64254         int64_t ret_conv = RouteHop_hash(&o_conv);
64255         return ret_conv;
64256 }
64257
64258 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
64259         LDKRouteHop a_conv;
64260         a_conv.inner = untag_ptr(a);
64261         a_conv.is_owned = ptr_is_owned(a);
64262         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64263         a_conv.is_owned = false;
64264         LDKRouteHop b_conv;
64265         b_conv.inner = untag_ptr(b);
64266         b_conv.is_owned = ptr_is_owned(b);
64267         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64268         b_conv.is_owned = false;
64269         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
64270         return ret_conv;
64271 }
64272
64273 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
64274         LDKRouteHop obj_conv;
64275         obj_conv.inner = untag_ptr(obj);
64276         obj_conv.is_owned = ptr_is_owned(obj);
64277         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64278         obj_conv.is_owned = false;
64279         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
64280         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64281         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64282         CVec_u8Z_free(ret_var);
64283         return ret_arr;
64284 }
64285
64286 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
64287         LDKu8slice ser_ref;
64288         ser_ref.datalen = ser->arr_len;
64289         ser_ref.data = ser->elems;
64290         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
64291         *ret_conv = RouteHop_read(ser_ref);
64292         FREE(ser);
64293         return tag_ptr(ret_conv, true);
64294 }
64295
64296 void  __attribute__((export_name("TS_BlindedTail_free"))) TS_BlindedTail_free(uint64_t this_obj) {
64297         LDKBlindedTail this_obj_conv;
64298         this_obj_conv.inner = untag_ptr(this_obj);
64299         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64301         BlindedTail_free(this_obj_conv);
64302 }
64303
64304 uint64_tArray  __attribute__((export_name("TS_BlindedTail_get_hops"))) TS_BlindedTail_get_hops(uint64_t this_ptr) {
64305         LDKBlindedTail this_ptr_conv;
64306         this_ptr_conv.inner = untag_ptr(this_ptr);
64307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64309         this_ptr_conv.is_owned = false;
64310         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
64311         uint64_tArray ret_arr = NULL;
64312         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
64313         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
64314         for (size_t m = 0; m < ret_var.datalen; m++) {
64315                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
64316                 uint64_t ret_conv_12_ref = 0;
64317                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
64318                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
64319                 ret_arr_ptr[m] = ret_conv_12_ref;
64320         }
64321         
64322         FREE(ret_var.data);
64323         return ret_arr;
64324 }
64325
64326 void  __attribute__((export_name("TS_BlindedTail_set_hops"))) TS_BlindedTail_set_hops(uint64_t this_ptr, uint64_tArray val) {
64327         LDKBlindedTail this_ptr_conv;
64328         this_ptr_conv.inner = untag_ptr(this_ptr);
64329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64331         this_ptr_conv.is_owned = false;
64332         LDKCVec_BlindedHopZ val_constr;
64333         val_constr.datalen = val->arr_len;
64334         if (val_constr.datalen > 0)
64335                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
64336         else
64337                 val_constr.data = NULL;
64338         uint64_t* val_vals = val->elems;
64339         for (size_t m = 0; m < val_constr.datalen; m++) {
64340                 uint64_t val_conv_12 = val_vals[m];
64341                 LDKBlindedHop val_conv_12_conv;
64342                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
64343                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
64344                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
64345                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
64346                 val_constr.data[m] = val_conv_12_conv;
64347         }
64348         FREE(val);
64349         BlindedTail_set_hops(&this_ptr_conv, val_constr);
64350 }
64351
64352 int8_tArray  __attribute__((export_name("TS_BlindedTail_get_blinding_point"))) TS_BlindedTail_get_blinding_point(uint64_t this_ptr) {
64353         LDKBlindedTail this_ptr_conv;
64354         this_ptr_conv.inner = untag_ptr(this_ptr);
64355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64357         this_ptr_conv.is_owned = false;
64358         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64359         memcpy(ret_arr->elems, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form, 33);
64360         return ret_arr;
64361 }
64362
64363 void  __attribute__((export_name("TS_BlindedTail_set_blinding_point"))) TS_BlindedTail_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
64364         LDKBlindedTail this_ptr_conv;
64365         this_ptr_conv.inner = untag_ptr(this_ptr);
64366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64368         this_ptr_conv.is_owned = false;
64369         LDKPublicKey val_ref;
64370         CHECK(val->arr_len == 33);
64371         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
64372         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
64373 }
64374
64375 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) {
64376         LDKBlindedTail this_ptr_conv;
64377         this_ptr_conv.inner = untag_ptr(this_ptr);
64378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64380         this_ptr_conv.is_owned = false;
64381         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
64382         return ret_conv;
64383 }
64384
64385 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) {
64386         LDKBlindedTail this_ptr_conv;
64387         this_ptr_conv.inner = untag_ptr(this_ptr);
64388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64390         this_ptr_conv.is_owned = false;
64391         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
64392 }
64393
64394 int64_t  __attribute__((export_name("TS_BlindedTail_get_final_value_msat"))) TS_BlindedTail_get_final_value_msat(uint64_t this_ptr) {
64395         LDKBlindedTail this_ptr_conv;
64396         this_ptr_conv.inner = untag_ptr(this_ptr);
64397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64399         this_ptr_conv.is_owned = false;
64400         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
64401         return ret_conv;
64402 }
64403
64404 void  __attribute__((export_name("TS_BlindedTail_set_final_value_msat"))) TS_BlindedTail_set_final_value_msat(uint64_t this_ptr, int64_t val) {
64405         LDKBlindedTail this_ptr_conv;
64406         this_ptr_conv.inner = untag_ptr(this_ptr);
64407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64409         this_ptr_conv.is_owned = false;
64410         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
64411 }
64412
64413 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) {
64414         LDKCVec_BlindedHopZ hops_arg_constr;
64415         hops_arg_constr.datalen = hops_arg->arr_len;
64416         if (hops_arg_constr.datalen > 0)
64417                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
64418         else
64419                 hops_arg_constr.data = NULL;
64420         uint64_t* hops_arg_vals = hops_arg->elems;
64421         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
64422                 uint64_t hops_arg_conv_12 = hops_arg_vals[m];
64423                 LDKBlindedHop hops_arg_conv_12_conv;
64424                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
64425                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
64426                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
64427                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
64428                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
64429         }
64430         FREE(hops_arg);
64431         LDKPublicKey blinding_point_arg_ref;
64432         CHECK(blinding_point_arg->arr_len == 33);
64433         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
64434         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
64435         uint64_t ret_ref = 0;
64436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64438         return ret_ref;
64439 }
64440
64441 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
64442         LDKBlindedTail ret_var = BlindedTail_clone(arg);
64443         uint64_t ret_ref = 0;
64444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64446         return ret_ref;
64447 }
64448 int64_t  __attribute__((export_name("TS_BlindedTail_clone_ptr"))) TS_BlindedTail_clone_ptr(uint64_t arg) {
64449         LDKBlindedTail arg_conv;
64450         arg_conv.inner = untag_ptr(arg);
64451         arg_conv.is_owned = ptr_is_owned(arg);
64452         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64453         arg_conv.is_owned = false;
64454         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
64455         return ret_conv;
64456 }
64457
64458 uint64_t  __attribute__((export_name("TS_BlindedTail_clone"))) TS_BlindedTail_clone(uint64_t orig) {
64459         LDKBlindedTail orig_conv;
64460         orig_conv.inner = untag_ptr(orig);
64461         orig_conv.is_owned = ptr_is_owned(orig);
64462         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64463         orig_conv.is_owned = false;
64464         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
64465         uint64_t ret_ref = 0;
64466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64468         return ret_ref;
64469 }
64470
64471 int64_t  __attribute__((export_name("TS_BlindedTail_hash"))) TS_BlindedTail_hash(uint64_t o) {
64472         LDKBlindedTail o_conv;
64473         o_conv.inner = untag_ptr(o);
64474         o_conv.is_owned = ptr_is_owned(o);
64475         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64476         o_conv.is_owned = false;
64477         int64_t ret_conv = BlindedTail_hash(&o_conv);
64478         return ret_conv;
64479 }
64480
64481 jboolean  __attribute__((export_name("TS_BlindedTail_eq"))) TS_BlindedTail_eq(uint64_t a, uint64_t b) {
64482         LDKBlindedTail a_conv;
64483         a_conv.inner = untag_ptr(a);
64484         a_conv.is_owned = ptr_is_owned(a);
64485         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64486         a_conv.is_owned = false;
64487         LDKBlindedTail b_conv;
64488         b_conv.inner = untag_ptr(b);
64489         b_conv.is_owned = ptr_is_owned(b);
64490         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64491         b_conv.is_owned = false;
64492         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
64493         return ret_conv;
64494 }
64495
64496 int8_tArray  __attribute__((export_name("TS_BlindedTail_write"))) TS_BlindedTail_write(uint64_t obj) {
64497         LDKBlindedTail obj_conv;
64498         obj_conv.inner = untag_ptr(obj);
64499         obj_conv.is_owned = ptr_is_owned(obj);
64500         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64501         obj_conv.is_owned = false;
64502         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
64503         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64504         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64505         CVec_u8Z_free(ret_var);
64506         return ret_arr;
64507 }
64508
64509 uint64_t  __attribute__((export_name("TS_BlindedTail_read"))) TS_BlindedTail_read(int8_tArray ser) {
64510         LDKu8slice ser_ref;
64511         ser_ref.datalen = ser->arr_len;
64512         ser_ref.data = ser->elems;
64513         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
64514         *ret_conv = BlindedTail_read(ser_ref);
64515         FREE(ser);
64516         return tag_ptr(ret_conv, true);
64517 }
64518
64519 void  __attribute__((export_name("TS_Path_free"))) TS_Path_free(uint64_t this_obj) {
64520         LDKPath this_obj_conv;
64521         this_obj_conv.inner = untag_ptr(this_obj);
64522         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64524         Path_free(this_obj_conv);
64525 }
64526
64527 uint64_tArray  __attribute__((export_name("TS_Path_get_hops"))) TS_Path_get_hops(uint64_t this_ptr) {
64528         LDKPath this_ptr_conv;
64529         this_ptr_conv.inner = untag_ptr(this_ptr);
64530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64532         this_ptr_conv.is_owned = false;
64533         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
64534         uint64_tArray ret_arr = NULL;
64535         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
64536         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
64537         for (size_t k = 0; k < ret_var.datalen; k++) {
64538                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
64539                 uint64_t ret_conv_10_ref = 0;
64540                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
64541                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
64542                 ret_arr_ptr[k] = ret_conv_10_ref;
64543         }
64544         
64545         FREE(ret_var.data);
64546         return ret_arr;
64547 }
64548
64549 void  __attribute__((export_name("TS_Path_set_hops"))) TS_Path_set_hops(uint64_t this_ptr, uint64_tArray val) {
64550         LDKPath this_ptr_conv;
64551         this_ptr_conv.inner = untag_ptr(this_ptr);
64552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64554         this_ptr_conv.is_owned = false;
64555         LDKCVec_RouteHopZ val_constr;
64556         val_constr.datalen = val->arr_len;
64557         if (val_constr.datalen > 0)
64558                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
64559         else
64560                 val_constr.data = NULL;
64561         uint64_t* val_vals = val->elems;
64562         for (size_t k = 0; k < val_constr.datalen; k++) {
64563                 uint64_t val_conv_10 = val_vals[k];
64564                 LDKRouteHop val_conv_10_conv;
64565                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
64566                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
64567                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
64568                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
64569                 val_constr.data[k] = val_conv_10_conv;
64570         }
64571         FREE(val);
64572         Path_set_hops(&this_ptr_conv, val_constr);
64573 }
64574
64575 uint64_t  __attribute__((export_name("TS_Path_get_blinded_tail"))) TS_Path_get_blinded_tail(uint64_t this_ptr) {
64576         LDKPath this_ptr_conv;
64577         this_ptr_conv.inner = untag_ptr(this_ptr);
64578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64580         this_ptr_conv.is_owned = false;
64581         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
64582         uint64_t ret_ref = 0;
64583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64585         return ret_ref;
64586 }
64587
64588 void  __attribute__((export_name("TS_Path_set_blinded_tail"))) TS_Path_set_blinded_tail(uint64_t this_ptr, uint64_t val) {
64589         LDKPath this_ptr_conv;
64590         this_ptr_conv.inner = untag_ptr(this_ptr);
64591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64593         this_ptr_conv.is_owned = false;
64594         LDKBlindedTail val_conv;
64595         val_conv.inner = untag_ptr(val);
64596         val_conv.is_owned = ptr_is_owned(val);
64597         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64598         val_conv = BlindedTail_clone(&val_conv);
64599         Path_set_blinded_tail(&this_ptr_conv, val_conv);
64600 }
64601
64602 uint64_t  __attribute__((export_name("TS_Path_new"))) TS_Path_new(uint64_tArray hops_arg, uint64_t blinded_tail_arg) {
64603         LDKCVec_RouteHopZ hops_arg_constr;
64604         hops_arg_constr.datalen = hops_arg->arr_len;
64605         if (hops_arg_constr.datalen > 0)
64606                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
64607         else
64608                 hops_arg_constr.data = NULL;
64609         uint64_t* hops_arg_vals = hops_arg->elems;
64610         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
64611                 uint64_t hops_arg_conv_10 = hops_arg_vals[k];
64612                 LDKRouteHop hops_arg_conv_10_conv;
64613                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
64614                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
64615                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
64616                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
64617                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
64618         }
64619         FREE(hops_arg);
64620         LDKBlindedTail blinded_tail_arg_conv;
64621         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
64622         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
64623         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
64624         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
64625         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
64626         uint64_t ret_ref = 0;
64627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64629         return ret_ref;
64630 }
64631
64632 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
64633         LDKPath ret_var = Path_clone(arg);
64634         uint64_t ret_ref = 0;
64635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64637         return ret_ref;
64638 }
64639 int64_t  __attribute__((export_name("TS_Path_clone_ptr"))) TS_Path_clone_ptr(uint64_t arg) {
64640         LDKPath arg_conv;
64641         arg_conv.inner = untag_ptr(arg);
64642         arg_conv.is_owned = ptr_is_owned(arg);
64643         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64644         arg_conv.is_owned = false;
64645         int64_t ret_conv = Path_clone_ptr(&arg_conv);
64646         return ret_conv;
64647 }
64648
64649 uint64_t  __attribute__((export_name("TS_Path_clone"))) TS_Path_clone(uint64_t orig) {
64650         LDKPath orig_conv;
64651         orig_conv.inner = untag_ptr(orig);
64652         orig_conv.is_owned = ptr_is_owned(orig);
64653         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64654         orig_conv.is_owned = false;
64655         LDKPath ret_var = Path_clone(&orig_conv);
64656         uint64_t ret_ref = 0;
64657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64659         return ret_ref;
64660 }
64661
64662 int64_t  __attribute__((export_name("TS_Path_hash"))) TS_Path_hash(uint64_t o) {
64663         LDKPath o_conv;
64664         o_conv.inner = untag_ptr(o);
64665         o_conv.is_owned = ptr_is_owned(o);
64666         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64667         o_conv.is_owned = false;
64668         int64_t ret_conv = Path_hash(&o_conv);
64669         return ret_conv;
64670 }
64671
64672 jboolean  __attribute__((export_name("TS_Path_eq"))) TS_Path_eq(uint64_t a, uint64_t b) {
64673         LDKPath a_conv;
64674         a_conv.inner = untag_ptr(a);
64675         a_conv.is_owned = ptr_is_owned(a);
64676         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64677         a_conv.is_owned = false;
64678         LDKPath b_conv;
64679         b_conv.inner = untag_ptr(b);
64680         b_conv.is_owned = ptr_is_owned(b);
64681         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64682         b_conv.is_owned = false;
64683         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
64684         return ret_conv;
64685 }
64686
64687 int64_t  __attribute__((export_name("TS_Path_fee_msat"))) TS_Path_fee_msat(uint64_t this_arg) {
64688         LDKPath this_arg_conv;
64689         this_arg_conv.inner = untag_ptr(this_arg);
64690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64692         this_arg_conv.is_owned = false;
64693         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
64694         return ret_conv;
64695 }
64696
64697 int64_t  __attribute__((export_name("TS_Path_final_value_msat"))) TS_Path_final_value_msat(uint64_t this_arg) {
64698         LDKPath this_arg_conv;
64699         this_arg_conv.inner = untag_ptr(this_arg);
64700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64702         this_arg_conv.is_owned = false;
64703         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
64704         return ret_conv;
64705 }
64706
64707 uint64_t  __attribute__((export_name("TS_Path_final_cltv_expiry_delta"))) TS_Path_final_cltv_expiry_delta(uint64_t this_arg) {
64708         LDKPath this_arg_conv;
64709         this_arg_conv.inner = untag_ptr(this_arg);
64710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64712         this_arg_conv.is_owned = false;
64713         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
64714         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
64715         uint64_t ret_ref = tag_ptr(ret_copy, true);
64716         return ret_ref;
64717 }
64718
64719 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
64720         LDKRoute this_obj_conv;
64721         this_obj_conv.inner = untag_ptr(this_obj);
64722         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64724         Route_free(this_obj_conv);
64725 }
64726
64727 uint64_tArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
64728         LDKRoute this_ptr_conv;
64729         this_ptr_conv.inner = untag_ptr(this_ptr);
64730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64732         this_ptr_conv.is_owned = false;
64733         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
64734         uint64_tArray ret_arr = NULL;
64735         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
64736         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
64737         for (size_t g = 0; g < ret_var.datalen; g++) {
64738                 LDKPath ret_conv_6_var = ret_var.data[g];
64739                 uint64_t ret_conv_6_ref = 0;
64740                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
64741                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
64742                 ret_arr_ptr[g] = ret_conv_6_ref;
64743         }
64744         
64745         FREE(ret_var.data);
64746         return ret_arr;
64747 }
64748
64749 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, uint64_tArray val) {
64750         LDKRoute this_ptr_conv;
64751         this_ptr_conv.inner = untag_ptr(this_ptr);
64752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64754         this_ptr_conv.is_owned = false;
64755         LDKCVec_PathZ val_constr;
64756         val_constr.datalen = val->arr_len;
64757         if (val_constr.datalen > 0)
64758                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
64759         else
64760                 val_constr.data = NULL;
64761         uint64_t* val_vals = val->elems;
64762         for (size_t g = 0; g < val_constr.datalen; g++) {
64763                 uint64_t val_conv_6 = val_vals[g];
64764                 LDKPath val_conv_6_conv;
64765                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
64766                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
64767                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
64768                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
64769                 val_constr.data[g] = val_conv_6_conv;
64770         }
64771         FREE(val);
64772         Route_set_paths(&this_ptr_conv, val_constr);
64773 }
64774
64775 uint64_t  __attribute__((export_name("TS_Route_get_route_params"))) TS_Route_get_route_params(uint64_t this_ptr) {
64776         LDKRoute this_ptr_conv;
64777         this_ptr_conv.inner = untag_ptr(this_ptr);
64778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64780         this_ptr_conv.is_owned = false;
64781         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
64782         uint64_t ret_ref = 0;
64783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64785         return ret_ref;
64786 }
64787
64788 void  __attribute__((export_name("TS_Route_set_route_params"))) TS_Route_set_route_params(uint64_t this_ptr, uint64_t val) {
64789         LDKRoute this_ptr_conv;
64790         this_ptr_conv.inner = untag_ptr(this_ptr);
64791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64793         this_ptr_conv.is_owned = false;
64794         LDKRouteParameters val_conv;
64795         val_conv.inner = untag_ptr(val);
64796         val_conv.is_owned = ptr_is_owned(val);
64797         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64798         val_conv = RouteParameters_clone(&val_conv);
64799         Route_set_route_params(&this_ptr_conv, val_conv);
64800 }
64801
64802 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(uint64_tArray paths_arg, uint64_t route_params_arg) {
64803         LDKCVec_PathZ paths_arg_constr;
64804         paths_arg_constr.datalen = paths_arg->arr_len;
64805         if (paths_arg_constr.datalen > 0)
64806                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
64807         else
64808                 paths_arg_constr.data = NULL;
64809         uint64_t* paths_arg_vals = paths_arg->elems;
64810         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
64811                 uint64_t paths_arg_conv_6 = paths_arg_vals[g];
64812                 LDKPath paths_arg_conv_6_conv;
64813                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
64814                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
64815                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
64816                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
64817                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
64818         }
64819         FREE(paths_arg);
64820         LDKRouteParameters route_params_arg_conv;
64821         route_params_arg_conv.inner = untag_ptr(route_params_arg);
64822         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
64823         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
64824         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
64825         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
64826         uint64_t ret_ref = 0;
64827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64829         return ret_ref;
64830 }
64831
64832 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
64833         LDKRoute ret_var = Route_clone(arg);
64834         uint64_t ret_ref = 0;
64835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64837         return ret_ref;
64838 }
64839 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
64840         LDKRoute arg_conv;
64841         arg_conv.inner = untag_ptr(arg);
64842         arg_conv.is_owned = ptr_is_owned(arg);
64843         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64844         arg_conv.is_owned = false;
64845         int64_t ret_conv = Route_clone_ptr(&arg_conv);
64846         return ret_conv;
64847 }
64848
64849 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
64850         LDKRoute orig_conv;
64851         orig_conv.inner = untag_ptr(orig);
64852         orig_conv.is_owned = ptr_is_owned(orig);
64853         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64854         orig_conv.is_owned = false;
64855         LDKRoute ret_var = Route_clone(&orig_conv);
64856         uint64_t ret_ref = 0;
64857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64859         return ret_ref;
64860 }
64861
64862 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
64863         LDKRoute o_conv;
64864         o_conv.inner = untag_ptr(o);
64865         o_conv.is_owned = ptr_is_owned(o);
64866         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64867         o_conv.is_owned = false;
64868         int64_t ret_conv = Route_hash(&o_conv);
64869         return ret_conv;
64870 }
64871
64872 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
64873         LDKRoute a_conv;
64874         a_conv.inner = untag_ptr(a);
64875         a_conv.is_owned = ptr_is_owned(a);
64876         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64877         a_conv.is_owned = false;
64878         LDKRoute b_conv;
64879         b_conv.inner = untag_ptr(b);
64880         b_conv.is_owned = ptr_is_owned(b);
64881         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64882         b_conv.is_owned = false;
64883         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
64884         return ret_conv;
64885 }
64886
64887 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
64888         LDKRoute this_arg_conv;
64889         this_arg_conv.inner = untag_ptr(this_arg);
64890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64892         this_arg_conv.is_owned = false;
64893         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
64894         return ret_conv;
64895 }
64896
64897 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
64898         LDKRoute this_arg_conv;
64899         this_arg_conv.inner = untag_ptr(this_arg);
64900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64902         this_arg_conv.is_owned = false;
64903         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
64904         return ret_conv;
64905 }
64906
64907 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
64908         LDKRoute obj_conv;
64909         obj_conv.inner = untag_ptr(obj);
64910         obj_conv.is_owned = ptr_is_owned(obj);
64911         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64912         obj_conv.is_owned = false;
64913         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
64914         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64915         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64916         CVec_u8Z_free(ret_var);
64917         return ret_arr;
64918 }
64919
64920 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
64921         LDKu8slice ser_ref;
64922         ser_ref.datalen = ser->arr_len;
64923         ser_ref.data = ser->elems;
64924         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
64925         *ret_conv = Route_read(ser_ref);
64926         FREE(ser);
64927         return tag_ptr(ret_conv, true);
64928 }
64929
64930 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
64931         LDKRouteParameters this_obj_conv;
64932         this_obj_conv.inner = untag_ptr(this_obj);
64933         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64935         RouteParameters_free(this_obj_conv);
64936 }
64937
64938 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
64939         LDKRouteParameters this_ptr_conv;
64940         this_ptr_conv.inner = untag_ptr(this_ptr);
64941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64943         this_ptr_conv.is_owned = false;
64944         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
64945         uint64_t ret_ref = 0;
64946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64948         return ret_ref;
64949 }
64950
64951 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
64952         LDKRouteParameters this_ptr_conv;
64953         this_ptr_conv.inner = untag_ptr(this_ptr);
64954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64956         this_ptr_conv.is_owned = false;
64957         LDKPaymentParameters val_conv;
64958         val_conv.inner = untag_ptr(val);
64959         val_conv.is_owned = ptr_is_owned(val);
64960         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64961         val_conv = PaymentParameters_clone(&val_conv);
64962         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
64963 }
64964
64965 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
64966         LDKRouteParameters this_ptr_conv;
64967         this_ptr_conv.inner = untag_ptr(this_ptr);
64968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64970         this_ptr_conv.is_owned = false;
64971         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
64972         return ret_conv;
64973 }
64974
64975 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
64976         LDKRouteParameters this_ptr_conv;
64977         this_ptr_conv.inner = untag_ptr(this_ptr);
64978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64980         this_ptr_conv.is_owned = false;
64981         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
64982 }
64983
64984 uint64_t  __attribute__((export_name("TS_RouteParameters_get_max_total_routing_fee_msat"))) TS_RouteParameters_get_max_total_routing_fee_msat(uint64_t this_ptr) {
64985         LDKRouteParameters this_ptr_conv;
64986         this_ptr_conv.inner = untag_ptr(this_ptr);
64987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64989         this_ptr_conv.is_owned = false;
64990         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64991         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
64992         uint64_t ret_ref = tag_ptr(ret_copy, true);
64993         return ret_ref;
64994 }
64995
64996 void  __attribute__((export_name("TS_RouteParameters_set_max_total_routing_fee_msat"))) TS_RouteParameters_set_max_total_routing_fee_msat(uint64_t this_ptr, uint64_t val) {
64997         LDKRouteParameters this_ptr_conv;
64998         this_ptr_conv.inner = untag_ptr(this_ptr);
64999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65001         this_ptr_conv.is_owned = false;
65002         void* val_ptr = untag_ptr(val);
65003         CHECK_ACCESS(val_ptr);
65004         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65005         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65006         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
65007 }
65008
65009 uint64_t  __attribute__((export_name("TS_RouteParameters_new"))) TS_RouteParameters_new(uint64_t payment_params_arg, int64_t final_value_msat_arg, uint64_t max_total_routing_fee_msat_arg) {
65010         LDKPaymentParameters payment_params_arg_conv;
65011         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
65012         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
65013         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
65014         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
65015         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
65016         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
65017         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
65018         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
65019         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
65020         uint64_t ret_ref = 0;
65021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65023         return ret_ref;
65024 }
65025
65026 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
65027         LDKRouteParameters ret_var = RouteParameters_clone(arg);
65028         uint64_t ret_ref = 0;
65029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65031         return ret_ref;
65032 }
65033 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
65034         LDKRouteParameters arg_conv;
65035         arg_conv.inner = untag_ptr(arg);
65036         arg_conv.is_owned = ptr_is_owned(arg);
65037         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65038         arg_conv.is_owned = false;
65039         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
65040         return ret_conv;
65041 }
65042
65043 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
65044         LDKRouteParameters orig_conv;
65045         orig_conv.inner = untag_ptr(orig);
65046         orig_conv.is_owned = ptr_is_owned(orig);
65047         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65048         orig_conv.is_owned = false;
65049         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
65050         uint64_t ret_ref = 0;
65051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65053         return ret_ref;
65054 }
65055
65056 int64_t  __attribute__((export_name("TS_RouteParameters_hash"))) TS_RouteParameters_hash(uint64_t o) {
65057         LDKRouteParameters o_conv;
65058         o_conv.inner = untag_ptr(o);
65059         o_conv.is_owned = ptr_is_owned(o);
65060         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65061         o_conv.is_owned = false;
65062         int64_t ret_conv = RouteParameters_hash(&o_conv);
65063         return ret_conv;
65064 }
65065
65066 jboolean  __attribute__((export_name("TS_RouteParameters_eq"))) TS_RouteParameters_eq(uint64_t a, uint64_t b) {
65067         LDKRouteParameters a_conv;
65068         a_conv.inner = untag_ptr(a);
65069         a_conv.is_owned = ptr_is_owned(a);
65070         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65071         a_conv.is_owned = false;
65072         LDKRouteParameters b_conv;
65073         b_conv.inner = untag_ptr(b);
65074         b_conv.is_owned = ptr_is_owned(b);
65075         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65076         b_conv.is_owned = false;
65077         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
65078         return ret_conv;
65079 }
65080
65081 uint64_t  __attribute__((export_name("TS_RouteParameters_from_payment_params_and_value"))) TS_RouteParameters_from_payment_params_and_value(uint64_t payment_params, int64_t final_value_msat) {
65082         LDKPaymentParameters payment_params_conv;
65083         payment_params_conv.inner = untag_ptr(payment_params);
65084         payment_params_conv.is_owned = ptr_is_owned(payment_params);
65085         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
65086         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
65087         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
65088         uint64_t ret_ref = 0;
65089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65091         return ret_ref;
65092 }
65093
65094 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
65095         LDKRouteParameters obj_conv;
65096         obj_conv.inner = untag_ptr(obj);
65097         obj_conv.is_owned = ptr_is_owned(obj);
65098         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65099         obj_conv.is_owned = false;
65100         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
65101         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65102         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65103         CVec_u8Z_free(ret_var);
65104         return ret_arr;
65105 }
65106
65107 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
65108         LDKu8slice ser_ref;
65109         ser_ref.datalen = ser->arr_len;
65110         ser_ref.data = ser->elems;
65111         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
65112         *ret_conv = RouteParameters_read(ser_ref);
65113         FREE(ser);
65114         return tag_ptr(ret_conv, true);
65115 }
65116
65117 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
65118         LDKPaymentParameters this_obj_conv;
65119         this_obj_conv.inner = untag_ptr(this_obj);
65120         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65122         PaymentParameters_free(this_obj_conv);
65123 }
65124
65125 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_payee"))) TS_PaymentParameters_get_payee(uint64_t this_ptr) {
65126         LDKPaymentParameters this_ptr_conv;
65127         this_ptr_conv.inner = untag_ptr(this_ptr);
65128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65130         this_ptr_conv.is_owned = false;
65131         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65132         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
65133         uint64_t ret_ref = tag_ptr(ret_copy, true);
65134         return ret_ref;
65135 }
65136
65137 void  __attribute__((export_name("TS_PaymentParameters_set_payee"))) TS_PaymentParameters_set_payee(uint64_t this_ptr, uint64_t val) {
65138         LDKPaymentParameters this_ptr_conv;
65139         this_ptr_conv.inner = untag_ptr(this_ptr);
65140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65142         this_ptr_conv.is_owned = false;
65143         void* val_ptr = untag_ptr(val);
65144         CHECK_ACCESS(val_ptr);
65145         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
65146         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
65147         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
65148 }
65149
65150 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
65151         LDKPaymentParameters this_ptr_conv;
65152         this_ptr_conv.inner = untag_ptr(this_ptr);
65153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65155         this_ptr_conv.is_owned = false;
65156         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65157         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
65158         uint64_t ret_ref = tag_ptr(ret_copy, true);
65159         return ret_ref;
65160 }
65161
65162 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
65163         LDKPaymentParameters this_ptr_conv;
65164         this_ptr_conv.inner = untag_ptr(this_ptr);
65165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65167         this_ptr_conv.is_owned = false;
65168         void* val_ptr = untag_ptr(val);
65169         CHECK_ACCESS(val_ptr);
65170         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65171         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65172         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
65173 }
65174
65175 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) {
65176         LDKPaymentParameters this_ptr_conv;
65177         this_ptr_conv.inner = untag_ptr(this_ptr);
65178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65180         this_ptr_conv.is_owned = false;
65181         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
65182         return ret_conv;
65183 }
65184
65185 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) {
65186         LDKPaymentParameters this_ptr_conv;
65187         this_ptr_conv.inner = untag_ptr(this_ptr);
65188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65190         this_ptr_conv.is_owned = false;
65191         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
65192 }
65193
65194 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
65195         LDKPaymentParameters this_ptr_conv;
65196         this_ptr_conv.inner = untag_ptr(this_ptr);
65197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65199         this_ptr_conv.is_owned = false;
65200         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
65201         return ret_conv;
65202 }
65203
65204 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
65205         LDKPaymentParameters this_ptr_conv;
65206         this_ptr_conv.inner = untag_ptr(this_ptr);
65207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65209         this_ptr_conv.is_owned = false;
65210         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
65211 }
65212
65213 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) {
65214         LDKPaymentParameters this_ptr_conv;
65215         this_ptr_conv.inner = untag_ptr(this_ptr);
65216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65218         this_ptr_conv.is_owned = false;
65219         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
65220         return ret_conv;
65221 }
65222
65223 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) {
65224         LDKPaymentParameters this_ptr_conv;
65225         this_ptr_conv.inner = untag_ptr(this_ptr);
65226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65228         this_ptr_conv.is_owned = false;
65229         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
65230 }
65231
65232 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
65233         LDKPaymentParameters this_ptr_conv;
65234         this_ptr_conv.inner = untag_ptr(this_ptr);
65235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65237         this_ptr_conv.is_owned = false;
65238         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
65239         int64_tArray ret_arr = NULL;
65240         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
65241         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
65242         for (size_t i = 0; i < ret_var.datalen; i++) {
65243                 int64_t ret_conv_8_conv = ret_var.data[i];
65244                 ret_arr_ptr[i] = ret_conv_8_conv;
65245         }
65246         
65247         FREE(ret_var.data);
65248         return ret_arr;
65249 }
65250
65251 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
65252         LDKPaymentParameters this_ptr_conv;
65253         this_ptr_conv.inner = untag_ptr(this_ptr);
65254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65256         this_ptr_conv.is_owned = false;
65257         LDKCVec_u64Z val_constr;
65258         val_constr.datalen = val->arr_len;
65259         if (val_constr.datalen > 0)
65260                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65261         else
65262                 val_constr.data = NULL;
65263         int64_t* val_vals = val->elems;
65264         for (size_t i = 0; i < val_constr.datalen; i++) {
65265                 int64_t val_conv_8 = val_vals[i];
65266                 val_constr.data[i] = val_conv_8;
65267         }
65268         FREE(val);
65269         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
65270 }
65271
65272 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_blinded_path_idxs"))) TS_PaymentParameters_get_previously_failed_blinded_path_idxs(uint64_t this_ptr) {
65273         LDKPaymentParameters this_ptr_conv;
65274         this_ptr_conv.inner = untag_ptr(this_ptr);
65275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65277         this_ptr_conv.is_owned = false;
65278         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_blinded_path_idxs(&this_ptr_conv);
65279         int64_tArray ret_arr = NULL;
65280         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
65281         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
65282         for (size_t i = 0; i < ret_var.datalen; i++) {
65283                 int64_t ret_conv_8_conv = ret_var.data[i];
65284                 ret_arr_ptr[i] = ret_conv_8_conv;
65285         }
65286         
65287         FREE(ret_var.data);
65288         return ret_arr;
65289 }
65290
65291 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_blinded_path_idxs"))) TS_PaymentParameters_set_previously_failed_blinded_path_idxs(uint64_t this_ptr, int64_tArray val) {
65292         LDKPaymentParameters this_ptr_conv;
65293         this_ptr_conv.inner = untag_ptr(this_ptr);
65294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65296         this_ptr_conv.is_owned = false;
65297         LDKCVec_u64Z val_constr;
65298         val_constr.datalen = val->arr_len;
65299         if (val_constr.datalen > 0)
65300                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65301         else
65302                 val_constr.data = NULL;
65303         int64_t* val_vals = val->elems;
65304         for (size_t i = 0; i < val_constr.datalen; i++) {
65305                 int64_t val_conv_8 = val_vals[i];
65306                 val_constr.data[i] = val_conv_8;
65307         }
65308         FREE(val);
65309         PaymentParameters_set_previously_failed_blinded_path_idxs(&this_ptr_conv, val_constr);
65310 }
65311
65312 uint64_t  __attribute__((export_name("TS_PaymentParameters_new"))) TS_PaymentParameters_new(uint64_t payee_arg, uint64_t expiry_time_arg, int32_t max_total_cltv_expiry_delta_arg, int8_t max_path_count_arg, int8_t max_channel_saturation_power_of_half_arg, int64_tArray previously_failed_channels_arg, int64_tArray previously_failed_blinded_path_idxs_arg) {
65313         void* payee_arg_ptr = untag_ptr(payee_arg);
65314         CHECK_ACCESS(payee_arg_ptr);
65315         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
65316         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
65317         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
65318         CHECK_ACCESS(expiry_time_arg_ptr);
65319         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
65320         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
65321         LDKCVec_u64Z previously_failed_channels_arg_constr;
65322         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
65323         if (previously_failed_channels_arg_constr.datalen > 0)
65324                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65325         else
65326                 previously_failed_channels_arg_constr.data = NULL;
65327         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
65328         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
65329                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
65330                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
65331         }
65332         FREE(previously_failed_channels_arg);
65333         LDKCVec_u64Z previously_failed_blinded_path_idxs_arg_constr;
65334         previously_failed_blinded_path_idxs_arg_constr.datalen = previously_failed_blinded_path_idxs_arg->arr_len;
65335         if (previously_failed_blinded_path_idxs_arg_constr.datalen > 0)
65336                 previously_failed_blinded_path_idxs_arg_constr.data = MALLOC(previously_failed_blinded_path_idxs_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65337         else
65338                 previously_failed_blinded_path_idxs_arg_constr.data = NULL;
65339         int64_t* previously_failed_blinded_path_idxs_arg_vals = previously_failed_blinded_path_idxs_arg->elems;
65340         for (size_t i = 0; i < previously_failed_blinded_path_idxs_arg_constr.datalen; i++) {
65341                 int64_t previously_failed_blinded_path_idxs_arg_conv_8 = previously_failed_blinded_path_idxs_arg_vals[i];
65342                 previously_failed_blinded_path_idxs_arg_constr.data[i] = previously_failed_blinded_path_idxs_arg_conv_8;
65343         }
65344         FREE(previously_failed_blinded_path_idxs_arg);
65345         LDKPaymentParameters ret_var = PaymentParameters_new(payee_arg_conv, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg_constr, previously_failed_blinded_path_idxs_arg_constr);
65346         uint64_t ret_ref = 0;
65347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65349         return ret_ref;
65350 }
65351
65352 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
65353         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
65354         uint64_t ret_ref = 0;
65355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65357         return ret_ref;
65358 }
65359 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
65360         LDKPaymentParameters arg_conv;
65361         arg_conv.inner = untag_ptr(arg);
65362         arg_conv.is_owned = ptr_is_owned(arg);
65363         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65364         arg_conv.is_owned = false;
65365         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
65366         return ret_conv;
65367 }
65368
65369 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
65370         LDKPaymentParameters orig_conv;
65371         orig_conv.inner = untag_ptr(orig);
65372         orig_conv.is_owned = ptr_is_owned(orig);
65373         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65374         orig_conv.is_owned = false;
65375         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
65376         uint64_t ret_ref = 0;
65377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65379         return ret_ref;
65380 }
65381
65382 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
65383         LDKPaymentParameters o_conv;
65384         o_conv.inner = untag_ptr(o);
65385         o_conv.is_owned = ptr_is_owned(o);
65386         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65387         o_conv.is_owned = false;
65388         int64_t ret_conv = PaymentParameters_hash(&o_conv);
65389         return ret_conv;
65390 }
65391
65392 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
65393         LDKPaymentParameters a_conv;
65394         a_conv.inner = untag_ptr(a);
65395         a_conv.is_owned = ptr_is_owned(a);
65396         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65397         a_conv.is_owned = false;
65398         LDKPaymentParameters b_conv;
65399         b_conv.inner = untag_ptr(b);
65400         b_conv.is_owned = ptr_is_owned(b);
65401         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65402         b_conv.is_owned = false;
65403         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
65404         return ret_conv;
65405 }
65406
65407 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
65408         LDKPaymentParameters obj_conv;
65409         obj_conv.inner = untag_ptr(obj);
65410         obj_conv.is_owned = ptr_is_owned(obj);
65411         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65412         obj_conv.is_owned = false;
65413         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
65414         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65415         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65416         CVec_u8Z_free(ret_var);
65417         return ret_arr;
65418 }
65419
65420 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser, int32_t arg) {
65421         LDKu8slice ser_ref;
65422         ser_ref.datalen = ser->arr_len;
65423         ser_ref.data = ser->elems;
65424         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
65425         *ret_conv = PaymentParameters_read(ser_ref, arg);
65426         FREE(ser);
65427         return tag_ptr(ret_conv, true);
65428 }
65429
65430 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) {
65431         LDKPublicKey payee_pubkey_ref;
65432         CHECK(payee_pubkey->arr_len == 33);
65433         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
65434         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
65435         uint64_t ret_ref = 0;
65436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65438         return ret_ref;
65439 }
65440
65441 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) {
65442         LDKPublicKey payee_pubkey_ref;
65443         CHECK(payee_pubkey->arr_len == 33);
65444         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
65445         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
65446         uint64_t ret_ref = 0;
65447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65449         return ret_ref;
65450 }
65451
65452 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_bolt12_invoice"))) TS_PaymentParameters_from_bolt12_invoice(uint64_t invoice) {
65453         LDKBolt12Invoice invoice_conv;
65454         invoice_conv.inner = untag_ptr(invoice);
65455         invoice_conv.is_owned = ptr_is_owned(invoice);
65456         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
65457         invoice_conv.is_owned = false;
65458         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
65459         uint64_t ret_ref = 0;
65460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65462         return ret_ref;
65463 }
65464
65465 uint64_t  __attribute__((export_name("TS_PaymentParameters_blinded"))) TS_PaymentParameters_blinded(uint64_tArray blinded_route_hints) {
65466         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
65467         blinded_route_hints_constr.datalen = blinded_route_hints->arr_len;
65468         if (blinded_route_hints_constr.datalen > 0)
65469                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
65470         else
65471                 blinded_route_hints_constr.data = NULL;
65472         uint64_t* blinded_route_hints_vals = blinded_route_hints->elems;
65473         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
65474                 uint64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
65475                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
65476                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
65477                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
65478                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
65479                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
65480         }
65481         FREE(blinded_route_hints);
65482         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
65483         uint64_t ret_ref = 0;
65484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65486         return ret_ref;
65487 }
65488
65489 void  __attribute__((export_name("TS_Payee_free"))) TS_Payee_free(uint64_t this_ptr) {
65490         if (!ptr_is_owned(this_ptr)) return;
65491         void* this_ptr_ptr = untag_ptr(this_ptr);
65492         CHECK_ACCESS(this_ptr_ptr);
65493         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
65494         FREE(untag_ptr(this_ptr));
65495         Payee_free(this_ptr_conv);
65496 }
65497
65498 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
65499         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65500         *ret_copy = Payee_clone(arg);
65501         uint64_t ret_ref = tag_ptr(ret_copy, true);
65502         return ret_ref;
65503 }
65504 int64_t  __attribute__((export_name("TS_Payee_clone_ptr"))) TS_Payee_clone_ptr(uint64_t arg) {
65505         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
65506         int64_t ret_conv = Payee_clone_ptr(arg_conv);
65507         return ret_conv;
65508 }
65509
65510 uint64_t  __attribute__((export_name("TS_Payee_clone"))) TS_Payee_clone(uint64_t orig) {
65511         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
65512         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65513         *ret_copy = Payee_clone(orig_conv);
65514         uint64_t ret_ref = tag_ptr(ret_copy, true);
65515         return ret_ref;
65516 }
65517
65518 uint64_t  __attribute__((export_name("TS_Payee_blinded"))) TS_Payee_blinded(uint64_tArray route_hints, uint64_t features) {
65519         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
65520         route_hints_constr.datalen = route_hints->arr_len;
65521         if (route_hints_constr.datalen > 0)
65522                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
65523         else
65524                 route_hints_constr.data = NULL;
65525         uint64_t* route_hints_vals = route_hints->elems;
65526         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
65527                 uint64_t route_hints_conv_37 = route_hints_vals[l];
65528                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
65529                 CHECK_ACCESS(route_hints_conv_37_ptr);
65530                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
65531                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
65532                 route_hints_constr.data[l] = route_hints_conv_37_conv;
65533         }
65534         FREE(route_hints);
65535         LDKBolt12InvoiceFeatures features_conv;
65536         features_conv.inner = untag_ptr(features);
65537         features_conv.is_owned = ptr_is_owned(features);
65538         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
65539         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
65540         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65541         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
65542         uint64_t ret_ref = tag_ptr(ret_copy, true);
65543         return ret_ref;
65544 }
65545
65546 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) {
65547         LDKPublicKey node_id_ref;
65548         CHECK(node_id->arr_len == 33);
65549         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65550         LDKCVec_RouteHintZ route_hints_constr;
65551         route_hints_constr.datalen = route_hints->arr_len;
65552         if (route_hints_constr.datalen > 0)
65553                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
65554         else
65555                 route_hints_constr.data = NULL;
65556         uint64_t* route_hints_vals = route_hints->elems;
65557         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
65558                 uint64_t route_hints_conv_11 = route_hints_vals[l];
65559                 LDKRouteHint route_hints_conv_11_conv;
65560                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
65561                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
65562                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
65563                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
65564                 route_hints_constr.data[l] = route_hints_conv_11_conv;
65565         }
65566         FREE(route_hints);
65567         LDKBolt11InvoiceFeatures features_conv;
65568         features_conv.inner = untag_ptr(features);
65569         features_conv.is_owned = ptr_is_owned(features);
65570         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
65571         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
65572         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65573         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
65574         uint64_t ret_ref = tag_ptr(ret_copy, true);
65575         return ret_ref;
65576 }
65577
65578 int64_t  __attribute__((export_name("TS_Payee_hash"))) TS_Payee_hash(uint64_t o) {
65579         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
65580         int64_t ret_conv = Payee_hash(o_conv);
65581         return ret_conv;
65582 }
65583
65584 jboolean  __attribute__((export_name("TS_Payee_eq"))) TS_Payee_eq(uint64_t a, uint64_t b) {
65585         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
65586         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
65587         jboolean ret_conv = Payee_eq(a_conv, b_conv);
65588         return ret_conv;
65589 }
65590
65591 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
65592         LDKRouteHint this_obj_conv;
65593         this_obj_conv.inner = untag_ptr(this_obj);
65594         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65596         RouteHint_free(this_obj_conv);
65597 }
65598
65599 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
65600         LDKRouteHint this_ptr_conv;
65601         this_ptr_conv.inner = untag_ptr(this_ptr);
65602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65604         this_ptr_conv.is_owned = false;
65605         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
65606         uint64_tArray ret_arr = NULL;
65607         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
65608         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
65609         for (size_t o = 0; o < ret_var.datalen; o++) {
65610                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
65611                 uint64_t ret_conv_14_ref = 0;
65612                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
65613                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
65614                 ret_arr_ptr[o] = ret_conv_14_ref;
65615         }
65616         
65617         FREE(ret_var.data);
65618         return ret_arr;
65619 }
65620
65621 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
65622         LDKRouteHint this_ptr_conv;
65623         this_ptr_conv.inner = untag_ptr(this_ptr);
65624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65626         this_ptr_conv.is_owned = false;
65627         LDKCVec_RouteHintHopZ val_constr;
65628         val_constr.datalen = val->arr_len;
65629         if (val_constr.datalen > 0)
65630                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
65631         else
65632                 val_constr.data = NULL;
65633         uint64_t* val_vals = val->elems;
65634         for (size_t o = 0; o < val_constr.datalen; o++) {
65635                 uint64_t val_conv_14 = val_vals[o];
65636                 LDKRouteHintHop val_conv_14_conv;
65637                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
65638                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
65639                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
65640                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
65641                 val_constr.data[o] = val_conv_14_conv;
65642         }
65643         FREE(val);
65644         RouteHint_set_a(&this_ptr_conv, val_constr);
65645 }
65646
65647 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
65648         LDKCVec_RouteHintHopZ a_arg_constr;
65649         a_arg_constr.datalen = a_arg->arr_len;
65650         if (a_arg_constr.datalen > 0)
65651                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
65652         else
65653                 a_arg_constr.data = NULL;
65654         uint64_t* a_arg_vals = a_arg->elems;
65655         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
65656                 uint64_t a_arg_conv_14 = a_arg_vals[o];
65657                 LDKRouteHintHop a_arg_conv_14_conv;
65658                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
65659                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
65660                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
65661                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
65662                 a_arg_constr.data[o] = a_arg_conv_14_conv;
65663         }
65664         FREE(a_arg);
65665         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
65666         uint64_t ret_ref = 0;
65667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65669         return ret_ref;
65670 }
65671
65672 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
65673         LDKRouteHint ret_var = RouteHint_clone(arg);
65674         uint64_t ret_ref = 0;
65675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65677         return ret_ref;
65678 }
65679 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
65680         LDKRouteHint arg_conv;
65681         arg_conv.inner = untag_ptr(arg);
65682         arg_conv.is_owned = ptr_is_owned(arg);
65683         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65684         arg_conv.is_owned = false;
65685         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
65686         return ret_conv;
65687 }
65688
65689 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
65690         LDKRouteHint orig_conv;
65691         orig_conv.inner = untag_ptr(orig);
65692         orig_conv.is_owned = ptr_is_owned(orig);
65693         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65694         orig_conv.is_owned = false;
65695         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
65696         uint64_t ret_ref = 0;
65697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65699         return ret_ref;
65700 }
65701
65702 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
65703         LDKRouteHint o_conv;
65704         o_conv.inner = untag_ptr(o);
65705         o_conv.is_owned = ptr_is_owned(o);
65706         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65707         o_conv.is_owned = false;
65708         int64_t ret_conv = RouteHint_hash(&o_conv);
65709         return ret_conv;
65710 }
65711
65712 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
65713         LDKRouteHint a_conv;
65714         a_conv.inner = untag_ptr(a);
65715         a_conv.is_owned = ptr_is_owned(a);
65716         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65717         a_conv.is_owned = false;
65718         LDKRouteHint b_conv;
65719         b_conv.inner = untag_ptr(b);
65720         b_conv.is_owned = ptr_is_owned(b);
65721         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65722         b_conv.is_owned = false;
65723         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
65724         return ret_conv;
65725 }
65726
65727 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
65728         LDKRouteHint obj_conv;
65729         obj_conv.inner = untag_ptr(obj);
65730         obj_conv.is_owned = ptr_is_owned(obj);
65731         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65732         obj_conv.is_owned = false;
65733         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
65734         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65735         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65736         CVec_u8Z_free(ret_var);
65737         return ret_arr;
65738 }
65739
65740 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
65741         LDKu8slice ser_ref;
65742         ser_ref.datalen = ser->arr_len;
65743         ser_ref.data = ser->elems;
65744         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
65745         *ret_conv = RouteHint_read(ser_ref);
65746         FREE(ser);
65747         return tag_ptr(ret_conv, true);
65748 }
65749
65750 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
65751         LDKRouteHintHop this_obj_conv;
65752         this_obj_conv.inner = untag_ptr(this_obj);
65753         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65755         RouteHintHop_free(this_obj_conv);
65756 }
65757
65758 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
65759         LDKRouteHintHop this_ptr_conv;
65760         this_ptr_conv.inner = untag_ptr(this_ptr);
65761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65763         this_ptr_conv.is_owned = false;
65764         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
65765         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
65766         return ret_arr;
65767 }
65768
65769 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
65770         LDKRouteHintHop this_ptr_conv;
65771         this_ptr_conv.inner = untag_ptr(this_ptr);
65772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65774         this_ptr_conv.is_owned = false;
65775         LDKPublicKey val_ref;
65776         CHECK(val->arr_len == 33);
65777         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
65778         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
65779 }
65780
65781 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
65782         LDKRouteHintHop this_ptr_conv;
65783         this_ptr_conv.inner = untag_ptr(this_ptr);
65784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65786         this_ptr_conv.is_owned = false;
65787         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
65788         return ret_conv;
65789 }
65790
65791 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
65792         LDKRouteHintHop this_ptr_conv;
65793         this_ptr_conv.inner = untag_ptr(this_ptr);
65794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65796         this_ptr_conv.is_owned = false;
65797         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
65798 }
65799
65800 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
65801         LDKRouteHintHop this_ptr_conv;
65802         this_ptr_conv.inner = untag_ptr(this_ptr);
65803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65805         this_ptr_conv.is_owned = false;
65806         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
65807         uint64_t ret_ref = 0;
65808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65810         return ret_ref;
65811 }
65812
65813 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
65814         LDKRouteHintHop this_ptr_conv;
65815         this_ptr_conv.inner = untag_ptr(this_ptr);
65816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65818         this_ptr_conv.is_owned = false;
65819         LDKRoutingFees val_conv;
65820         val_conv.inner = untag_ptr(val);
65821         val_conv.is_owned = ptr_is_owned(val);
65822         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65823         val_conv = RoutingFees_clone(&val_conv);
65824         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
65825 }
65826
65827 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
65828         LDKRouteHintHop this_ptr_conv;
65829         this_ptr_conv.inner = untag_ptr(this_ptr);
65830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65832         this_ptr_conv.is_owned = false;
65833         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
65834         return ret_conv;
65835 }
65836
65837 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
65838         LDKRouteHintHop this_ptr_conv;
65839         this_ptr_conv.inner = untag_ptr(this_ptr);
65840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65842         this_ptr_conv.is_owned = false;
65843         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
65844 }
65845
65846 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
65847         LDKRouteHintHop this_ptr_conv;
65848         this_ptr_conv.inner = untag_ptr(this_ptr);
65849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65851         this_ptr_conv.is_owned = false;
65852         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65853         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
65854         uint64_t ret_ref = tag_ptr(ret_copy, true);
65855         return ret_ref;
65856 }
65857
65858 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
65859         LDKRouteHintHop this_ptr_conv;
65860         this_ptr_conv.inner = untag_ptr(this_ptr);
65861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65863         this_ptr_conv.is_owned = false;
65864         void* val_ptr = untag_ptr(val);
65865         CHECK_ACCESS(val_ptr);
65866         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65867         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65868         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
65869 }
65870
65871 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
65872         LDKRouteHintHop this_ptr_conv;
65873         this_ptr_conv.inner = untag_ptr(this_ptr);
65874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65876         this_ptr_conv.is_owned = false;
65877         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65878         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
65879         uint64_t ret_ref = tag_ptr(ret_copy, true);
65880         return ret_ref;
65881 }
65882
65883 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
65884         LDKRouteHintHop this_ptr_conv;
65885         this_ptr_conv.inner = untag_ptr(this_ptr);
65886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65888         this_ptr_conv.is_owned = false;
65889         void* val_ptr = untag_ptr(val);
65890         CHECK_ACCESS(val_ptr);
65891         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65892         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65893         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
65894 }
65895
65896 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) {
65897         LDKPublicKey src_node_id_arg_ref;
65898         CHECK(src_node_id_arg->arr_len == 33);
65899         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
65900         LDKRoutingFees fees_arg_conv;
65901         fees_arg_conv.inner = untag_ptr(fees_arg);
65902         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
65903         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
65904         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
65905         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
65906         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
65907         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
65908         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
65909         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
65910         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
65911         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
65912         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
65913         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);
65914         uint64_t ret_ref = 0;
65915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65917         return ret_ref;
65918 }
65919
65920 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
65921         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
65922         uint64_t ret_ref = 0;
65923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65925         return ret_ref;
65926 }
65927 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
65928         LDKRouteHintHop arg_conv;
65929         arg_conv.inner = untag_ptr(arg);
65930         arg_conv.is_owned = ptr_is_owned(arg);
65931         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65932         arg_conv.is_owned = false;
65933         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
65934         return ret_conv;
65935 }
65936
65937 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
65938         LDKRouteHintHop orig_conv;
65939         orig_conv.inner = untag_ptr(orig);
65940         orig_conv.is_owned = ptr_is_owned(orig);
65941         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65942         orig_conv.is_owned = false;
65943         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
65944         uint64_t ret_ref = 0;
65945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65947         return ret_ref;
65948 }
65949
65950 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
65951         LDKRouteHintHop o_conv;
65952         o_conv.inner = untag_ptr(o);
65953         o_conv.is_owned = ptr_is_owned(o);
65954         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65955         o_conv.is_owned = false;
65956         int64_t ret_conv = RouteHintHop_hash(&o_conv);
65957         return ret_conv;
65958 }
65959
65960 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
65961         LDKRouteHintHop a_conv;
65962         a_conv.inner = untag_ptr(a);
65963         a_conv.is_owned = ptr_is_owned(a);
65964         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65965         a_conv.is_owned = false;
65966         LDKRouteHintHop b_conv;
65967         b_conv.inner = untag_ptr(b);
65968         b_conv.is_owned = ptr_is_owned(b);
65969         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65970         b_conv.is_owned = false;
65971         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
65972         return ret_conv;
65973 }
65974
65975 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
65976         LDKRouteHintHop obj_conv;
65977         obj_conv.inner = untag_ptr(obj);
65978         obj_conv.is_owned = ptr_is_owned(obj);
65979         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65980         obj_conv.is_owned = false;
65981         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
65982         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65983         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65984         CVec_u8Z_free(ret_var);
65985         return ret_arr;
65986 }
65987
65988 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
65989         LDKu8slice ser_ref;
65990         ser_ref.datalen = ser->arr_len;
65991         ser_ref.data = ser->elems;
65992         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
65993         *ret_conv = RouteHintHop_read(ser_ref);
65994         FREE(ser);
65995         return tag_ptr(ret_conv, true);
65996 }
65997
65998 void  __attribute__((export_name("TS_FirstHopCandidate_free"))) TS_FirstHopCandidate_free(uint64_t this_obj) {
65999         LDKFirstHopCandidate this_obj_conv;
66000         this_obj_conv.inner = untag_ptr(this_obj);
66001         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66003         FirstHopCandidate_free(this_obj_conv);
66004 }
66005
66006 static inline uint64_t FirstHopCandidate_clone_ptr(LDKFirstHopCandidate *NONNULL_PTR arg) {
66007         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(arg);
66008         uint64_t ret_ref = 0;
66009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66011         return ret_ref;
66012 }
66013 int64_t  __attribute__((export_name("TS_FirstHopCandidate_clone_ptr"))) TS_FirstHopCandidate_clone_ptr(uint64_t arg) {
66014         LDKFirstHopCandidate arg_conv;
66015         arg_conv.inner = untag_ptr(arg);
66016         arg_conv.is_owned = ptr_is_owned(arg);
66017         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66018         arg_conv.is_owned = false;
66019         int64_t ret_conv = FirstHopCandidate_clone_ptr(&arg_conv);
66020         return ret_conv;
66021 }
66022
66023 uint64_t  __attribute__((export_name("TS_FirstHopCandidate_clone"))) TS_FirstHopCandidate_clone(uint64_t orig) {
66024         LDKFirstHopCandidate orig_conv;
66025         orig_conv.inner = untag_ptr(orig);
66026         orig_conv.is_owned = ptr_is_owned(orig);
66027         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66028         orig_conv.is_owned = false;
66029         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(&orig_conv);
66030         uint64_t ret_ref = 0;
66031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66033         return ret_ref;
66034 }
66035
66036 void  __attribute__((export_name("TS_PublicHopCandidate_free"))) TS_PublicHopCandidate_free(uint64_t this_obj) {
66037         LDKPublicHopCandidate this_obj_conv;
66038         this_obj_conv.inner = untag_ptr(this_obj);
66039         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66041         PublicHopCandidate_free(this_obj_conv);
66042 }
66043
66044 int64_t  __attribute__((export_name("TS_PublicHopCandidate_get_short_channel_id"))) TS_PublicHopCandidate_get_short_channel_id(uint64_t this_ptr) {
66045         LDKPublicHopCandidate this_ptr_conv;
66046         this_ptr_conv.inner = untag_ptr(this_ptr);
66047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66049         this_ptr_conv.is_owned = false;
66050         int64_t ret_conv = PublicHopCandidate_get_short_channel_id(&this_ptr_conv);
66051         return ret_conv;
66052 }
66053
66054 void  __attribute__((export_name("TS_PublicHopCandidate_set_short_channel_id"))) TS_PublicHopCandidate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
66055         LDKPublicHopCandidate this_ptr_conv;
66056         this_ptr_conv.inner = untag_ptr(this_ptr);
66057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66059         this_ptr_conv.is_owned = false;
66060         PublicHopCandidate_set_short_channel_id(&this_ptr_conv, val);
66061 }
66062
66063 static inline uint64_t PublicHopCandidate_clone_ptr(LDKPublicHopCandidate *NONNULL_PTR arg) {
66064         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(arg);
66065         uint64_t ret_ref = 0;
66066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66068         return ret_ref;
66069 }
66070 int64_t  __attribute__((export_name("TS_PublicHopCandidate_clone_ptr"))) TS_PublicHopCandidate_clone_ptr(uint64_t arg) {
66071         LDKPublicHopCandidate arg_conv;
66072         arg_conv.inner = untag_ptr(arg);
66073         arg_conv.is_owned = ptr_is_owned(arg);
66074         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66075         arg_conv.is_owned = false;
66076         int64_t ret_conv = PublicHopCandidate_clone_ptr(&arg_conv);
66077         return ret_conv;
66078 }
66079
66080 uint64_t  __attribute__((export_name("TS_PublicHopCandidate_clone"))) TS_PublicHopCandidate_clone(uint64_t orig) {
66081         LDKPublicHopCandidate orig_conv;
66082         orig_conv.inner = untag_ptr(orig);
66083         orig_conv.is_owned = ptr_is_owned(orig);
66084         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66085         orig_conv.is_owned = false;
66086         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(&orig_conv);
66087         uint64_t ret_ref = 0;
66088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66090         return ret_ref;
66091 }
66092
66093 void  __attribute__((export_name("TS_PrivateHopCandidate_free"))) TS_PrivateHopCandidate_free(uint64_t this_obj) {
66094         LDKPrivateHopCandidate this_obj_conv;
66095         this_obj_conv.inner = untag_ptr(this_obj);
66096         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66098         PrivateHopCandidate_free(this_obj_conv);
66099 }
66100
66101 static inline uint64_t PrivateHopCandidate_clone_ptr(LDKPrivateHopCandidate *NONNULL_PTR arg) {
66102         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(arg);
66103         uint64_t ret_ref = 0;
66104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66106         return ret_ref;
66107 }
66108 int64_t  __attribute__((export_name("TS_PrivateHopCandidate_clone_ptr"))) TS_PrivateHopCandidate_clone_ptr(uint64_t arg) {
66109         LDKPrivateHopCandidate arg_conv;
66110         arg_conv.inner = untag_ptr(arg);
66111         arg_conv.is_owned = ptr_is_owned(arg);
66112         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66113         arg_conv.is_owned = false;
66114         int64_t ret_conv = PrivateHopCandidate_clone_ptr(&arg_conv);
66115         return ret_conv;
66116 }
66117
66118 uint64_t  __attribute__((export_name("TS_PrivateHopCandidate_clone"))) TS_PrivateHopCandidate_clone(uint64_t orig) {
66119         LDKPrivateHopCandidate orig_conv;
66120         orig_conv.inner = untag_ptr(orig);
66121         orig_conv.is_owned = ptr_is_owned(orig);
66122         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66123         orig_conv.is_owned = false;
66124         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(&orig_conv);
66125         uint64_t ret_ref = 0;
66126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66128         return ret_ref;
66129 }
66130
66131 void  __attribute__((export_name("TS_BlindedPathCandidate_free"))) TS_BlindedPathCandidate_free(uint64_t this_obj) {
66132         LDKBlindedPathCandidate this_obj_conv;
66133         this_obj_conv.inner = untag_ptr(this_obj);
66134         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66136         BlindedPathCandidate_free(this_obj_conv);
66137 }
66138
66139 static inline uint64_t BlindedPathCandidate_clone_ptr(LDKBlindedPathCandidate *NONNULL_PTR arg) {
66140         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(arg);
66141         uint64_t ret_ref = 0;
66142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66144         return ret_ref;
66145 }
66146 int64_t  __attribute__((export_name("TS_BlindedPathCandidate_clone_ptr"))) TS_BlindedPathCandidate_clone_ptr(uint64_t arg) {
66147         LDKBlindedPathCandidate arg_conv;
66148         arg_conv.inner = untag_ptr(arg);
66149         arg_conv.is_owned = ptr_is_owned(arg);
66150         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66151         arg_conv.is_owned = false;
66152         int64_t ret_conv = BlindedPathCandidate_clone_ptr(&arg_conv);
66153         return ret_conv;
66154 }
66155
66156 uint64_t  __attribute__((export_name("TS_BlindedPathCandidate_clone"))) TS_BlindedPathCandidate_clone(uint64_t orig) {
66157         LDKBlindedPathCandidate orig_conv;
66158         orig_conv.inner = untag_ptr(orig);
66159         orig_conv.is_owned = ptr_is_owned(orig);
66160         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66161         orig_conv.is_owned = false;
66162         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(&orig_conv);
66163         uint64_t ret_ref = 0;
66164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66166         return ret_ref;
66167 }
66168
66169 void  __attribute__((export_name("TS_OneHopBlindedPathCandidate_free"))) TS_OneHopBlindedPathCandidate_free(uint64_t this_obj) {
66170         LDKOneHopBlindedPathCandidate this_obj_conv;
66171         this_obj_conv.inner = untag_ptr(this_obj);
66172         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66174         OneHopBlindedPathCandidate_free(this_obj_conv);
66175 }
66176
66177 static inline uint64_t OneHopBlindedPathCandidate_clone_ptr(LDKOneHopBlindedPathCandidate *NONNULL_PTR arg) {
66178         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(arg);
66179         uint64_t ret_ref = 0;
66180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66182         return ret_ref;
66183 }
66184 int64_t  __attribute__((export_name("TS_OneHopBlindedPathCandidate_clone_ptr"))) TS_OneHopBlindedPathCandidate_clone_ptr(uint64_t arg) {
66185         LDKOneHopBlindedPathCandidate arg_conv;
66186         arg_conv.inner = untag_ptr(arg);
66187         arg_conv.is_owned = ptr_is_owned(arg);
66188         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66189         arg_conv.is_owned = false;
66190         int64_t ret_conv = OneHopBlindedPathCandidate_clone_ptr(&arg_conv);
66191         return ret_conv;
66192 }
66193
66194 uint64_t  __attribute__((export_name("TS_OneHopBlindedPathCandidate_clone"))) TS_OneHopBlindedPathCandidate_clone(uint64_t orig) {
66195         LDKOneHopBlindedPathCandidate orig_conv;
66196         orig_conv.inner = untag_ptr(orig);
66197         orig_conv.is_owned = ptr_is_owned(orig);
66198         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66199         orig_conv.is_owned = false;
66200         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(&orig_conv);
66201         uint64_t ret_ref = 0;
66202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66204         return ret_ref;
66205 }
66206
66207 void  __attribute__((export_name("TS_CandidateRouteHop_free"))) TS_CandidateRouteHop_free(uint64_t this_ptr) {
66208         if (!ptr_is_owned(this_ptr)) return;
66209         void* this_ptr_ptr = untag_ptr(this_ptr);
66210         CHECK_ACCESS(this_ptr_ptr);
66211         LDKCandidateRouteHop this_ptr_conv = *(LDKCandidateRouteHop*)(this_ptr_ptr);
66212         FREE(untag_ptr(this_ptr));
66213         CandidateRouteHop_free(this_ptr_conv);
66214 }
66215
66216 static inline uint64_t CandidateRouteHop_clone_ptr(LDKCandidateRouteHop *NONNULL_PTR arg) {
66217         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66218         *ret_copy = CandidateRouteHop_clone(arg);
66219         uint64_t ret_ref = tag_ptr(ret_copy, true);
66220         return ret_ref;
66221 }
66222 int64_t  __attribute__((export_name("TS_CandidateRouteHop_clone_ptr"))) TS_CandidateRouteHop_clone_ptr(uint64_t arg) {
66223         LDKCandidateRouteHop* arg_conv = (LDKCandidateRouteHop*)untag_ptr(arg);
66224         int64_t ret_conv = CandidateRouteHop_clone_ptr(arg_conv);
66225         return ret_conv;
66226 }
66227
66228 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_clone"))) TS_CandidateRouteHop_clone(uint64_t orig) {
66229         LDKCandidateRouteHop* orig_conv = (LDKCandidateRouteHop*)untag_ptr(orig);
66230         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66231         *ret_copy = CandidateRouteHop_clone(orig_conv);
66232         uint64_t ret_ref = tag_ptr(ret_copy, true);
66233         return ret_ref;
66234 }
66235
66236 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_first_hop"))) TS_CandidateRouteHop_first_hop(uint64_t a) {
66237         LDKFirstHopCandidate a_conv;
66238         a_conv.inner = untag_ptr(a);
66239         a_conv.is_owned = ptr_is_owned(a);
66240         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66241         a_conv = FirstHopCandidate_clone(&a_conv);
66242         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66243         *ret_copy = CandidateRouteHop_first_hop(a_conv);
66244         uint64_t ret_ref = tag_ptr(ret_copy, true);
66245         return ret_ref;
66246 }
66247
66248 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_public_hop"))) TS_CandidateRouteHop_public_hop(uint64_t a) {
66249         LDKPublicHopCandidate a_conv;
66250         a_conv.inner = untag_ptr(a);
66251         a_conv.is_owned = ptr_is_owned(a);
66252         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66253         a_conv = PublicHopCandidate_clone(&a_conv);
66254         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66255         *ret_copy = CandidateRouteHop_public_hop(a_conv);
66256         uint64_t ret_ref = tag_ptr(ret_copy, true);
66257         return ret_ref;
66258 }
66259
66260 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_private_hop"))) TS_CandidateRouteHop_private_hop(uint64_t a) {
66261         LDKPrivateHopCandidate a_conv;
66262         a_conv.inner = untag_ptr(a);
66263         a_conv.is_owned = ptr_is_owned(a);
66264         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66265         a_conv = PrivateHopCandidate_clone(&a_conv);
66266         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66267         *ret_copy = CandidateRouteHop_private_hop(a_conv);
66268         uint64_t ret_ref = tag_ptr(ret_copy, true);
66269         return ret_ref;
66270 }
66271
66272 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_blinded"))) TS_CandidateRouteHop_blinded(uint64_t a) {
66273         LDKBlindedPathCandidate a_conv;
66274         a_conv.inner = untag_ptr(a);
66275         a_conv.is_owned = ptr_is_owned(a);
66276         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66277         a_conv = BlindedPathCandidate_clone(&a_conv);
66278         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66279         *ret_copy = CandidateRouteHop_blinded(a_conv);
66280         uint64_t ret_ref = tag_ptr(ret_copy, true);
66281         return ret_ref;
66282 }
66283
66284 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_one_hop_blinded"))) TS_CandidateRouteHop_one_hop_blinded(uint64_t a) {
66285         LDKOneHopBlindedPathCandidate a_conv;
66286         a_conv.inner = untag_ptr(a);
66287         a_conv.is_owned = ptr_is_owned(a);
66288         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66289         a_conv = OneHopBlindedPathCandidate_clone(&a_conv);
66290         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66291         *ret_copy = CandidateRouteHop_one_hop_blinded(a_conv);
66292         uint64_t ret_ref = tag_ptr(ret_copy, true);
66293         return ret_ref;
66294 }
66295
66296 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_globally_unique_short_channel_id"))) TS_CandidateRouteHop_globally_unique_short_channel_id(uint64_t this_arg) {
66297         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66298         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66299         *ret_copy = CandidateRouteHop_globally_unique_short_channel_id(this_arg_conv);
66300         uint64_t ret_ref = tag_ptr(ret_copy, true);
66301         return ret_ref;
66302 }
66303
66304 int32_t  __attribute__((export_name("TS_CandidateRouteHop_cltv_expiry_delta"))) TS_CandidateRouteHop_cltv_expiry_delta(uint64_t this_arg) {
66305         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66306         int32_t ret_conv = CandidateRouteHop_cltv_expiry_delta(this_arg_conv);
66307         return ret_conv;
66308 }
66309
66310 int64_t  __attribute__((export_name("TS_CandidateRouteHop_htlc_minimum_msat"))) TS_CandidateRouteHop_htlc_minimum_msat(uint64_t this_arg) {
66311         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66312         int64_t ret_conv = CandidateRouteHop_htlc_minimum_msat(this_arg_conv);
66313         return ret_conv;
66314 }
66315
66316 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_fees"))) TS_CandidateRouteHop_fees(uint64_t this_arg) {
66317         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66318         LDKRoutingFees ret_var = CandidateRouteHop_fees(this_arg_conv);
66319         uint64_t ret_ref = 0;
66320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66322         return ret_ref;
66323 }
66324
66325 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_source"))) TS_CandidateRouteHop_source(uint64_t this_arg) {
66326         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66327         LDKNodeId ret_var = CandidateRouteHop_source(this_arg_conv);
66328         uint64_t ret_ref = 0;
66329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66331         return ret_ref;
66332 }
66333
66334 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_target"))) TS_CandidateRouteHop_target(uint64_t this_arg) {
66335         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66336         LDKNodeId ret_var = CandidateRouteHop_target(this_arg_conv);
66337         uint64_t ret_ref = 0;
66338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66340         return ret_ref;
66341 }
66342
66343 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) {
66344         LDKPublicKey our_node_pubkey_ref;
66345         CHECK(our_node_pubkey->arr_len == 33);
66346         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
66347         LDKRouteParameters route_params_conv;
66348         route_params_conv.inner = untag_ptr(route_params);
66349         route_params_conv.is_owned = ptr_is_owned(route_params);
66350         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
66351         route_params_conv.is_owned = false;
66352         LDKNetworkGraph network_graph_conv;
66353         network_graph_conv.inner = untag_ptr(network_graph);
66354         network_graph_conv.is_owned = ptr_is_owned(network_graph);
66355         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
66356         network_graph_conv.is_owned = false;
66357         LDKCVec_ChannelDetailsZ first_hops_constr;
66358         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
66359         if (first_hops != 0) {
66360                 first_hops_constr.datalen = first_hops->arr_len;
66361                 if (first_hops_constr.datalen > 0)
66362                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
66363                 else
66364                         first_hops_constr.data = NULL;
66365                 uint64_t* first_hops_vals = first_hops->elems;
66366                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
66367                         uint64_t first_hops_conv_16 = first_hops_vals[q];
66368                         LDKChannelDetails first_hops_conv_16_conv;
66369                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
66370                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
66371                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
66372                         first_hops_conv_16_conv.is_owned = false;
66373                         first_hops_constr.data[q] = first_hops_conv_16_conv;
66374                 }
66375                 FREE(first_hops);
66376                 first_hops_ptr = &first_hops_constr;
66377         }
66378         void* logger_ptr = untag_ptr(logger);
66379         CHECK_ACCESS(logger_ptr);
66380         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
66381         if (logger_conv.free == LDKLogger_JCalls_free) {
66382                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66383                 LDKLogger_JCalls_cloned(&logger_conv);
66384         }
66385         void* scorer_ptr = untag_ptr(scorer);
66386         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
66387         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
66388         LDKProbabilisticScoringFeeParameters score_params_conv;
66389         score_params_conv.inner = untag_ptr(score_params);
66390         score_params_conv.is_owned = ptr_is_owned(score_params);
66391         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
66392         score_params_conv.is_owned = false;
66393         uint8_t random_seed_bytes_arr[32];
66394         CHECK(random_seed_bytes->arr_len == 32);
66395         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
66396         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
66397         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
66398         *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);
66399         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
66400         return tag_ptr(ret_conv, true);
66401 }
66402
66403 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) {
66404         LDKPublicKey our_node_pubkey_ref;
66405         CHECK(our_node_pubkey->arr_len == 33);
66406         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
66407         LDKCVec_PublicKeyZ hops_constr;
66408         hops_constr.datalen = hops->arr_len;
66409         if (hops_constr.datalen > 0)
66410                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
66411         else
66412                 hops_constr.data = NULL;
66413         int8_tArray* hops_vals = (void*) hops->elems;
66414         for (size_t m = 0; m < hops_constr.datalen; m++) {
66415                 int8_tArray hops_conv_12 = hops_vals[m];
66416                 LDKPublicKey hops_conv_12_ref;
66417                 CHECK(hops_conv_12->arr_len == 33);
66418                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
66419                 hops_constr.data[m] = hops_conv_12_ref;
66420         }
66421         FREE(hops);
66422         LDKRouteParameters route_params_conv;
66423         route_params_conv.inner = untag_ptr(route_params);
66424         route_params_conv.is_owned = ptr_is_owned(route_params);
66425         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
66426         route_params_conv.is_owned = false;
66427         LDKNetworkGraph network_graph_conv;
66428         network_graph_conv.inner = untag_ptr(network_graph);
66429         network_graph_conv.is_owned = ptr_is_owned(network_graph);
66430         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
66431         network_graph_conv.is_owned = false;
66432         void* logger_ptr = untag_ptr(logger);
66433         CHECK_ACCESS(logger_ptr);
66434         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
66435         if (logger_conv.free == LDKLogger_JCalls_free) {
66436                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66437                 LDKLogger_JCalls_cloned(&logger_conv);
66438         }
66439         uint8_t random_seed_bytes_arr[32];
66440         CHECK(random_seed_bytes->arr_len == 32);
66441         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
66442         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
66443         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
66444         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
66445         return tag_ptr(ret_conv, true);
66446 }
66447
66448 void  __attribute__((export_name("TS_ScoreLookUp_free"))) TS_ScoreLookUp_free(uint64_t this_ptr) {
66449         if (!ptr_is_owned(this_ptr)) return;
66450         void* this_ptr_ptr = untag_ptr(this_ptr);
66451         CHECK_ACCESS(this_ptr_ptr);
66452         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
66453         FREE(untag_ptr(this_ptr));
66454         ScoreLookUp_free(this_ptr_conv);
66455 }
66456
66457 void  __attribute__((export_name("TS_ScoreUpdate_free"))) TS_ScoreUpdate_free(uint64_t this_ptr) {
66458         if (!ptr_is_owned(this_ptr)) return;
66459         void* this_ptr_ptr = untag_ptr(this_ptr);
66460         CHECK_ACCESS(this_ptr_ptr);
66461         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
66462         FREE(untag_ptr(this_ptr));
66463         ScoreUpdate_free(this_ptr_conv);
66464 }
66465
66466 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
66467         if (!ptr_is_owned(this_ptr)) return;
66468         void* this_ptr_ptr = untag_ptr(this_ptr);
66469         CHECK_ACCESS(this_ptr_ptr);
66470         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
66471         FREE(untag_ptr(this_ptr));
66472         Score_free(this_ptr_conv);
66473 }
66474
66475 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
66476         if (!ptr_is_owned(this_ptr)) return;
66477         void* this_ptr_ptr = untag_ptr(this_ptr);
66478         CHECK_ACCESS(this_ptr_ptr);
66479         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
66480         FREE(untag_ptr(this_ptr));
66481         LockableScore_free(this_ptr_conv);
66482 }
66483
66484 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
66485         if (!ptr_is_owned(this_ptr)) return;
66486         void* this_ptr_ptr = untag_ptr(this_ptr);
66487         CHECK_ACCESS(this_ptr_ptr);
66488         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
66489         FREE(untag_ptr(this_ptr));
66490         WriteableScore_free(this_ptr_conv);
66491 }
66492
66493 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
66494         LDKMultiThreadedLockableScore this_obj_conv;
66495         this_obj_conv.inner = untag_ptr(this_obj);
66496         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66498         MultiThreadedLockableScore_free(this_obj_conv);
66499 }
66500
66501 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
66502         LDKMultiThreadedLockableScore this_arg_conv;
66503         this_arg_conv.inner = untag_ptr(this_arg);
66504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66506         this_arg_conv.is_owned = false;
66507         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
66508         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
66509         return tag_ptr(ret_ret, true);
66510 }
66511
66512 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
66513         LDKMultiThreadedLockableScore obj_conv;
66514         obj_conv.inner = untag_ptr(obj);
66515         obj_conv.is_owned = ptr_is_owned(obj);
66516         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66517         obj_conv.is_owned = false;
66518         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
66519         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66520         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66521         CVec_u8Z_free(ret_var);
66522         return ret_arr;
66523 }
66524
66525 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
66526         LDKMultiThreadedLockableScore this_arg_conv;
66527         this_arg_conv.inner = untag_ptr(this_arg);
66528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66530         this_arg_conv.is_owned = false;
66531         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
66532         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
66533         return tag_ptr(ret_ret, true);
66534 }
66535
66536 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
66537         void* score_ptr = untag_ptr(score);
66538         CHECK_ACCESS(score_ptr);
66539         LDKScore score_conv = *(LDKScore*)(score_ptr);
66540         if (score_conv.free == LDKScore_JCalls_free) {
66541                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66542                 LDKScore_JCalls_cloned(&score_conv);
66543         }
66544         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
66545         uint64_t ret_ref = 0;
66546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66548         return ret_ref;
66549 }
66550
66551 void  __attribute__((export_name("TS_MultiThreadedScoreLockRead_free"))) TS_MultiThreadedScoreLockRead_free(uint64_t this_obj) {
66552         LDKMultiThreadedScoreLockRead this_obj_conv;
66553         this_obj_conv.inner = untag_ptr(this_obj);
66554         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66556         MultiThreadedScoreLockRead_free(this_obj_conv);
66557 }
66558
66559 void  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_free"))) TS_MultiThreadedScoreLockWrite_free(uint64_t this_obj) {
66560         LDKMultiThreadedScoreLockWrite this_obj_conv;
66561         this_obj_conv.inner = untag_ptr(this_obj);
66562         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66564         MultiThreadedScoreLockWrite_free(this_obj_conv);
66565 }
66566
66567 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLockRead_as_ScoreLookUp"))) TS_MultiThreadedScoreLockRead_as_ScoreLookUp(uint64_t this_arg) {
66568         LDKMultiThreadedScoreLockRead this_arg_conv;
66569         this_arg_conv.inner = untag_ptr(this_arg);
66570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66572         this_arg_conv.is_owned = false;
66573         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
66574         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
66575         return tag_ptr(ret_ret, true);
66576 }
66577
66578 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_write"))) TS_MultiThreadedScoreLockWrite_write(uint64_t obj) {
66579         LDKMultiThreadedScoreLockWrite obj_conv;
66580         obj_conv.inner = untag_ptr(obj);
66581         obj_conv.is_owned = ptr_is_owned(obj);
66582         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66583         obj_conv.is_owned = false;
66584         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
66585         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66586         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66587         CVec_u8Z_free(ret_var);
66588         return ret_arr;
66589 }
66590
66591 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_as_ScoreUpdate"))) TS_MultiThreadedScoreLockWrite_as_ScoreUpdate(uint64_t this_arg) {
66592         LDKMultiThreadedScoreLockWrite this_arg_conv;
66593         this_arg_conv.inner = untag_ptr(this_arg);
66594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66596         this_arg_conv.is_owned = false;
66597         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
66598         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
66599         return tag_ptr(ret_ret, true);
66600 }
66601
66602 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
66603         LDKChannelUsage this_obj_conv;
66604         this_obj_conv.inner = untag_ptr(this_obj);
66605         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66607         ChannelUsage_free(this_obj_conv);
66608 }
66609
66610 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
66611         LDKChannelUsage this_ptr_conv;
66612         this_ptr_conv.inner = untag_ptr(this_ptr);
66613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66615         this_ptr_conv.is_owned = false;
66616         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
66617         return ret_conv;
66618 }
66619
66620 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
66621         LDKChannelUsage this_ptr_conv;
66622         this_ptr_conv.inner = untag_ptr(this_ptr);
66623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66625         this_ptr_conv.is_owned = false;
66626         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
66627 }
66628
66629 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
66630         LDKChannelUsage this_ptr_conv;
66631         this_ptr_conv.inner = untag_ptr(this_ptr);
66632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66634         this_ptr_conv.is_owned = false;
66635         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
66636         return ret_conv;
66637 }
66638
66639 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
66640         LDKChannelUsage this_ptr_conv;
66641         this_ptr_conv.inner = untag_ptr(this_ptr);
66642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66644         this_ptr_conv.is_owned = false;
66645         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
66646 }
66647
66648 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
66649         LDKChannelUsage this_ptr_conv;
66650         this_ptr_conv.inner = untag_ptr(this_ptr);
66651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66653         this_ptr_conv.is_owned = false;
66654         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
66655         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
66656         uint64_t ret_ref = tag_ptr(ret_copy, true);
66657         return ret_ref;
66658 }
66659
66660 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
66661         LDKChannelUsage this_ptr_conv;
66662         this_ptr_conv.inner = untag_ptr(this_ptr);
66663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66665         this_ptr_conv.is_owned = false;
66666         void* val_ptr = untag_ptr(val);
66667         CHECK_ACCESS(val_ptr);
66668         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
66669         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
66670         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
66671 }
66672
66673 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) {
66674         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
66675         CHECK_ACCESS(effective_capacity_arg_ptr);
66676         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
66677         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
66678         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
66679         uint64_t ret_ref = 0;
66680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66682         return ret_ref;
66683 }
66684
66685 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
66686         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
66687         uint64_t ret_ref = 0;
66688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66690         return ret_ref;
66691 }
66692 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
66693         LDKChannelUsage arg_conv;
66694         arg_conv.inner = untag_ptr(arg);
66695         arg_conv.is_owned = ptr_is_owned(arg);
66696         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66697         arg_conv.is_owned = false;
66698         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
66699         return ret_conv;
66700 }
66701
66702 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
66703         LDKChannelUsage orig_conv;
66704         orig_conv.inner = untag_ptr(orig);
66705         orig_conv.is_owned = ptr_is_owned(orig);
66706         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66707         orig_conv.is_owned = false;
66708         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
66709         uint64_t ret_ref = 0;
66710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66712         return ret_ref;
66713 }
66714
66715 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
66716         LDKFixedPenaltyScorer this_obj_conv;
66717         this_obj_conv.inner = untag_ptr(this_obj);
66718         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66720         FixedPenaltyScorer_free(this_obj_conv);
66721 }
66722
66723 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
66724         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
66725         uint64_t ret_ref = 0;
66726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66728         return ret_ref;
66729 }
66730 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
66731         LDKFixedPenaltyScorer arg_conv;
66732         arg_conv.inner = untag_ptr(arg);
66733         arg_conv.is_owned = ptr_is_owned(arg);
66734         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66735         arg_conv.is_owned = false;
66736         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
66737         return ret_conv;
66738 }
66739
66740 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
66741         LDKFixedPenaltyScorer orig_conv;
66742         orig_conv.inner = untag_ptr(orig);
66743         orig_conv.is_owned = ptr_is_owned(orig);
66744         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66745         orig_conv.is_owned = false;
66746         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
66747         uint64_t ret_ref = 0;
66748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66750         return ret_ref;
66751 }
66752
66753 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
66754         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
66755         uint64_t ret_ref = 0;
66756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66758         return ret_ref;
66759 }
66760
66761 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_ScoreLookUp"))) TS_FixedPenaltyScorer_as_ScoreLookUp(uint64_t this_arg) {
66762         LDKFixedPenaltyScorer this_arg_conv;
66763         this_arg_conv.inner = untag_ptr(this_arg);
66764         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66766         this_arg_conv.is_owned = false;
66767         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
66768         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
66769         return tag_ptr(ret_ret, true);
66770 }
66771
66772 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_ScoreUpdate"))) TS_FixedPenaltyScorer_as_ScoreUpdate(uint64_t this_arg) {
66773         LDKFixedPenaltyScorer this_arg_conv;
66774         this_arg_conv.inner = untag_ptr(this_arg);
66775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66777         this_arg_conv.is_owned = false;
66778         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
66779         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
66780         return tag_ptr(ret_ret, true);
66781 }
66782
66783 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
66784         LDKFixedPenaltyScorer obj_conv;
66785         obj_conv.inner = untag_ptr(obj);
66786         obj_conv.is_owned = ptr_is_owned(obj);
66787         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66788         obj_conv.is_owned = false;
66789         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
66790         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66791         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66792         CVec_u8Z_free(ret_var);
66793         return ret_arr;
66794 }
66795
66796 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
66797         LDKu8slice ser_ref;
66798         ser_ref.datalen = ser->arr_len;
66799         ser_ref.data = ser->elems;
66800         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
66801         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
66802         FREE(ser);
66803         return tag_ptr(ret_conv, true);
66804 }
66805
66806 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
66807         LDKProbabilisticScorer this_obj_conv;
66808         this_obj_conv.inner = untag_ptr(this_obj);
66809         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66811         ProbabilisticScorer_free(this_obj_conv);
66812 }
66813
66814 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_free"))) TS_ProbabilisticScoringFeeParameters_free(uint64_t this_obj) {
66815         LDKProbabilisticScoringFeeParameters this_obj_conv;
66816         this_obj_conv.inner = untag_ptr(this_obj);
66817         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66819         ProbabilisticScoringFeeParameters_free(this_obj_conv);
66820 }
66821
66822 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat(uint64_t this_ptr) {
66823         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66824         this_ptr_conv.inner = untag_ptr(this_ptr);
66825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66827         this_ptr_conv.is_owned = false;
66828         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
66829         return ret_conv;
66830 }
66831
66832 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
66833         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66834         this_ptr_conv.inner = untag_ptr(this_ptr);
66835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66837         this_ptr_conv.is_owned = false;
66838         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
66839 }
66840
66841 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) {
66842         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66843         this_ptr_conv.inner = untag_ptr(this_ptr);
66844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66846         this_ptr_conv.is_owned = false;
66847         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
66848         return ret_conv;
66849 }
66850
66851 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) {
66852         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66853         this_ptr_conv.inner = untag_ptr(this_ptr);
66854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66856         this_ptr_conv.is_owned = false;
66857         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
66858 }
66859
66860 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
66861         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66862         this_ptr_conv.inner = untag_ptr(this_ptr);
66863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66865         this_ptr_conv.is_owned = false;
66866         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
66867         return ret_conv;
66868 }
66869
66870 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) {
66871         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66872         this_ptr_conv.inner = untag_ptr(this_ptr);
66873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66875         this_ptr_conv.is_owned = false;
66876         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
66877 }
66878
66879 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) {
66880         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66881         this_ptr_conv.inner = untag_ptr(this_ptr);
66882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66884         this_ptr_conv.is_owned = false;
66885         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
66886         return ret_conv;
66887 }
66888
66889 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) {
66890         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66891         this_ptr_conv.inner = untag_ptr(this_ptr);
66892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66894         this_ptr_conv.is_owned = false;
66895         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
66896 }
66897
66898 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) {
66899         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66900         this_ptr_conv.inner = untag_ptr(this_ptr);
66901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66903         this_ptr_conv.is_owned = false;
66904         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
66905         return ret_conv;
66906 }
66907
66908 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) {
66909         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66910         this_ptr_conv.inner = untag_ptr(this_ptr);
66911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66913         this_ptr_conv.is_owned = false;
66914         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
66915 }
66916
66917 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) {
66918         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66919         this_ptr_conv.inner = untag_ptr(this_ptr);
66920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66922         this_ptr_conv.is_owned = false;
66923         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
66924         return ret_conv;
66925 }
66926
66927 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) {
66928         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66929         this_ptr_conv.inner = untag_ptr(this_ptr);
66930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66932         this_ptr_conv.is_owned = false;
66933         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
66934 }
66935
66936 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
66937         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66938         this_ptr_conv.inner = untag_ptr(this_ptr);
66939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66941         this_ptr_conv.is_owned = false;
66942         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
66943         return ret_conv;
66944 }
66945
66946 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) {
66947         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66948         this_ptr_conv.inner = untag_ptr(this_ptr);
66949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66951         this_ptr_conv.is_owned = false;
66952         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
66953 }
66954
66955 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
66956         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66957         this_ptr_conv.inner = untag_ptr(this_ptr);
66958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66960         this_ptr_conv.is_owned = false;
66961         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
66962         return ret_conv;
66963 }
66964
66965 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) {
66966         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66967         this_ptr_conv.inner = untag_ptr(this_ptr);
66968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66970         this_ptr_conv.is_owned = false;
66971         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
66972 }
66973
66974 jboolean  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_linear_success_probability"))) TS_ProbabilisticScoringFeeParameters_get_linear_success_probability(uint64_t this_ptr) {
66975         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66976         this_ptr_conv.inner = untag_ptr(this_ptr);
66977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66979         this_ptr_conv.is_owned = false;
66980         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
66981         return ret_conv;
66982 }
66983
66984 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_linear_success_probability"))) TS_ProbabilisticScoringFeeParameters_set_linear_success_probability(uint64_t this_ptr, jboolean val) {
66985         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66986         this_ptr_conv.inner = untag_ptr(this_ptr);
66987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66989         this_ptr_conv.is_owned = false;
66990         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
66991 }
66992
66993 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
66994         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
66995         uint64_t ret_ref = 0;
66996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66998         return ret_ref;
66999 }
67000 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone_ptr"))) TS_ProbabilisticScoringFeeParameters_clone_ptr(uint64_t arg) {
67001         LDKProbabilisticScoringFeeParameters arg_conv;
67002         arg_conv.inner = untag_ptr(arg);
67003         arg_conv.is_owned = ptr_is_owned(arg);
67004         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67005         arg_conv.is_owned = false;
67006         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
67007         return ret_conv;
67008 }
67009
67010 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone"))) TS_ProbabilisticScoringFeeParameters_clone(uint64_t orig) {
67011         LDKProbabilisticScoringFeeParameters orig_conv;
67012         orig_conv.inner = untag_ptr(orig);
67013         orig_conv.is_owned = ptr_is_owned(orig);
67014         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67015         orig_conv.is_owned = false;
67016         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
67017         uint64_t ret_ref = 0;
67018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67020         return ret_ref;
67021 }
67022
67023 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_default"))) TS_ProbabilisticScoringFeeParameters_default() {
67024         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
67025         uint64_t ret_ref = 0;
67026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67028         return ret_ref;
67029 }
67030
67031 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned"))) TS_ProbabilisticScoringFeeParameters_add_banned(uint64_t this_arg, uint64_t node_id) {
67032         LDKProbabilisticScoringFeeParameters this_arg_conv;
67033         this_arg_conv.inner = untag_ptr(this_arg);
67034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67036         this_arg_conv.is_owned = false;
67037         LDKNodeId node_id_conv;
67038         node_id_conv.inner = untag_ptr(node_id);
67039         node_id_conv.is_owned = ptr_is_owned(node_id);
67040         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
67041         node_id_conv.is_owned = false;
67042         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
67043 }
67044
67045 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned_from_list"))) TS_ProbabilisticScoringFeeParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
67046         LDKProbabilisticScoringFeeParameters this_arg_conv;
67047         this_arg_conv.inner = untag_ptr(this_arg);
67048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67050         this_arg_conv.is_owned = false;
67051         LDKCVec_NodeIdZ node_ids_constr;
67052         node_ids_constr.datalen = node_ids->arr_len;
67053         if (node_ids_constr.datalen > 0)
67054                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
67055         else
67056                 node_ids_constr.data = NULL;
67057         uint64_t* node_ids_vals = node_ids->elems;
67058         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
67059                 uint64_t node_ids_conv_8 = node_ids_vals[i];
67060                 LDKNodeId node_ids_conv_8_conv;
67061                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
67062                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
67063                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
67064                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
67065                 node_ids_constr.data[i] = node_ids_conv_8_conv;
67066         }
67067         FREE(node_ids);
67068         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
67069 }
67070
67071 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_banned"))) TS_ProbabilisticScoringFeeParameters_remove_banned(uint64_t this_arg, uint64_t node_id) {
67072         LDKProbabilisticScoringFeeParameters this_arg_conv;
67073         this_arg_conv.inner = untag_ptr(this_arg);
67074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67076         this_arg_conv.is_owned = false;
67077         LDKNodeId node_id_conv;
67078         node_id_conv.inner = untag_ptr(node_id);
67079         node_id_conv.is_owned = ptr_is_owned(node_id);
67080         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
67081         node_id_conv.is_owned = false;
67082         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
67083 }
67084
67085 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) {
67086         LDKProbabilisticScoringFeeParameters this_arg_conv;
67087         this_arg_conv.inner = untag_ptr(this_arg);
67088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67090         this_arg_conv.is_owned = false;
67091         LDKNodeId node_id_conv;
67092         node_id_conv.inner = untag_ptr(node_id);
67093         node_id_conv.is_owned = ptr_is_owned(node_id);
67094         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
67095         node_id_conv.is_owned = false;
67096         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
67097 }
67098
67099 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_manual_penalty"))) TS_ProbabilisticScoringFeeParameters_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
67100         LDKProbabilisticScoringFeeParameters this_arg_conv;
67101         this_arg_conv.inner = untag_ptr(this_arg);
67102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67104         this_arg_conv.is_owned = false;
67105         LDKNodeId node_id_conv;
67106         node_id_conv.inner = untag_ptr(node_id);
67107         node_id_conv.is_owned = ptr_is_owned(node_id);
67108         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
67109         node_id_conv.is_owned = false;
67110         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
67111 }
67112
67113 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clear_manual_penalties"))) TS_ProbabilisticScoringFeeParameters_clear_manual_penalties(uint64_t this_arg) {
67114         LDKProbabilisticScoringFeeParameters this_arg_conv;
67115         this_arg_conv.inner = untag_ptr(this_arg);
67116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67118         this_arg_conv.is_owned = false;
67119         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
67120 }
67121
67122 void  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_free"))) TS_ProbabilisticScoringDecayParameters_free(uint64_t this_obj) {
67123         LDKProbabilisticScoringDecayParameters this_obj_conv;
67124         this_obj_conv.inner = untag_ptr(this_obj);
67125         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67127         ProbabilisticScoringDecayParameters_free(this_obj_conv);
67128 }
67129
67130 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) {
67131         LDKProbabilisticScoringDecayParameters this_ptr_conv;
67132         this_ptr_conv.inner = untag_ptr(this_ptr);
67133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67135         this_ptr_conv.is_owned = false;
67136         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
67137         return ret_conv;
67138 }
67139
67140 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) {
67141         LDKProbabilisticScoringDecayParameters this_ptr_conv;
67142         this_ptr_conv.inner = untag_ptr(this_ptr);
67143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67145         this_ptr_conv.is_owned = false;
67146         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
67147 }
67148
67149 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
67150         LDKProbabilisticScoringDecayParameters this_ptr_conv;
67151         this_ptr_conv.inner = untag_ptr(this_ptr);
67152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67154         this_ptr_conv.is_owned = false;
67155         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
67156         return ret_conv;
67157 }
67158
67159 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) {
67160         LDKProbabilisticScoringDecayParameters this_ptr_conv;
67161         this_ptr_conv.inner = untag_ptr(this_ptr);
67162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67164         this_ptr_conv.is_owned = false;
67165         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
67166 }
67167
67168 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) {
67169         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
67170         uint64_t ret_ref = 0;
67171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67173         return ret_ref;
67174 }
67175
67176 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
67177         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
67178         uint64_t ret_ref = 0;
67179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67181         return ret_ref;
67182 }
67183 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone_ptr"))) TS_ProbabilisticScoringDecayParameters_clone_ptr(uint64_t arg) {
67184         LDKProbabilisticScoringDecayParameters arg_conv;
67185         arg_conv.inner = untag_ptr(arg);
67186         arg_conv.is_owned = ptr_is_owned(arg);
67187         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67188         arg_conv.is_owned = false;
67189         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
67190         return ret_conv;
67191 }
67192
67193 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone"))) TS_ProbabilisticScoringDecayParameters_clone(uint64_t orig) {
67194         LDKProbabilisticScoringDecayParameters orig_conv;
67195         orig_conv.inner = untag_ptr(orig);
67196         orig_conv.is_owned = ptr_is_owned(orig);
67197         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67198         orig_conv.is_owned = false;
67199         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
67200         uint64_t ret_ref = 0;
67201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67203         return ret_ref;
67204 }
67205
67206 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_default"))) TS_ProbabilisticScoringDecayParameters_default() {
67207         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
67208         uint64_t ret_ref = 0;
67209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67211         return ret_ref;
67212 }
67213
67214 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t decay_params, uint64_t network_graph, uint64_t logger) {
67215         LDKProbabilisticScoringDecayParameters decay_params_conv;
67216         decay_params_conv.inner = untag_ptr(decay_params);
67217         decay_params_conv.is_owned = ptr_is_owned(decay_params);
67218         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
67219         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
67220         LDKNetworkGraph network_graph_conv;
67221         network_graph_conv.inner = untag_ptr(network_graph);
67222         network_graph_conv.is_owned = ptr_is_owned(network_graph);
67223         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
67224         network_graph_conv.is_owned = false;
67225         void* logger_ptr = untag_ptr(logger);
67226         CHECK_ACCESS(logger_ptr);
67227         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67228         if (logger_conv.free == LDKLogger_JCalls_free) {
67229                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67230                 LDKLogger_JCalls_cloned(&logger_conv);
67231         }
67232         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
67233         uint64_t ret_ref = 0;
67234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67236         return ret_ref;
67237 }
67238
67239 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
67240         LDKProbabilisticScorer this_arg_conv;
67241         this_arg_conv.inner = untag_ptr(this_arg);
67242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67244         this_arg_conv.is_owned = false;
67245         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
67246 }
67247
67248 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) {
67249         LDKProbabilisticScorer this_arg_conv;
67250         this_arg_conv.inner = untag_ptr(this_arg);
67251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67253         this_arg_conv.is_owned = false;
67254         LDKNodeId target_conv;
67255         target_conv.inner = untag_ptr(target);
67256         target_conv.is_owned = ptr_is_owned(target);
67257         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
67258         target_conv.is_owned = false;
67259         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
67260         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
67261         uint64_t ret_ref = tag_ptr(ret_copy, true);
67262         return ret_ref;
67263 }
67264
67265 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) {
67266         LDKProbabilisticScorer this_arg_conv;
67267         this_arg_conv.inner = untag_ptr(this_arg);
67268         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67270         this_arg_conv.is_owned = false;
67271         LDKNodeId target_conv;
67272         target_conv.inner = untag_ptr(target);
67273         target_conv.is_owned = ptr_is_owned(target);
67274         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
67275         target_conv.is_owned = false;
67276         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
67277         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
67278         uint64_t ret_ref = tag_ptr(ret_copy, true);
67279         return ret_ref;
67280 }
67281
67282 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_historical_estimated_payment_success_probability"))) TS_ProbabilisticScorer_historical_estimated_payment_success_probability(uint64_t this_arg, int64_t scid, uint64_t target, int64_t amount_msat, uint64_t params) {
67283         LDKProbabilisticScorer this_arg_conv;
67284         this_arg_conv.inner = untag_ptr(this_arg);
67285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67287         this_arg_conv.is_owned = false;
67288         LDKNodeId target_conv;
67289         target_conv.inner = untag_ptr(target);
67290         target_conv.is_owned = ptr_is_owned(target);
67291         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
67292         target_conv.is_owned = false;
67293         LDKProbabilisticScoringFeeParameters params_conv;
67294         params_conv.inner = untag_ptr(params);
67295         params_conv.is_owned = ptr_is_owned(params);
67296         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
67297         params_conv.is_owned = false;
67298         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
67299         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
67300         uint64_t ret_ref = tag_ptr(ret_copy, true);
67301         return ret_ref;
67302 }
67303
67304 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_ScoreLookUp"))) TS_ProbabilisticScorer_as_ScoreLookUp(uint64_t this_arg) {
67305         LDKProbabilisticScorer this_arg_conv;
67306         this_arg_conv.inner = untag_ptr(this_arg);
67307         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67309         this_arg_conv.is_owned = false;
67310         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
67311         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
67312         return tag_ptr(ret_ret, true);
67313 }
67314
67315 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_ScoreUpdate"))) TS_ProbabilisticScorer_as_ScoreUpdate(uint64_t this_arg) {
67316         LDKProbabilisticScorer this_arg_conv;
67317         this_arg_conv.inner = untag_ptr(this_arg);
67318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67320         this_arg_conv.is_owned = false;
67321         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
67322         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
67323         return tag_ptr(ret_ret, true);
67324 }
67325
67326 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
67327         LDKProbabilisticScorer this_arg_conv;
67328         this_arg_conv.inner = untag_ptr(this_arg);
67329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67331         this_arg_conv.is_owned = false;
67332         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
67333         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
67334         return tag_ptr(ret_ret, true);
67335 }
67336
67337 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
67338         LDKProbabilisticScorer obj_conv;
67339         obj_conv.inner = untag_ptr(obj);
67340         obj_conv.is_owned = ptr_is_owned(obj);
67341         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67342         obj_conv.is_owned = false;
67343         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
67344         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67345         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67346         CVec_u8Z_free(ret_var);
67347         return ret_arr;
67348 }
67349
67350 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) {
67351         LDKu8slice ser_ref;
67352         ser_ref.datalen = ser->arr_len;
67353         ser_ref.data = ser->elems;
67354         LDKProbabilisticScoringDecayParameters arg_a_conv;
67355         arg_a_conv.inner = untag_ptr(arg_a);
67356         arg_a_conv.is_owned = ptr_is_owned(arg_a);
67357         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
67358         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
67359         LDKNetworkGraph arg_b_conv;
67360         arg_b_conv.inner = untag_ptr(arg_b);
67361         arg_b_conv.is_owned = ptr_is_owned(arg_b);
67362         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
67363         arg_b_conv.is_owned = false;
67364         void* arg_c_ptr = untag_ptr(arg_c);
67365         CHECK_ACCESS(arg_c_ptr);
67366         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
67367         if (arg_c_conv.free == LDKLogger_JCalls_free) {
67368                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67369                 LDKLogger_JCalls_cloned(&arg_c_conv);
67370         }
67371         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
67372         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
67373         FREE(ser);
67374         return tag_ptr(ret_conv, true);
67375 }
67376
67377 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
67378         LDKDelayedPaymentOutputDescriptor this_obj_conv;
67379         this_obj_conv.inner = untag_ptr(this_obj);
67380         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67382         DelayedPaymentOutputDescriptor_free(this_obj_conv);
67383 }
67384
67385 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
67386         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67387         this_ptr_conv.inner = untag_ptr(this_ptr);
67388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67390         this_ptr_conv.is_owned = false;
67391         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
67392         uint64_t ret_ref = 0;
67393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67395         return ret_ref;
67396 }
67397
67398 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
67399         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67400         this_ptr_conv.inner = untag_ptr(this_ptr);
67401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67403         this_ptr_conv.is_owned = false;
67404         LDKOutPoint val_conv;
67405         val_conv.inner = untag_ptr(val);
67406         val_conv.is_owned = ptr_is_owned(val);
67407         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67408         val_conv = OutPoint_clone(&val_conv);
67409         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
67410 }
67411
67412 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
67413         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67414         this_ptr_conv.inner = untag_ptr(this_ptr);
67415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67417         this_ptr_conv.is_owned = false;
67418         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67419         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
67420         return ret_arr;
67421 }
67422
67423 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
67424         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67425         this_ptr_conv.inner = untag_ptr(this_ptr);
67426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67428         this_ptr_conv.is_owned = false;
67429         LDKPublicKey val_ref;
67430         CHECK(val->arr_len == 33);
67431         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
67432         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
67433 }
67434
67435 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
67436         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67437         this_ptr_conv.inner = untag_ptr(this_ptr);
67438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67440         this_ptr_conv.is_owned = false;
67441         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
67442         return ret_conv;
67443 }
67444
67445 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
67446         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67447         this_ptr_conv.inner = untag_ptr(this_ptr);
67448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67450         this_ptr_conv.is_owned = false;
67451         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
67452 }
67453
67454 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
67455         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67456         this_ptr_conv.inner = untag_ptr(this_ptr);
67457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67459         this_ptr_conv.is_owned = false;
67460         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
67461         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
67462         return tag_ptr(ret_ref, true);
67463 }
67464
67465 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
67466         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67467         this_ptr_conv.inner = untag_ptr(this_ptr);
67468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67470         this_ptr_conv.is_owned = false;
67471         void* val_ptr = untag_ptr(val);
67472         CHECK_ACCESS(val_ptr);
67473         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
67474         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
67475         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
67476 }
67477
67478 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
67479         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67480         this_ptr_conv.inner = untag_ptr(this_ptr);
67481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67483         this_ptr_conv.is_owned = false;
67484         LDKRevocationKey ret_var = DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv);
67485         uint64_t ret_ref = 0;
67486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67488         return ret_ref;
67489 }
67490
67491 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, uint64_t val) {
67492         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67493         this_ptr_conv.inner = untag_ptr(this_ptr);
67494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67496         this_ptr_conv.is_owned = false;
67497         LDKRevocationKey val_conv;
67498         val_conv.inner = untag_ptr(val);
67499         val_conv.is_owned = ptr_is_owned(val);
67500         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67501         val_conv = RevocationKey_clone(&val_conv);
67502         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_conv);
67503 }
67504
67505 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
67506         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67507         this_ptr_conv.inner = untag_ptr(this_ptr);
67508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67510         this_ptr_conv.is_owned = false;
67511         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
67512         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
67513         return ret_arr;
67514 }
67515
67516 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
67517         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67518         this_ptr_conv.inner = untag_ptr(this_ptr);
67519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67521         this_ptr_conv.is_owned = false;
67522         LDKThirtyTwoBytes val_ref;
67523         CHECK(val->arr_len == 32);
67524         memcpy(val_ref.data, val->elems, 32); FREE(val);
67525         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
67526 }
67527
67528 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
67529         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67530         this_ptr_conv.inner = untag_ptr(this_ptr);
67531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67533         this_ptr_conv.is_owned = false;
67534         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
67535         return ret_conv;
67536 }
67537
67538 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
67539         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67540         this_ptr_conv.inner = untag_ptr(this_ptr);
67541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67543         this_ptr_conv.is_owned = false;
67544         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
67545 }
67546
67547 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_new"))) TS_DelayedPaymentOutputDescriptor_new(uint64_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, uint64_t output_arg, uint64_t revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
67548         LDKOutPoint outpoint_arg_conv;
67549         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
67550         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
67551         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
67552         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
67553         LDKPublicKey per_commitment_point_arg_ref;
67554         CHECK(per_commitment_point_arg->arr_len == 33);
67555         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
67556         void* output_arg_ptr = untag_ptr(output_arg);
67557         CHECK_ACCESS(output_arg_ptr);
67558         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
67559         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
67560         LDKRevocationKey revocation_pubkey_arg_conv;
67561         revocation_pubkey_arg_conv.inner = untag_ptr(revocation_pubkey_arg);
67562         revocation_pubkey_arg_conv.is_owned = ptr_is_owned(revocation_pubkey_arg);
67563         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_pubkey_arg_conv);
67564         revocation_pubkey_arg_conv = RevocationKey_clone(&revocation_pubkey_arg_conv);
67565         LDKThirtyTwoBytes channel_keys_id_arg_ref;
67566         CHECK(channel_keys_id_arg->arr_len == 32);
67567         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
67568         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
67569         uint64_t ret_ref = 0;
67570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67572         return ret_ref;
67573 }
67574
67575 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
67576         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
67577         uint64_t ret_ref = 0;
67578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67580         return ret_ref;
67581 }
67582 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
67583         LDKDelayedPaymentOutputDescriptor arg_conv;
67584         arg_conv.inner = untag_ptr(arg);
67585         arg_conv.is_owned = ptr_is_owned(arg);
67586         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67587         arg_conv.is_owned = false;
67588         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
67589         return ret_conv;
67590 }
67591
67592 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
67593         LDKDelayedPaymentOutputDescriptor orig_conv;
67594         orig_conv.inner = untag_ptr(orig);
67595         orig_conv.is_owned = ptr_is_owned(orig);
67596         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67597         orig_conv.is_owned = false;
67598         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
67599         uint64_t ret_ref = 0;
67600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67602         return ret_ref;
67603 }
67604
67605 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_hash"))) TS_DelayedPaymentOutputDescriptor_hash(uint64_t o) {
67606         LDKDelayedPaymentOutputDescriptor o_conv;
67607         o_conv.inner = untag_ptr(o);
67608         o_conv.is_owned = ptr_is_owned(o);
67609         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67610         o_conv.is_owned = false;
67611         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
67612         return ret_conv;
67613 }
67614
67615 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
67616         LDKDelayedPaymentOutputDescriptor a_conv;
67617         a_conv.inner = untag_ptr(a);
67618         a_conv.is_owned = ptr_is_owned(a);
67619         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67620         a_conv.is_owned = false;
67621         LDKDelayedPaymentOutputDescriptor b_conv;
67622         b_conv.inner = untag_ptr(b);
67623         b_conv.is_owned = ptr_is_owned(b);
67624         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67625         b_conv.is_owned = false;
67626         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
67627         return ret_conv;
67628 }
67629
67630 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
67631         LDKDelayedPaymentOutputDescriptor obj_conv;
67632         obj_conv.inner = untag_ptr(obj);
67633         obj_conv.is_owned = ptr_is_owned(obj);
67634         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67635         obj_conv.is_owned = false;
67636         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
67637         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67638         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67639         CVec_u8Z_free(ret_var);
67640         return ret_arr;
67641 }
67642
67643 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
67644         LDKu8slice ser_ref;
67645         ser_ref.datalen = ser->arr_len;
67646         ser_ref.data = ser->elems;
67647         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
67648         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
67649         FREE(ser);
67650         return tag_ptr(ret_conv, true);
67651 }
67652
67653 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
67654         LDKStaticPaymentOutputDescriptor this_obj_conv;
67655         this_obj_conv.inner = untag_ptr(this_obj);
67656         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67658         StaticPaymentOutputDescriptor_free(this_obj_conv);
67659 }
67660
67661 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
67662         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67663         this_ptr_conv.inner = untag_ptr(this_ptr);
67664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67666         this_ptr_conv.is_owned = false;
67667         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
67668         uint64_t ret_ref = 0;
67669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67671         return ret_ref;
67672 }
67673
67674 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
67675         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67676         this_ptr_conv.inner = untag_ptr(this_ptr);
67677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67679         this_ptr_conv.is_owned = false;
67680         LDKOutPoint val_conv;
67681         val_conv.inner = untag_ptr(val);
67682         val_conv.is_owned = ptr_is_owned(val);
67683         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67684         val_conv = OutPoint_clone(&val_conv);
67685         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
67686 }
67687
67688 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
67689         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67690         this_ptr_conv.inner = untag_ptr(this_ptr);
67691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67693         this_ptr_conv.is_owned = false;
67694         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
67695         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
67696         return tag_ptr(ret_ref, true);
67697 }
67698
67699 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
67700         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67701         this_ptr_conv.inner = untag_ptr(this_ptr);
67702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67704         this_ptr_conv.is_owned = false;
67705         void* val_ptr = untag_ptr(val);
67706         CHECK_ACCESS(val_ptr);
67707         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
67708         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
67709         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
67710 }
67711
67712 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
67713         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67714         this_ptr_conv.inner = untag_ptr(this_ptr);
67715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67717         this_ptr_conv.is_owned = false;
67718         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
67719         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
67720         return ret_arr;
67721 }
67722
67723 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
67724         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67725         this_ptr_conv.inner = untag_ptr(this_ptr);
67726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67728         this_ptr_conv.is_owned = false;
67729         LDKThirtyTwoBytes val_ref;
67730         CHECK(val->arr_len == 32);
67731         memcpy(val_ref.data, val->elems, 32); FREE(val);
67732         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
67733 }
67734
67735 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
67736         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67737         this_ptr_conv.inner = untag_ptr(this_ptr);
67738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67740         this_ptr_conv.is_owned = false;
67741         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
67742         return ret_conv;
67743 }
67744
67745 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
67746         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67747         this_ptr_conv.inner = untag_ptr(this_ptr);
67748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67750         this_ptr_conv.is_owned = false;
67751         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
67752 }
67753
67754 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_transaction_parameters"))) TS_StaticPaymentOutputDescriptor_get_channel_transaction_parameters(uint64_t this_ptr) {
67755         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67756         this_ptr_conv.inner = untag_ptr(this_ptr);
67757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67759         this_ptr_conv.is_owned = false;
67760         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
67761         uint64_t ret_ref = 0;
67762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67764         return ret_ref;
67765 }
67766
67767 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_transaction_parameters"))) TS_StaticPaymentOutputDescriptor_set_channel_transaction_parameters(uint64_t this_ptr, uint64_t val) {
67768         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67769         this_ptr_conv.inner = untag_ptr(this_ptr);
67770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67772         this_ptr_conv.is_owned = false;
67773         LDKChannelTransactionParameters val_conv;
67774         val_conv.inner = untag_ptr(val);
67775         val_conv.is_owned = ptr_is_owned(val);
67776         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67777         val_conv = ChannelTransactionParameters_clone(&val_conv);
67778         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
67779 }
67780
67781 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_new"))) TS_StaticPaymentOutputDescriptor_new(uint64_t outpoint_arg, uint64_t output_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg, uint64_t channel_transaction_parameters_arg) {
67782         LDKOutPoint outpoint_arg_conv;
67783         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
67784         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
67785         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
67786         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
67787         void* output_arg_ptr = untag_ptr(output_arg);
67788         CHECK_ACCESS(output_arg_ptr);
67789         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
67790         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
67791         LDKThirtyTwoBytes channel_keys_id_arg_ref;
67792         CHECK(channel_keys_id_arg->arr_len == 32);
67793         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
67794         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
67795         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
67796         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
67797         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
67798         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
67799         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg, channel_transaction_parameters_arg_conv);
67800         uint64_t ret_ref = 0;
67801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67803         return ret_ref;
67804 }
67805
67806 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
67807         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
67808         uint64_t ret_ref = 0;
67809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67811         return ret_ref;
67812 }
67813 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
67814         LDKStaticPaymentOutputDescriptor arg_conv;
67815         arg_conv.inner = untag_ptr(arg);
67816         arg_conv.is_owned = ptr_is_owned(arg);
67817         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67818         arg_conv.is_owned = false;
67819         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
67820         return ret_conv;
67821 }
67822
67823 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
67824         LDKStaticPaymentOutputDescriptor orig_conv;
67825         orig_conv.inner = untag_ptr(orig);
67826         orig_conv.is_owned = ptr_is_owned(orig);
67827         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67828         orig_conv.is_owned = false;
67829         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
67830         uint64_t ret_ref = 0;
67831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67833         return ret_ref;
67834 }
67835
67836 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_hash"))) TS_StaticPaymentOutputDescriptor_hash(uint64_t o) {
67837         LDKStaticPaymentOutputDescriptor o_conv;
67838         o_conv.inner = untag_ptr(o);
67839         o_conv.is_owned = ptr_is_owned(o);
67840         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67841         o_conv.is_owned = false;
67842         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
67843         return ret_conv;
67844 }
67845
67846 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
67847         LDKStaticPaymentOutputDescriptor a_conv;
67848         a_conv.inner = untag_ptr(a);
67849         a_conv.is_owned = ptr_is_owned(a);
67850         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67851         a_conv.is_owned = false;
67852         LDKStaticPaymentOutputDescriptor b_conv;
67853         b_conv.inner = untag_ptr(b);
67854         b_conv.is_owned = ptr_is_owned(b);
67855         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67856         b_conv.is_owned = false;
67857         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
67858         return ret_conv;
67859 }
67860
67861 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_witness_script"))) TS_StaticPaymentOutputDescriptor_witness_script(uint64_t this_arg) {
67862         LDKStaticPaymentOutputDescriptor this_arg_conv;
67863         this_arg_conv.inner = untag_ptr(this_arg);
67864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67866         this_arg_conv.is_owned = false;
67867         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
67868         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
67869         uint64_t ret_ref = tag_ptr(ret_copy, true);
67870         return ret_ref;
67871 }
67872
67873 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_max_witness_length"))) TS_StaticPaymentOutputDescriptor_max_witness_length(uint64_t this_arg) {
67874         LDKStaticPaymentOutputDescriptor this_arg_conv;
67875         this_arg_conv.inner = untag_ptr(this_arg);
67876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67878         this_arg_conv.is_owned = false;
67879         int64_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
67880         return ret_conv;
67881 }
67882
67883 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
67884         LDKStaticPaymentOutputDescriptor obj_conv;
67885         obj_conv.inner = untag_ptr(obj);
67886         obj_conv.is_owned = ptr_is_owned(obj);
67887         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67888         obj_conv.is_owned = false;
67889         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
67890         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67891         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67892         CVec_u8Z_free(ret_var);
67893         return ret_arr;
67894 }
67895
67896 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
67897         LDKu8slice ser_ref;
67898         ser_ref.datalen = ser->arr_len;
67899         ser_ref.data = ser->elems;
67900         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
67901         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
67902         FREE(ser);
67903         return tag_ptr(ret_conv, true);
67904 }
67905
67906 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
67907         if (!ptr_is_owned(this_ptr)) return;
67908         void* this_ptr_ptr = untag_ptr(this_ptr);
67909         CHECK_ACCESS(this_ptr_ptr);
67910         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
67911         FREE(untag_ptr(this_ptr));
67912         SpendableOutputDescriptor_free(this_ptr_conv);
67913 }
67914
67915 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
67916         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67917         *ret_copy = SpendableOutputDescriptor_clone(arg);
67918         uint64_t ret_ref = tag_ptr(ret_copy, true);
67919         return ret_ref;
67920 }
67921 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
67922         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
67923         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
67924         return ret_conv;
67925 }
67926
67927 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
67928         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
67929         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67930         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
67931         uint64_t ret_ref = tag_ptr(ret_copy, true);
67932         return ret_ref;
67933 }
67934
67935 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output, int8_tArray channel_keys_id) {
67936         LDKOutPoint outpoint_conv;
67937         outpoint_conv.inner = untag_ptr(outpoint);
67938         outpoint_conv.is_owned = ptr_is_owned(outpoint);
67939         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
67940         outpoint_conv = OutPoint_clone(&outpoint_conv);
67941         void* output_ptr = untag_ptr(output);
67942         CHECK_ACCESS(output_ptr);
67943         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
67944         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
67945         LDKThirtyTwoBytes channel_keys_id_ref;
67946         CHECK(channel_keys_id->arr_len == 32);
67947         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
67948         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67949         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv, channel_keys_id_ref);
67950         uint64_t ret_ref = tag_ptr(ret_copy, true);
67951         return ret_ref;
67952 }
67953
67954 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
67955         LDKDelayedPaymentOutputDescriptor a_conv;
67956         a_conv.inner = untag_ptr(a);
67957         a_conv.is_owned = ptr_is_owned(a);
67958         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67959         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
67960         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67961         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
67962         uint64_t ret_ref = tag_ptr(ret_copy, true);
67963         return ret_ref;
67964 }
67965
67966 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
67967         LDKStaticPaymentOutputDescriptor a_conv;
67968         a_conv.inner = untag_ptr(a);
67969         a_conv.is_owned = ptr_is_owned(a);
67970         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67971         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
67972         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67973         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
67974         uint64_t ret_ref = tag_ptr(ret_copy, true);
67975         return ret_ref;
67976 }
67977
67978 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_hash"))) TS_SpendableOutputDescriptor_hash(uint64_t o) {
67979         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
67980         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
67981         return ret_conv;
67982 }
67983
67984 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
67985         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
67986         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
67987         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
67988         return ret_conv;
67989 }
67990
67991 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
67992         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
67993         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
67994         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67995         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67996         CVec_u8Z_free(ret_var);
67997         return ret_arr;
67998 }
67999
68000 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
68001         LDKu8slice ser_ref;
68002         ser_ref.datalen = ser->arr_len;
68003         ser_ref.data = ser->elems;
68004         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
68005         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
68006         FREE(ser);
68007         return tag_ptr(ret_conv, true);
68008 }
68009
68010 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) {
68011         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
68012         descriptors_constr.datalen = descriptors->arr_len;
68013         if (descriptors_constr.datalen > 0)
68014                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
68015         else
68016                 descriptors_constr.data = NULL;
68017         uint64_t* descriptors_vals = descriptors->elems;
68018         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
68019                 uint64_t descriptors_conv_27 = descriptors_vals[b];
68020                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
68021                 CHECK_ACCESS(descriptors_conv_27_ptr);
68022                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
68023                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
68024                 descriptors_constr.data[b] = descriptors_conv_27_conv;
68025         }
68026         FREE(descriptors);
68027         LDKCVec_TxOutZ outputs_constr;
68028         outputs_constr.datalen = outputs->arr_len;
68029         if (outputs_constr.datalen > 0)
68030                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
68031         else
68032                 outputs_constr.data = NULL;
68033         uint64_t* outputs_vals = outputs->elems;
68034         for (size_t h = 0; h < outputs_constr.datalen; h++) {
68035                 uint64_t outputs_conv_7 = outputs_vals[h];
68036                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
68037                 CHECK_ACCESS(outputs_conv_7_ptr);
68038                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
68039                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
68040                 outputs_constr.data[h] = outputs_conv_7_conv;
68041         }
68042         FREE(outputs);
68043         LDKCVec_u8Z change_destination_script_ref;
68044         change_destination_script_ref.datalen = change_destination_script->arr_len;
68045         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
68046         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
68047         void* locktime_ptr = untag_ptr(locktime);
68048         CHECK_ACCESS(locktime_ptr);
68049         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
68050         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
68051         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
68052         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
68053         return tag_ptr(ret_conv, true);
68054 }
68055
68056 void  __attribute__((export_name("TS_ChannelDerivationParameters_free"))) TS_ChannelDerivationParameters_free(uint64_t this_obj) {
68057         LDKChannelDerivationParameters this_obj_conv;
68058         this_obj_conv.inner = untag_ptr(this_obj);
68059         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68061         ChannelDerivationParameters_free(this_obj_conv);
68062 }
68063
68064 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_value_satoshis"))) TS_ChannelDerivationParameters_get_value_satoshis(uint64_t this_ptr) {
68065         LDKChannelDerivationParameters this_ptr_conv;
68066         this_ptr_conv.inner = untag_ptr(this_ptr);
68067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68069         this_ptr_conv.is_owned = false;
68070         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
68071         return ret_conv;
68072 }
68073
68074 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_value_satoshis"))) TS_ChannelDerivationParameters_set_value_satoshis(uint64_t this_ptr, int64_t val) {
68075         LDKChannelDerivationParameters this_ptr_conv;
68076         this_ptr_conv.inner = untag_ptr(this_ptr);
68077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68079         this_ptr_conv.is_owned = false;
68080         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
68081 }
68082
68083 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_get_keys_id"))) TS_ChannelDerivationParameters_get_keys_id(uint64_t this_ptr) {
68084         LDKChannelDerivationParameters this_ptr_conv;
68085         this_ptr_conv.inner = untag_ptr(this_ptr);
68086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68088         this_ptr_conv.is_owned = false;
68089         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68090         memcpy(ret_arr->elems, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv), 32);
68091         return ret_arr;
68092 }
68093
68094 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_keys_id"))) TS_ChannelDerivationParameters_set_keys_id(uint64_t this_ptr, int8_tArray val) {
68095         LDKChannelDerivationParameters this_ptr_conv;
68096         this_ptr_conv.inner = untag_ptr(this_ptr);
68097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68099         this_ptr_conv.is_owned = false;
68100         LDKThirtyTwoBytes val_ref;
68101         CHECK(val->arr_len == 32);
68102         memcpy(val_ref.data, val->elems, 32); FREE(val);
68103         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
68104 }
68105
68106 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_transaction_parameters"))) TS_ChannelDerivationParameters_get_transaction_parameters(uint64_t this_ptr) {
68107         LDKChannelDerivationParameters this_ptr_conv;
68108         this_ptr_conv.inner = untag_ptr(this_ptr);
68109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68111         this_ptr_conv.is_owned = false;
68112         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
68113         uint64_t ret_ref = 0;
68114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68116         return ret_ref;
68117 }
68118
68119 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_transaction_parameters"))) TS_ChannelDerivationParameters_set_transaction_parameters(uint64_t this_ptr, uint64_t val) {
68120         LDKChannelDerivationParameters this_ptr_conv;
68121         this_ptr_conv.inner = untag_ptr(this_ptr);
68122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68124         this_ptr_conv.is_owned = false;
68125         LDKChannelTransactionParameters val_conv;
68126         val_conv.inner = untag_ptr(val);
68127         val_conv.is_owned = ptr_is_owned(val);
68128         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68129         val_conv = ChannelTransactionParameters_clone(&val_conv);
68130         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
68131 }
68132
68133 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) {
68134         LDKThirtyTwoBytes keys_id_arg_ref;
68135         CHECK(keys_id_arg->arr_len == 32);
68136         memcpy(keys_id_arg_ref.data, keys_id_arg->elems, 32); FREE(keys_id_arg);
68137         LDKChannelTransactionParameters transaction_parameters_arg_conv;
68138         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
68139         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
68140         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
68141         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
68142         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
68143         uint64_t ret_ref = 0;
68144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68146         return ret_ref;
68147 }
68148
68149 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
68150         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
68151         uint64_t ret_ref = 0;
68152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68154         return ret_ref;
68155 }
68156 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone_ptr"))) TS_ChannelDerivationParameters_clone_ptr(uint64_t arg) {
68157         LDKChannelDerivationParameters arg_conv;
68158         arg_conv.inner = untag_ptr(arg);
68159         arg_conv.is_owned = ptr_is_owned(arg);
68160         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68161         arg_conv.is_owned = false;
68162         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
68163         return ret_conv;
68164 }
68165
68166 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone"))) TS_ChannelDerivationParameters_clone(uint64_t orig) {
68167         LDKChannelDerivationParameters orig_conv;
68168         orig_conv.inner = untag_ptr(orig);
68169         orig_conv.is_owned = ptr_is_owned(orig);
68170         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68171         orig_conv.is_owned = false;
68172         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
68173         uint64_t ret_ref = 0;
68174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68176         return ret_ref;
68177 }
68178
68179 jboolean  __attribute__((export_name("TS_ChannelDerivationParameters_eq"))) TS_ChannelDerivationParameters_eq(uint64_t a, uint64_t b) {
68180         LDKChannelDerivationParameters a_conv;
68181         a_conv.inner = untag_ptr(a);
68182         a_conv.is_owned = ptr_is_owned(a);
68183         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68184         a_conv.is_owned = false;
68185         LDKChannelDerivationParameters b_conv;
68186         b_conv.inner = untag_ptr(b);
68187         b_conv.is_owned = ptr_is_owned(b);
68188         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68189         b_conv.is_owned = false;
68190         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
68191         return ret_conv;
68192 }
68193
68194 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_write"))) TS_ChannelDerivationParameters_write(uint64_t obj) {
68195         LDKChannelDerivationParameters obj_conv;
68196         obj_conv.inner = untag_ptr(obj);
68197         obj_conv.is_owned = ptr_is_owned(obj);
68198         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68199         obj_conv.is_owned = false;
68200         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
68201         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68202         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68203         CVec_u8Z_free(ret_var);
68204         return ret_arr;
68205 }
68206
68207 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_read"))) TS_ChannelDerivationParameters_read(int8_tArray ser) {
68208         LDKu8slice ser_ref;
68209         ser_ref.datalen = ser->arr_len;
68210         ser_ref.data = ser->elems;
68211         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
68212         *ret_conv = ChannelDerivationParameters_read(ser_ref);
68213         FREE(ser);
68214         return tag_ptr(ret_conv, true);
68215 }
68216
68217 void  __attribute__((export_name("TS_HTLCDescriptor_free"))) TS_HTLCDescriptor_free(uint64_t this_obj) {
68218         LDKHTLCDescriptor this_obj_conv;
68219         this_obj_conv.inner = untag_ptr(this_obj);
68220         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68222         HTLCDescriptor_free(this_obj_conv);
68223 }
68224
68225 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_channel_derivation_parameters"))) TS_HTLCDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
68226         LDKHTLCDescriptor this_ptr_conv;
68227         this_ptr_conv.inner = untag_ptr(this_ptr);
68228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68230         this_ptr_conv.is_owned = false;
68231         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
68232         uint64_t ret_ref = 0;
68233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68235         return ret_ref;
68236 }
68237
68238 void  __attribute__((export_name("TS_HTLCDescriptor_set_channel_derivation_parameters"))) TS_HTLCDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
68239         LDKHTLCDescriptor this_ptr_conv;
68240         this_ptr_conv.inner = untag_ptr(this_ptr);
68241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68243         this_ptr_conv.is_owned = false;
68244         LDKChannelDerivationParameters val_conv;
68245         val_conv.inner = untag_ptr(val);
68246         val_conv.is_owned = ptr_is_owned(val);
68247         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68248         val_conv = ChannelDerivationParameters_clone(&val_conv);
68249         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
68250 }
68251
68252 int64_t  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_number"))) TS_HTLCDescriptor_get_per_commitment_number(uint64_t this_ptr) {
68253         LDKHTLCDescriptor this_ptr_conv;
68254         this_ptr_conv.inner = untag_ptr(this_ptr);
68255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68257         this_ptr_conv.is_owned = false;
68258         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
68259         return ret_conv;
68260 }
68261
68262 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_number"))) TS_HTLCDescriptor_set_per_commitment_number(uint64_t this_ptr, int64_t val) {
68263         LDKHTLCDescriptor this_ptr_conv;
68264         this_ptr_conv.inner = untag_ptr(this_ptr);
68265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68267         this_ptr_conv.is_owned = false;
68268         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
68269 }
68270
68271 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_point"))) TS_HTLCDescriptor_get_per_commitment_point(uint64_t this_ptr) {
68272         LDKHTLCDescriptor this_ptr_conv;
68273         this_ptr_conv.inner = untag_ptr(this_ptr);
68274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68276         this_ptr_conv.is_owned = false;
68277         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
68278         memcpy(ret_arr->elems, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
68279         return ret_arr;
68280 }
68281
68282 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_point"))) TS_HTLCDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
68283         LDKHTLCDescriptor this_ptr_conv;
68284         this_ptr_conv.inner = untag_ptr(this_ptr);
68285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68287         this_ptr_conv.is_owned = false;
68288         LDKPublicKey val_ref;
68289         CHECK(val->arr_len == 33);
68290         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
68291         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
68292 }
68293
68294 int32_t  __attribute__((export_name("TS_HTLCDescriptor_get_feerate_per_kw"))) TS_HTLCDescriptor_get_feerate_per_kw(uint64_t this_ptr) {
68295         LDKHTLCDescriptor this_ptr_conv;
68296         this_ptr_conv.inner = untag_ptr(this_ptr);
68297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68299         this_ptr_conv.is_owned = false;
68300         int32_t ret_conv = HTLCDescriptor_get_feerate_per_kw(&this_ptr_conv);
68301         return ret_conv;
68302 }
68303
68304 void  __attribute__((export_name("TS_HTLCDescriptor_set_feerate_per_kw"))) TS_HTLCDescriptor_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
68305         LDKHTLCDescriptor this_ptr_conv;
68306         this_ptr_conv.inner = untag_ptr(this_ptr);
68307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68309         this_ptr_conv.is_owned = false;
68310         HTLCDescriptor_set_feerate_per_kw(&this_ptr_conv, val);
68311 }
68312
68313 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_htlc"))) TS_HTLCDescriptor_get_htlc(uint64_t this_ptr) {
68314         LDKHTLCDescriptor this_ptr_conv;
68315         this_ptr_conv.inner = untag_ptr(this_ptr);
68316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68318         this_ptr_conv.is_owned = false;
68319         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
68320         uint64_t ret_ref = 0;
68321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68323         return ret_ref;
68324 }
68325
68326 void  __attribute__((export_name("TS_HTLCDescriptor_set_htlc"))) TS_HTLCDescriptor_set_htlc(uint64_t this_ptr, uint64_t val) {
68327         LDKHTLCDescriptor this_ptr_conv;
68328         this_ptr_conv.inner = untag_ptr(this_ptr);
68329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68331         this_ptr_conv.is_owned = false;
68332         LDKHTLCOutputInCommitment val_conv;
68333         val_conv.inner = untag_ptr(val);
68334         val_conv.is_owned = ptr_is_owned(val);
68335         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68336         val_conv = HTLCOutputInCommitment_clone(&val_conv);
68337         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
68338 }
68339
68340 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_preimage"))) TS_HTLCDescriptor_get_preimage(uint64_t this_ptr) {
68341         LDKHTLCDescriptor this_ptr_conv;
68342         this_ptr_conv.inner = untag_ptr(this_ptr);
68343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68345         this_ptr_conv.is_owned = false;
68346         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
68347         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
68348         uint64_t ret_ref = tag_ptr(ret_copy, true);
68349         return ret_ref;
68350 }
68351
68352 void  __attribute__((export_name("TS_HTLCDescriptor_set_preimage"))) TS_HTLCDescriptor_set_preimage(uint64_t this_ptr, uint64_t val) {
68353         LDKHTLCDescriptor this_ptr_conv;
68354         this_ptr_conv.inner = untag_ptr(this_ptr);
68355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68357         this_ptr_conv.is_owned = false;
68358         void* val_ptr = untag_ptr(val);
68359         CHECK_ACCESS(val_ptr);
68360         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
68361         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
68362         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
68363 }
68364
68365 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_counterparty_sig"))) TS_HTLCDescriptor_get_counterparty_sig(uint64_t this_ptr) {
68366         LDKHTLCDescriptor this_ptr_conv;
68367         this_ptr_conv.inner = untag_ptr(this_ptr);
68368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68370         this_ptr_conv.is_owned = false;
68371         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
68372         memcpy(ret_arr->elems, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
68373         return ret_arr;
68374 }
68375
68376 void  __attribute__((export_name("TS_HTLCDescriptor_set_counterparty_sig"))) TS_HTLCDescriptor_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
68377         LDKHTLCDescriptor this_ptr_conv;
68378         this_ptr_conv.inner = untag_ptr(this_ptr);
68379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68381         this_ptr_conv.is_owned = false;
68382         LDKECDSASignature val_ref;
68383         CHECK(val->arr_len == 64);
68384         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
68385         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
68386 }
68387
68388 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
68389         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
68390         uint64_t ret_ref = 0;
68391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68393         return ret_ref;
68394 }
68395 int64_t  __attribute__((export_name("TS_HTLCDescriptor_clone_ptr"))) TS_HTLCDescriptor_clone_ptr(uint64_t arg) {
68396         LDKHTLCDescriptor arg_conv;
68397         arg_conv.inner = untag_ptr(arg);
68398         arg_conv.is_owned = ptr_is_owned(arg);
68399         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68400         arg_conv.is_owned = false;
68401         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
68402         return ret_conv;
68403 }
68404
68405 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_clone"))) TS_HTLCDescriptor_clone(uint64_t orig) {
68406         LDKHTLCDescriptor orig_conv;
68407         orig_conv.inner = untag_ptr(orig);
68408         orig_conv.is_owned = ptr_is_owned(orig);
68409         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68410         orig_conv.is_owned = false;
68411         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
68412         uint64_t ret_ref = 0;
68413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68415         return ret_ref;
68416 }
68417
68418 jboolean  __attribute__((export_name("TS_HTLCDescriptor_eq"))) TS_HTLCDescriptor_eq(uint64_t a, uint64_t b) {
68419         LDKHTLCDescriptor a_conv;
68420         a_conv.inner = untag_ptr(a);
68421         a_conv.is_owned = ptr_is_owned(a);
68422         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68423         a_conv.is_owned = false;
68424         LDKHTLCDescriptor b_conv;
68425         b_conv.inner = untag_ptr(b);
68426         b_conv.is_owned = ptr_is_owned(b);
68427         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68428         b_conv.is_owned = false;
68429         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
68430         return ret_conv;
68431 }
68432
68433 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_write"))) TS_HTLCDescriptor_write(uint64_t obj) {
68434         LDKHTLCDescriptor obj_conv;
68435         obj_conv.inner = untag_ptr(obj);
68436         obj_conv.is_owned = ptr_is_owned(obj);
68437         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68438         obj_conv.is_owned = false;
68439         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
68440         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68441         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68442         CVec_u8Z_free(ret_var);
68443         return ret_arr;
68444 }
68445
68446 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_read"))) TS_HTLCDescriptor_read(int8_tArray ser) {
68447         LDKu8slice ser_ref;
68448         ser_ref.datalen = ser->arr_len;
68449         ser_ref.data = ser->elems;
68450         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
68451         *ret_conv = HTLCDescriptor_read(ser_ref);
68452         FREE(ser);
68453         return tag_ptr(ret_conv, true);
68454 }
68455
68456 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_outpoint"))) TS_HTLCDescriptor_outpoint(uint64_t this_arg) {
68457         LDKHTLCDescriptor this_arg_conv;
68458         this_arg_conv.inner = untag_ptr(this_arg);
68459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68461         this_arg_conv.is_owned = false;
68462         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
68463         uint64_t ret_ref = 0;
68464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68466         return ret_ref;
68467 }
68468
68469 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_previous_utxo"))) TS_HTLCDescriptor_previous_utxo(uint64_t this_arg) {
68470         LDKHTLCDescriptor this_arg_conv;
68471         this_arg_conv.inner = untag_ptr(this_arg);
68472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68474         this_arg_conv.is_owned = false;
68475         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
68476         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
68477         return tag_ptr(ret_ref, true);
68478 }
68479
68480 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_unsigned_tx_input"))) TS_HTLCDescriptor_unsigned_tx_input(uint64_t this_arg) {
68481         LDKHTLCDescriptor this_arg_conv;
68482         this_arg_conv.inner = untag_ptr(this_arg);
68483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68485         this_arg_conv.is_owned = false;
68486         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
68487         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
68488         return tag_ptr(ret_ref, true);
68489 }
68490
68491 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_tx_output"))) TS_HTLCDescriptor_tx_output(uint64_t this_arg) {
68492         LDKHTLCDescriptor this_arg_conv;
68493         this_arg_conv.inner = untag_ptr(this_arg);
68494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68496         this_arg_conv.is_owned = false;
68497         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
68498         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
68499         return tag_ptr(ret_ref, true);
68500 }
68501
68502 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_witness_script"))) TS_HTLCDescriptor_witness_script(uint64_t this_arg) {
68503         LDKHTLCDescriptor this_arg_conv;
68504         this_arg_conv.inner = untag_ptr(this_arg);
68505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68507         this_arg_conv.is_owned = false;
68508         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
68509         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68510         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68511         CVec_u8Z_free(ret_var);
68512         return ret_arr;
68513 }
68514
68515 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) {
68516         LDKHTLCDescriptor this_arg_conv;
68517         this_arg_conv.inner = untag_ptr(this_arg);
68518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68520         this_arg_conv.is_owned = false;
68521         LDKECDSASignature signature_ref;
68522         CHECK(signature->arr_len == 64);
68523         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
68524         LDKu8slice witness_script_ref;
68525         witness_script_ref.datalen = witness_script->arr_len;
68526         witness_script_ref.data = witness_script->elems;
68527         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
68528         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68529         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68530         Witness_free(ret_var);
68531         FREE(witness_script);
68532         return ret_arr;
68533 }
68534
68535 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_derive_channel_signer"))) TS_HTLCDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
68536         LDKHTLCDescriptor this_arg_conv;
68537         this_arg_conv.inner = untag_ptr(this_arg);
68538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68540         this_arg_conv.is_owned = false;
68541         void* signer_provider_ptr = untag_ptr(signer_provider);
68542         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
68543         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
68544         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
68545         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
68546         return tag_ptr(ret_ret, true);
68547 }
68548
68549 void  __attribute__((export_name("TS_ChannelSigner_free"))) TS_ChannelSigner_free(uint64_t this_ptr) {
68550         if (!ptr_is_owned(this_ptr)) return;
68551         void* this_ptr_ptr = untag_ptr(this_ptr);
68552         CHECK_ACCESS(this_ptr_ptr);
68553         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
68554         FREE(untag_ptr(this_ptr));
68555         ChannelSigner_free(this_ptr_conv);
68556 }
68557
68558 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
68559         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
68560         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
68561         return ret_conv;
68562 }
68563
68564 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
68565         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
68566         return ret_conv;
68567 }
68568
68569 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
68570         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
68571         return ret_conv;
68572 }
68573
68574 void  __attribute__((export_name("TS_EntropySource_free"))) TS_EntropySource_free(uint64_t this_ptr) {
68575         if (!ptr_is_owned(this_ptr)) return;
68576         void* this_ptr_ptr = untag_ptr(this_ptr);
68577         CHECK_ACCESS(this_ptr_ptr);
68578         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
68579         FREE(untag_ptr(this_ptr));
68580         EntropySource_free(this_ptr_conv);
68581 }
68582
68583 void  __attribute__((export_name("TS_NodeSigner_free"))) TS_NodeSigner_free(uint64_t this_ptr) {
68584         if (!ptr_is_owned(this_ptr)) return;
68585         void* this_ptr_ptr = untag_ptr(this_ptr);
68586         CHECK_ACCESS(this_ptr_ptr);
68587         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
68588         FREE(untag_ptr(this_ptr));
68589         NodeSigner_free(this_ptr_conv);
68590 }
68591
68592 void  __attribute__((export_name("TS_SignerProvider_free"))) TS_SignerProvider_free(uint64_t this_ptr) {
68593         if (!ptr_is_owned(this_ptr)) return;
68594         void* this_ptr_ptr = untag_ptr(this_ptr);
68595         CHECK_ACCESS(this_ptr_ptr);
68596         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
68597         FREE(untag_ptr(this_ptr));
68598         SignerProvider_free(this_ptr_conv);
68599 }
68600
68601 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
68602         LDKInMemorySigner this_obj_conv;
68603         this_obj_conv.inner = untag_ptr(this_obj);
68604         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68606         InMemorySigner_free(this_obj_conv);
68607 }
68608
68609 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
68610         LDKInMemorySigner this_ptr_conv;
68611         this_ptr_conv.inner = untag_ptr(this_ptr);
68612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68614         this_ptr_conv.is_owned = false;
68615         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68616         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
68617         return ret_arr;
68618 }
68619
68620 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
68621         LDKInMemorySigner this_ptr_conv;
68622         this_ptr_conv.inner = untag_ptr(this_ptr);
68623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68625         this_ptr_conv.is_owned = false;
68626         LDKSecretKey val_ref;
68627         CHECK(val->arr_len == 32);
68628         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
68629         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
68630 }
68631
68632 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
68633         LDKInMemorySigner this_ptr_conv;
68634         this_ptr_conv.inner = untag_ptr(this_ptr);
68635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68637         this_ptr_conv.is_owned = false;
68638         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68639         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
68640         return ret_arr;
68641 }
68642
68643 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
68644         LDKInMemorySigner this_ptr_conv;
68645         this_ptr_conv.inner = untag_ptr(this_ptr);
68646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68648         this_ptr_conv.is_owned = false;
68649         LDKSecretKey val_ref;
68650         CHECK(val->arr_len == 32);
68651         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
68652         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
68653 }
68654
68655 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
68656         LDKInMemorySigner this_ptr_conv;
68657         this_ptr_conv.inner = untag_ptr(this_ptr);
68658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68660         this_ptr_conv.is_owned = false;
68661         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68662         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
68663         return ret_arr;
68664 }
68665
68666 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
68667         LDKInMemorySigner this_ptr_conv;
68668         this_ptr_conv.inner = untag_ptr(this_ptr);
68669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68671         this_ptr_conv.is_owned = false;
68672         LDKSecretKey val_ref;
68673         CHECK(val->arr_len == 32);
68674         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
68675         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
68676 }
68677
68678 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
68679         LDKInMemorySigner this_ptr_conv;
68680         this_ptr_conv.inner = untag_ptr(this_ptr);
68681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68683         this_ptr_conv.is_owned = false;
68684         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68685         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
68686         return ret_arr;
68687 }
68688
68689 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) {
68690         LDKInMemorySigner this_ptr_conv;
68691         this_ptr_conv.inner = untag_ptr(this_ptr);
68692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68694         this_ptr_conv.is_owned = false;
68695         LDKSecretKey val_ref;
68696         CHECK(val->arr_len == 32);
68697         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
68698         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
68699 }
68700
68701 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
68702         LDKInMemorySigner this_ptr_conv;
68703         this_ptr_conv.inner = untag_ptr(this_ptr);
68704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68706         this_ptr_conv.is_owned = false;
68707         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68708         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
68709         return ret_arr;
68710 }
68711
68712 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
68713         LDKInMemorySigner this_ptr_conv;
68714         this_ptr_conv.inner = untag_ptr(this_ptr);
68715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68717         this_ptr_conv.is_owned = false;
68718         LDKSecretKey val_ref;
68719         CHECK(val->arr_len == 32);
68720         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
68721         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
68722 }
68723
68724 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
68725         LDKInMemorySigner this_ptr_conv;
68726         this_ptr_conv.inner = untag_ptr(this_ptr);
68727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68729         this_ptr_conv.is_owned = false;
68730         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68731         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
68732         return ret_arr;
68733 }
68734
68735 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
68736         LDKInMemorySigner this_ptr_conv;
68737         this_ptr_conv.inner = untag_ptr(this_ptr);
68738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68740         this_ptr_conv.is_owned = false;
68741         LDKThirtyTwoBytes val_ref;
68742         CHECK(val->arr_len == 32);
68743         memcpy(val_ref.data, val->elems, 32); FREE(val);
68744         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
68745 }
68746
68747 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
68748         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
68749         uint64_t ret_ref = 0;
68750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68752         return ret_ref;
68753 }
68754 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
68755         LDKInMemorySigner arg_conv;
68756         arg_conv.inner = untag_ptr(arg);
68757         arg_conv.is_owned = ptr_is_owned(arg);
68758         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68759         arg_conv.is_owned = false;
68760         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
68761         return ret_conv;
68762 }
68763
68764 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
68765         LDKInMemorySigner orig_conv;
68766         orig_conv.inner = untag_ptr(orig);
68767         orig_conv.is_owned = ptr_is_owned(orig);
68768         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68769         orig_conv.is_owned = false;
68770         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
68771         uint64_t ret_ref = 0;
68772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68774         return ret_ref;
68775 }
68776
68777 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) {
68778         LDKSecretKey funding_key_ref;
68779         CHECK(funding_key->arr_len == 32);
68780         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
68781         LDKSecretKey revocation_base_key_ref;
68782         CHECK(revocation_base_key->arr_len == 32);
68783         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
68784         LDKSecretKey payment_key_ref;
68785         CHECK(payment_key->arr_len == 32);
68786         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
68787         LDKSecretKey delayed_payment_base_key_ref;
68788         CHECK(delayed_payment_base_key->arr_len == 32);
68789         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
68790         LDKSecretKey htlc_base_key_ref;
68791         CHECK(htlc_base_key->arr_len == 32);
68792         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
68793         LDKThirtyTwoBytes commitment_seed_ref;
68794         CHECK(commitment_seed->arr_len == 32);
68795         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
68796         LDKThirtyTwoBytes channel_keys_id_ref;
68797         CHECK(channel_keys_id->arr_len == 32);
68798         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
68799         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
68800         CHECK(rand_bytes_unique_start->arr_len == 32);
68801         memcpy(rand_bytes_unique_start_ref.data, rand_bytes_unique_start->elems, 32); FREE(rand_bytes_unique_start);
68802         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);
68803         uint64_t ret_ref = 0;
68804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68806         return ret_ref;
68807 }
68808
68809 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
68810         LDKInMemorySigner this_arg_conv;
68811         this_arg_conv.inner = untag_ptr(this_arg);
68812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68814         this_arg_conv.is_owned = false;
68815         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
68816         uint64_t ret_ref = 0;
68817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68819         return ret_ref;
68820 }
68821
68822 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
68823         LDKInMemorySigner this_arg_conv;
68824         this_arg_conv.inner = untag_ptr(this_arg);
68825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68827         this_arg_conv.is_owned = false;
68828         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
68829         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
68830         uint64_t ret_ref = tag_ptr(ret_copy, true);
68831         return ret_ref;
68832 }
68833
68834 uint64_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
68835         LDKInMemorySigner this_arg_conv;
68836         this_arg_conv.inner = untag_ptr(this_arg);
68837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68839         this_arg_conv.is_owned = false;
68840         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
68841         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
68842         uint64_t ret_ref = tag_ptr(ret_copy, true);
68843         return ret_ref;
68844 }
68845
68846 uint64_t  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
68847         LDKInMemorySigner this_arg_conv;
68848         this_arg_conv.inner = untag_ptr(this_arg);
68849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68851         this_arg_conv.is_owned = false;
68852         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
68853         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
68854         uint64_t ret_ref = tag_ptr(ret_copy, true);
68855         return ret_ref;
68856 }
68857
68858 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
68859         LDKInMemorySigner this_arg_conv;
68860         this_arg_conv.inner = untag_ptr(this_arg);
68861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68863         this_arg_conv.is_owned = false;
68864         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
68865         uint64_t ret_ref = 0;
68866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68868         return ret_ref;
68869 }
68870
68871 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
68872         LDKInMemorySigner this_arg_conv;
68873         this_arg_conv.inner = untag_ptr(this_arg);
68874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68876         this_arg_conv.is_owned = false;
68877         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
68878         uint64_t ret_ref = 0;
68879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68881         return ret_ref;
68882 }
68883
68884 uint64_t  __attribute__((export_name("TS_InMemorySigner_channel_type_features"))) TS_InMemorySigner_channel_type_features(uint64_t this_arg) {
68885         LDKInMemorySigner this_arg_conv;
68886         this_arg_conv.inner = untag_ptr(this_arg);
68887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68889         this_arg_conv.is_owned = false;
68890         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
68891         uint64_t ret_ref = 0;
68892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68894         return ret_ref;
68895 }
68896
68897 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) {
68898         LDKInMemorySigner this_arg_conv;
68899         this_arg_conv.inner = untag_ptr(this_arg);
68900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68902         this_arg_conv.is_owned = false;
68903         LDKTransaction spend_tx_ref;
68904         spend_tx_ref.datalen = spend_tx->arr_len;
68905         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
68906         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
68907         spend_tx_ref.data_is_owned = true;
68908         LDKStaticPaymentOutputDescriptor descriptor_conv;
68909         descriptor_conv.inner = untag_ptr(descriptor);
68910         descriptor_conv.is_owned = ptr_is_owned(descriptor);
68911         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
68912         descriptor_conv.is_owned = false;
68913         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
68914         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
68915         return tag_ptr(ret_conv, true);
68916 }
68917
68918 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) {
68919         LDKInMemorySigner this_arg_conv;
68920         this_arg_conv.inner = untag_ptr(this_arg);
68921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68923         this_arg_conv.is_owned = false;
68924         LDKTransaction spend_tx_ref;
68925         spend_tx_ref.datalen = spend_tx->arr_len;
68926         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
68927         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
68928         spend_tx_ref.data_is_owned = true;
68929         LDKDelayedPaymentOutputDescriptor descriptor_conv;
68930         descriptor_conv.inner = untag_ptr(descriptor);
68931         descriptor_conv.is_owned = ptr_is_owned(descriptor);
68932         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
68933         descriptor_conv.is_owned = false;
68934         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
68935         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
68936         return tag_ptr(ret_conv, true);
68937 }
68938
68939 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EntropySource"))) TS_InMemorySigner_as_EntropySource(uint64_t this_arg) {
68940         LDKInMemorySigner this_arg_conv;
68941         this_arg_conv.inner = untag_ptr(this_arg);
68942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68944         this_arg_conv.is_owned = false;
68945         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
68946         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
68947         return tag_ptr(ret_ret, true);
68948 }
68949
68950 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_ChannelSigner"))) TS_InMemorySigner_as_ChannelSigner(uint64_t this_arg) {
68951         LDKInMemorySigner this_arg_conv;
68952         this_arg_conv.inner = untag_ptr(this_arg);
68953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68955         this_arg_conv.is_owned = false;
68956         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
68957         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
68958         return tag_ptr(ret_ret, true);
68959 }
68960
68961 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EcdsaChannelSigner"))) TS_InMemorySigner_as_EcdsaChannelSigner(uint64_t this_arg) {
68962         LDKInMemorySigner this_arg_conv;
68963         this_arg_conv.inner = untag_ptr(this_arg);
68964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68966         this_arg_conv.is_owned = false;
68967         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
68968         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
68969         return tag_ptr(ret_ret, true);
68970 }
68971
68972 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_WriteableEcdsaChannelSigner"))) TS_InMemorySigner_as_WriteableEcdsaChannelSigner(uint64_t this_arg) {
68973         LDKInMemorySigner this_arg_conv;
68974         this_arg_conv.inner = untag_ptr(this_arg);
68975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68977         this_arg_conv.is_owned = false;
68978         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
68979         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
68980         return tag_ptr(ret_ret, true);
68981 }
68982
68983 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
68984         LDKInMemorySigner obj_conv;
68985         obj_conv.inner = untag_ptr(obj);
68986         obj_conv.is_owned = ptr_is_owned(obj);
68987         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68988         obj_conv.is_owned = false;
68989         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
68990         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68991         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68992         CVec_u8Z_free(ret_var);
68993         return ret_arr;
68994 }
68995
68996 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, uint64_t arg) {
68997         LDKu8slice ser_ref;
68998         ser_ref.datalen = ser->arr_len;
68999         ser_ref.data = ser->elems;
69000         void* arg_ptr = untag_ptr(arg);
69001         CHECK_ACCESS(arg_ptr);
69002         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
69003         if (arg_conv.free == LDKEntropySource_JCalls_free) {
69004                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69005                 LDKEntropySource_JCalls_cloned(&arg_conv);
69006         }
69007         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
69008         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
69009         FREE(ser);
69010         return tag_ptr(ret_conv, true);
69011 }
69012
69013 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
69014         LDKKeysManager this_obj_conv;
69015         this_obj_conv.inner = untag_ptr(this_obj);
69016         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69018         KeysManager_free(this_obj_conv);
69019 }
69020
69021 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
69022         uint8_t seed_arr[32];
69023         CHECK(seed->arr_len == 32);
69024         memcpy(seed_arr, seed->elems, 32); FREE(seed);
69025         uint8_t (*seed_ref)[32] = &seed_arr;
69026         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
69027         uint64_t ret_ref = 0;
69028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69030         return ret_ref;
69031 }
69032
69033 int8_tArray  __attribute__((export_name("TS_KeysManager_get_node_secret_key"))) TS_KeysManager_get_node_secret_key(uint64_t this_arg) {
69034         LDKKeysManager this_arg_conv;
69035         this_arg_conv.inner = untag_ptr(this_arg);
69036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69038         this_arg_conv.is_owned = false;
69039         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69040         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
69041         return ret_arr;
69042 }
69043
69044 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) {
69045         LDKKeysManager this_arg_conv;
69046         this_arg_conv.inner = untag_ptr(this_arg);
69047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69049         this_arg_conv.is_owned = false;
69050         uint8_t params_arr[32];
69051         CHECK(params->arr_len == 32);
69052         memcpy(params_arr, params->elems, 32); FREE(params);
69053         uint8_t (*params_ref)[32] = &params_arr;
69054         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
69055         uint64_t ret_ref = 0;
69056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69058         return ret_ref;
69059 }
69060
69061 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) {
69062         LDKKeysManager this_arg_conv;
69063         this_arg_conv.inner = untag_ptr(this_arg);
69064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69066         this_arg_conv.is_owned = false;
69067         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
69068         descriptors_constr.datalen = descriptors->arr_len;
69069         if (descriptors_constr.datalen > 0)
69070                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
69071         else
69072                 descriptors_constr.data = NULL;
69073         uint64_t* descriptors_vals = descriptors->elems;
69074         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
69075                 uint64_t descriptors_conv_27 = descriptors_vals[b];
69076                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
69077                 CHECK_ACCESS(descriptors_conv_27_ptr);
69078                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
69079                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
69080                 descriptors_constr.data[b] = descriptors_conv_27_conv;
69081         }
69082         FREE(descriptors);
69083         LDKCVec_u8Z psbt_ref;
69084         psbt_ref.datalen = psbt->arr_len;
69085         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
69086         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
69087         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
69088         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
69089         return tag_ptr(ret_conv, true);
69090 }
69091
69092 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) {
69093         LDKKeysManager this_arg_conv;
69094         this_arg_conv.inner = untag_ptr(this_arg);
69095         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69097         this_arg_conv.is_owned = false;
69098         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
69099         descriptors_constr.datalen = descriptors->arr_len;
69100         if (descriptors_constr.datalen > 0)
69101                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
69102         else
69103                 descriptors_constr.data = NULL;
69104         uint64_t* descriptors_vals = descriptors->elems;
69105         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
69106                 uint64_t descriptors_conv_27 = descriptors_vals[b];
69107                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
69108                 CHECK_ACCESS(descriptors_conv_27_ptr);
69109                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
69110                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
69111                 descriptors_constr.data[b] = descriptors_conv_27_conv;
69112         }
69113         FREE(descriptors);
69114         LDKCVec_TxOutZ outputs_constr;
69115         outputs_constr.datalen = outputs->arr_len;
69116         if (outputs_constr.datalen > 0)
69117                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
69118         else
69119                 outputs_constr.data = NULL;
69120         uint64_t* outputs_vals = outputs->elems;
69121         for (size_t h = 0; h < outputs_constr.datalen; h++) {
69122                 uint64_t outputs_conv_7 = outputs_vals[h];
69123                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
69124                 CHECK_ACCESS(outputs_conv_7_ptr);
69125                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
69126                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
69127                 outputs_constr.data[h] = outputs_conv_7_conv;
69128         }
69129         FREE(outputs);
69130         LDKCVec_u8Z change_destination_script_ref;
69131         change_destination_script_ref.datalen = change_destination_script->arr_len;
69132         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
69133         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
69134         void* locktime_ptr = untag_ptr(locktime);
69135         CHECK_ACCESS(locktime_ptr);
69136         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
69137         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
69138         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
69139         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
69140         return tag_ptr(ret_conv, true);
69141 }
69142
69143 uint64_t  __attribute__((export_name("TS_KeysManager_as_EntropySource"))) TS_KeysManager_as_EntropySource(uint64_t this_arg) {
69144         LDKKeysManager this_arg_conv;
69145         this_arg_conv.inner = untag_ptr(this_arg);
69146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69148         this_arg_conv.is_owned = false;
69149         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
69150         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
69151         return tag_ptr(ret_ret, true);
69152 }
69153
69154 uint64_t  __attribute__((export_name("TS_KeysManager_as_NodeSigner"))) TS_KeysManager_as_NodeSigner(uint64_t this_arg) {
69155         LDKKeysManager this_arg_conv;
69156         this_arg_conv.inner = untag_ptr(this_arg);
69157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69159         this_arg_conv.is_owned = false;
69160         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
69161         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
69162         return tag_ptr(ret_ret, true);
69163 }
69164
69165 uint64_t  __attribute__((export_name("TS_KeysManager_as_SignerProvider"))) TS_KeysManager_as_SignerProvider(uint64_t this_arg) {
69166         LDKKeysManager this_arg_conv;
69167         this_arg_conv.inner = untag_ptr(this_arg);
69168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69170         this_arg_conv.is_owned = false;
69171         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
69172         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
69173         return tag_ptr(ret_ret, true);
69174 }
69175
69176 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
69177         LDKPhantomKeysManager this_obj_conv;
69178         this_obj_conv.inner = untag_ptr(this_obj);
69179         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69181         PhantomKeysManager_free(this_obj_conv);
69182 }
69183
69184 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_EntropySource"))) TS_PhantomKeysManager_as_EntropySource(uint64_t this_arg) {
69185         LDKPhantomKeysManager this_arg_conv;
69186         this_arg_conv.inner = untag_ptr(this_arg);
69187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69189         this_arg_conv.is_owned = false;
69190         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
69191         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
69192         return tag_ptr(ret_ret, true);
69193 }
69194
69195 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_NodeSigner"))) TS_PhantomKeysManager_as_NodeSigner(uint64_t this_arg) {
69196         LDKPhantomKeysManager this_arg_conv;
69197         this_arg_conv.inner = untag_ptr(this_arg);
69198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69200         this_arg_conv.is_owned = false;
69201         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
69202         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
69203         return tag_ptr(ret_ret, true);
69204 }
69205
69206 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_SignerProvider"))) TS_PhantomKeysManager_as_SignerProvider(uint64_t this_arg) {
69207         LDKPhantomKeysManager this_arg_conv;
69208         this_arg_conv.inner = untag_ptr(this_arg);
69209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69211         this_arg_conv.is_owned = false;
69212         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
69213         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
69214         return tag_ptr(ret_ret, true);
69215 }
69216
69217 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) {
69218         uint8_t seed_arr[32];
69219         CHECK(seed->arr_len == 32);
69220         memcpy(seed_arr, seed->elems, 32); FREE(seed);
69221         uint8_t (*seed_ref)[32] = &seed_arr;
69222         uint8_t cross_node_seed_arr[32];
69223         CHECK(cross_node_seed->arr_len == 32);
69224         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
69225         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
69226         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
69227         uint64_t ret_ref = 0;
69228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69230         return ret_ref;
69231 }
69232
69233 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) {
69234         LDKPhantomKeysManager this_arg_conv;
69235         this_arg_conv.inner = untag_ptr(this_arg);
69236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69238         this_arg_conv.is_owned = false;
69239         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
69240         descriptors_constr.datalen = descriptors->arr_len;
69241         if (descriptors_constr.datalen > 0)
69242                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
69243         else
69244                 descriptors_constr.data = NULL;
69245         uint64_t* descriptors_vals = descriptors->elems;
69246         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
69247                 uint64_t descriptors_conv_27 = descriptors_vals[b];
69248                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
69249                 CHECK_ACCESS(descriptors_conv_27_ptr);
69250                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
69251                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
69252                 descriptors_constr.data[b] = descriptors_conv_27_conv;
69253         }
69254         FREE(descriptors);
69255         LDKCVec_TxOutZ outputs_constr;
69256         outputs_constr.datalen = outputs->arr_len;
69257         if (outputs_constr.datalen > 0)
69258                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
69259         else
69260                 outputs_constr.data = NULL;
69261         uint64_t* outputs_vals = outputs->elems;
69262         for (size_t h = 0; h < outputs_constr.datalen; h++) {
69263                 uint64_t outputs_conv_7 = outputs_vals[h];
69264                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
69265                 CHECK_ACCESS(outputs_conv_7_ptr);
69266                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
69267                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
69268                 outputs_constr.data[h] = outputs_conv_7_conv;
69269         }
69270         FREE(outputs);
69271         LDKCVec_u8Z change_destination_script_ref;
69272         change_destination_script_ref.datalen = change_destination_script->arr_len;
69273         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
69274         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
69275         void* locktime_ptr = untag_ptr(locktime);
69276         CHECK_ACCESS(locktime_ptr);
69277         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
69278         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
69279         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
69280         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
69281         return tag_ptr(ret_conv, true);
69282 }
69283
69284 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) {
69285         LDKPhantomKeysManager this_arg_conv;
69286         this_arg_conv.inner = untag_ptr(this_arg);
69287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69289         this_arg_conv.is_owned = false;
69290         uint8_t params_arr[32];
69291         CHECK(params->arr_len == 32);
69292         memcpy(params_arr, params->elems, 32); FREE(params);
69293         uint8_t (*params_ref)[32] = &params_arr;
69294         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
69295         uint64_t ret_ref = 0;
69296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69298         return ret_ref;
69299 }
69300
69301 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_node_secret_key"))) TS_PhantomKeysManager_get_node_secret_key(uint64_t this_arg) {
69302         LDKPhantomKeysManager this_arg_conv;
69303         this_arg_conv.inner = untag_ptr(this_arg);
69304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69306         this_arg_conv.is_owned = false;
69307         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69308         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
69309         return ret_arr;
69310 }
69311
69312 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_phantom_node_secret_key"))) TS_PhantomKeysManager_get_phantom_node_secret_key(uint64_t this_arg) {
69313         LDKPhantomKeysManager this_arg_conv;
69314         this_arg_conv.inner = untag_ptr(this_arg);
69315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69317         this_arg_conv.is_owned = false;
69318         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69319         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
69320         return ret_arr;
69321 }
69322
69323 void  __attribute__((export_name("TS_EcdsaChannelSigner_free"))) TS_EcdsaChannelSigner_free(uint64_t this_ptr) {
69324         if (!ptr_is_owned(this_ptr)) return;
69325         void* this_ptr_ptr = untag_ptr(this_ptr);
69326         CHECK_ACCESS(this_ptr_ptr);
69327         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
69328         FREE(untag_ptr(this_ptr));
69329         EcdsaChannelSigner_free(this_ptr_conv);
69330 }
69331
69332 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
69333         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
69334         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
69335         return tag_ptr(ret_ret, true);
69336 }
69337 int64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone_ptr"))) TS_WriteableEcdsaChannelSigner_clone_ptr(uint64_t arg) {
69338         void* arg_ptr = untag_ptr(arg);
69339         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
69340         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
69341         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
69342         return ret_conv;
69343 }
69344
69345 uint64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone"))) TS_WriteableEcdsaChannelSigner_clone(uint64_t orig) {
69346         void* orig_ptr = untag_ptr(orig);
69347         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
69348         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
69349         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
69350         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
69351         return tag_ptr(ret_ret, true);
69352 }
69353
69354 void  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_free"))) TS_WriteableEcdsaChannelSigner_free(uint64_t this_ptr) {
69355         if (!ptr_is_owned(this_ptr)) return;
69356         void* this_ptr_ptr = untag_ptr(this_ptr);
69357         CHECK_ACCESS(this_ptr_ptr);
69358         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
69359         FREE(untag_ptr(this_ptr));
69360         WriteableEcdsaChannelSigner_free(this_ptr_conv);
69361 }
69362
69363 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
69364         LDKOnionMessenger this_obj_conv;
69365         this_obj_conv.inner = untag_ptr(this_obj);
69366         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69368         OnionMessenger_free(this_obj_conv);
69369 }
69370
69371 void  __attribute__((export_name("TS_MessageRouter_free"))) TS_MessageRouter_free(uint64_t this_ptr) {
69372         if (!ptr_is_owned(this_ptr)) return;
69373         void* this_ptr_ptr = untag_ptr(this_ptr);
69374         CHECK_ACCESS(this_ptr_ptr);
69375         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
69376         FREE(untag_ptr(this_ptr));
69377         MessageRouter_free(this_ptr_conv);
69378 }
69379
69380 void  __attribute__((export_name("TS_DefaultMessageRouter_free"))) TS_DefaultMessageRouter_free(uint64_t this_obj) {
69381         LDKDefaultMessageRouter this_obj_conv;
69382         this_obj_conv.inner = untag_ptr(this_obj);
69383         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69385         DefaultMessageRouter_free(this_obj_conv);
69386 }
69387
69388 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_new"))) TS_DefaultMessageRouter_new(uint64_t network_graph, uint64_t entropy_source) {
69389         LDKNetworkGraph network_graph_conv;
69390         network_graph_conv.inner = untag_ptr(network_graph);
69391         network_graph_conv.is_owned = ptr_is_owned(network_graph);
69392         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
69393         network_graph_conv.is_owned = false;
69394         void* entropy_source_ptr = untag_ptr(entropy_source);
69395         CHECK_ACCESS(entropy_source_ptr);
69396         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69397         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69398                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69399                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69400         }
69401         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new(&network_graph_conv, entropy_source_conv);
69402         uint64_t ret_ref = 0;
69403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69405         return ret_ref;
69406 }
69407
69408 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_as_MessageRouter"))) TS_DefaultMessageRouter_as_MessageRouter(uint64_t this_arg) {
69409         LDKDefaultMessageRouter this_arg_conv;
69410         this_arg_conv.inner = untag_ptr(this_arg);
69411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69413         this_arg_conv.is_owned = false;
69414         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
69415         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
69416         return tag_ptr(ret_ret, true);
69417 }
69418
69419 void  __attribute__((export_name("TS_OnionMessagePath_free"))) TS_OnionMessagePath_free(uint64_t this_obj) {
69420         LDKOnionMessagePath this_obj_conv;
69421         this_obj_conv.inner = untag_ptr(this_obj);
69422         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69424         OnionMessagePath_free(this_obj_conv);
69425 }
69426
69427 ptrArray  __attribute__((export_name("TS_OnionMessagePath_get_intermediate_nodes"))) TS_OnionMessagePath_get_intermediate_nodes(uint64_t this_ptr) {
69428         LDKOnionMessagePath this_ptr_conv;
69429         this_ptr_conv.inner = untag_ptr(this_ptr);
69430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69432         this_ptr_conv.is_owned = false;
69433         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
69434         ptrArray ret_arr = NULL;
69435         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
69436         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
69437         for (size_t m = 0; m < ret_var.datalen; m++) {
69438                 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
69439                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
69440                 ret_arr_ptr[m] = ret_conv_12_arr;
69441         }
69442         
69443         FREE(ret_var.data);
69444         return ret_arr;
69445 }
69446
69447 void  __attribute__((export_name("TS_OnionMessagePath_set_intermediate_nodes"))) TS_OnionMessagePath_set_intermediate_nodes(uint64_t this_ptr, ptrArray val) {
69448         LDKOnionMessagePath this_ptr_conv;
69449         this_ptr_conv.inner = untag_ptr(this_ptr);
69450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69452         this_ptr_conv.is_owned = false;
69453         LDKCVec_PublicKeyZ val_constr;
69454         val_constr.datalen = val->arr_len;
69455         if (val_constr.datalen > 0)
69456                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
69457         else
69458                 val_constr.data = NULL;
69459         int8_tArray* val_vals = (void*) val->elems;
69460         for (size_t m = 0; m < val_constr.datalen; m++) {
69461                 int8_tArray val_conv_12 = val_vals[m];
69462                 LDKPublicKey val_conv_12_ref;
69463                 CHECK(val_conv_12->arr_len == 33);
69464                 memcpy(val_conv_12_ref.compressed_form, val_conv_12->elems, 33); FREE(val_conv_12);
69465                 val_constr.data[m] = val_conv_12_ref;
69466         }
69467         FREE(val);
69468         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
69469 }
69470
69471 uint64_t  __attribute__((export_name("TS_OnionMessagePath_get_destination"))) TS_OnionMessagePath_get_destination(uint64_t this_ptr) {
69472         LDKOnionMessagePath this_ptr_conv;
69473         this_ptr_conv.inner = untag_ptr(this_ptr);
69474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69476         this_ptr_conv.is_owned = false;
69477         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69478         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
69479         uint64_t ret_ref = tag_ptr(ret_copy, true);
69480         return ret_ref;
69481 }
69482
69483 void  __attribute__((export_name("TS_OnionMessagePath_set_destination"))) TS_OnionMessagePath_set_destination(uint64_t this_ptr, uint64_t val) {
69484         LDKOnionMessagePath this_ptr_conv;
69485         this_ptr_conv.inner = untag_ptr(this_ptr);
69486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69488         this_ptr_conv.is_owned = false;
69489         void* val_ptr = untag_ptr(val);
69490         CHECK_ACCESS(val_ptr);
69491         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
69492         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
69493         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
69494 }
69495
69496 uint64_t  __attribute__((export_name("TS_OnionMessagePath_get_first_node_addresses"))) TS_OnionMessagePath_get_first_node_addresses(uint64_t this_ptr) {
69497         LDKOnionMessagePath this_ptr_conv;
69498         this_ptr_conv.inner = untag_ptr(this_ptr);
69499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69501         this_ptr_conv.is_owned = false;
69502         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
69503         *ret_copy = OnionMessagePath_get_first_node_addresses(&this_ptr_conv);
69504         uint64_t ret_ref = tag_ptr(ret_copy, true);
69505         return ret_ref;
69506 }
69507
69508 void  __attribute__((export_name("TS_OnionMessagePath_set_first_node_addresses"))) TS_OnionMessagePath_set_first_node_addresses(uint64_t this_ptr, uint64_t val) {
69509         LDKOnionMessagePath this_ptr_conv;
69510         this_ptr_conv.inner = untag_ptr(this_ptr);
69511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69513         this_ptr_conv.is_owned = false;
69514         void* val_ptr = untag_ptr(val);
69515         CHECK_ACCESS(val_ptr);
69516         LDKCOption_CVec_SocketAddressZZ val_conv = *(LDKCOption_CVec_SocketAddressZZ*)(val_ptr);
69517         val_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(val));
69518         OnionMessagePath_set_first_node_addresses(&this_ptr_conv, val_conv);
69519 }
69520
69521 uint64_t  __attribute__((export_name("TS_OnionMessagePath_new"))) TS_OnionMessagePath_new(ptrArray intermediate_nodes_arg, uint64_t destination_arg, uint64_t first_node_addresses_arg) {
69522         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
69523         intermediate_nodes_arg_constr.datalen = intermediate_nodes_arg->arr_len;
69524         if (intermediate_nodes_arg_constr.datalen > 0)
69525                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
69526         else
69527                 intermediate_nodes_arg_constr.data = NULL;
69528         int8_tArray* intermediate_nodes_arg_vals = (void*) intermediate_nodes_arg->elems;
69529         for (size_t m = 0; m < intermediate_nodes_arg_constr.datalen; m++) {
69530                 int8_tArray intermediate_nodes_arg_conv_12 = intermediate_nodes_arg_vals[m];
69531                 LDKPublicKey intermediate_nodes_arg_conv_12_ref;
69532                 CHECK(intermediate_nodes_arg_conv_12->arr_len == 33);
69533                 memcpy(intermediate_nodes_arg_conv_12_ref.compressed_form, intermediate_nodes_arg_conv_12->elems, 33); FREE(intermediate_nodes_arg_conv_12);
69534                 intermediate_nodes_arg_constr.data[m] = intermediate_nodes_arg_conv_12_ref;
69535         }
69536         FREE(intermediate_nodes_arg);
69537         void* destination_arg_ptr = untag_ptr(destination_arg);
69538         CHECK_ACCESS(destination_arg_ptr);
69539         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
69540         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
69541         void* first_node_addresses_arg_ptr = untag_ptr(first_node_addresses_arg);
69542         CHECK_ACCESS(first_node_addresses_arg_ptr);
69543         LDKCOption_CVec_SocketAddressZZ first_node_addresses_arg_conv = *(LDKCOption_CVec_SocketAddressZZ*)(first_node_addresses_arg_ptr);
69544         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv, first_node_addresses_arg_conv);
69545         uint64_t ret_ref = 0;
69546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69548         return ret_ref;
69549 }
69550
69551 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
69552         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
69553         uint64_t ret_ref = 0;
69554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69556         return ret_ref;
69557 }
69558 int64_t  __attribute__((export_name("TS_OnionMessagePath_clone_ptr"))) TS_OnionMessagePath_clone_ptr(uint64_t arg) {
69559         LDKOnionMessagePath arg_conv;
69560         arg_conv.inner = untag_ptr(arg);
69561         arg_conv.is_owned = ptr_is_owned(arg);
69562         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69563         arg_conv.is_owned = false;
69564         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
69565         return ret_conv;
69566 }
69567
69568 uint64_t  __attribute__((export_name("TS_OnionMessagePath_clone"))) TS_OnionMessagePath_clone(uint64_t orig) {
69569         LDKOnionMessagePath orig_conv;
69570         orig_conv.inner = untag_ptr(orig);
69571         orig_conv.is_owned = ptr_is_owned(orig);
69572         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69573         orig_conv.is_owned = false;
69574         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
69575         uint64_t ret_ref = 0;
69576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69578         return ret_ref;
69579 }
69580
69581 int8_tArray  __attribute__((export_name("TS_OnionMessagePath_first_node"))) TS_OnionMessagePath_first_node(uint64_t this_arg) {
69582         LDKOnionMessagePath this_arg_conv;
69583         this_arg_conv.inner = untag_ptr(this_arg);
69584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69586         this_arg_conv.is_owned = false;
69587         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
69588         memcpy(ret_arr->elems, OnionMessagePath_first_node(&this_arg_conv).compressed_form, 33);
69589         return ret_arr;
69590 }
69591
69592 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
69593         if (!ptr_is_owned(this_ptr)) return;
69594         void* this_ptr_ptr = untag_ptr(this_ptr);
69595         CHECK_ACCESS(this_ptr_ptr);
69596         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
69597         FREE(untag_ptr(this_ptr));
69598         Destination_free(this_ptr_conv);
69599 }
69600
69601 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
69602         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69603         *ret_copy = Destination_clone(arg);
69604         uint64_t ret_ref = tag_ptr(ret_copy, true);
69605         return ret_ref;
69606 }
69607 int64_t  __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
69608         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
69609         int64_t ret_conv = Destination_clone_ptr(arg_conv);
69610         return ret_conv;
69611 }
69612
69613 uint64_t  __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
69614         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
69615         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69616         *ret_copy = Destination_clone(orig_conv);
69617         uint64_t ret_ref = tag_ptr(ret_copy, true);
69618         return ret_ref;
69619 }
69620
69621 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
69622         LDKPublicKey a_ref;
69623         CHECK(a->arr_len == 33);
69624         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
69625         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69626         *ret_copy = Destination_node(a_ref);
69627         uint64_t ret_ref = tag_ptr(ret_copy, true);
69628         return ret_ref;
69629 }
69630
69631 uint64_t  __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
69632         LDKBlindedPath a_conv;
69633         a_conv.inner = untag_ptr(a);
69634         a_conv.is_owned = ptr_is_owned(a);
69635         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69636         a_conv = BlindedPath_clone(&a_conv);
69637         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69638         *ret_copy = Destination_blinded_path(a_conv);
69639         uint64_t ret_ref = tag_ptr(ret_copy, true);
69640         return ret_ref;
69641 }
69642
69643 void  __attribute__((export_name("TS_SendSuccess_free"))) TS_SendSuccess_free(uint64_t this_ptr) {
69644         if (!ptr_is_owned(this_ptr)) return;
69645         void* this_ptr_ptr = untag_ptr(this_ptr);
69646         CHECK_ACCESS(this_ptr_ptr);
69647         LDKSendSuccess this_ptr_conv = *(LDKSendSuccess*)(this_ptr_ptr);
69648         FREE(untag_ptr(this_ptr));
69649         SendSuccess_free(this_ptr_conv);
69650 }
69651
69652 static inline uint64_t SendSuccess_clone_ptr(LDKSendSuccess *NONNULL_PTR arg) {
69653         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
69654         *ret_copy = SendSuccess_clone(arg);
69655         uint64_t ret_ref = tag_ptr(ret_copy, true);
69656         return ret_ref;
69657 }
69658 int64_t  __attribute__((export_name("TS_SendSuccess_clone_ptr"))) TS_SendSuccess_clone_ptr(uint64_t arg) {
69659         LDKSendSuccess* arg_conv = (LDKSendSuccess*)untag_ptr(arg);
69660         int64_t ret_conv = SendSuccess_clone_ptr(arg_conv);
69661         return ret_conv;
69662 }
69663
69664 uint64_t  __attribute__((export_name("TS_SendSuccess_clone"))) TS_SendSuccess_clone(uint64_t orig) {
69665         LDKSendSuccess* orig_conv = (LDKSendSuccess*)untag_ptr(orig);
69666         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
69667         *ret_copy = SendSuccess_clone(orig_conv);
69668         uint64_t ret_ref = tag_ptr(ret_copy, true);
69669         return ret_ref;
69670 }
69671
69672 uint64_t  __attribute__((export_name("TS_SendSuccess_buffered"))) TS_SendSuccess_buffered() {
69673         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
69674         *ret_copy = SendSuccess_buffered();
69675         uint64_t ret_ref = tag_ptr(ret_copy, true);
69676         return ret_ref;
69677 }
69678
69679 uint64_t  __attribute__((export_name("TS_SendSuccess_buffered_awaiting_connection"))) TS_SendSuccess_buffered_awaiting_connection(int8_tArray a) {
69680         LDKPublicKey a_ref;
69681         CHECK(a->arr_len == 33);
69682         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
69683         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
69684         *ret_copy = SendSuccess_buffered_awaiting_connection(a_ref);
69685         uint64_t ret_ref = tag_ptr(ret_copy, true);
69686         return ret_ref;
69687 }
69688
69689 jboolean  __attribute__((export_name("TS_SendSuccess_eq"))) TS_SendSuccess_eq(uint64_t a, uint64_t b) {
69690         LDKSendSuccess* a_conv = (LDKSendSuccess*)untag_ptr(a);
69691         LDKSendSuccess* b_conv = (LDKSendSuccess*)untag_ptr(b);
69692         jboolean ret_conv = SendSuccess_eq(a_conv, b_conv);
69693         return ret_conv;
69694 }
69695
69696 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
69697         if (!ptr_is_owned(this_ptr)) return;
69698         void* this_ptr_ptr = untag_ptr(this_ptr);
69699         CHECK_ACCESS(this_ptr_ptr);
69700         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
69701         FREE(untag_ptr(this_ptr));
69702         SendError_free(this_ptr_conv);
69703 }
69704
69705 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
69706         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69707         *ret_copy = SendError_clone(arg);
69708         uint64_t ret_ref = tag_ptr(ret_copy, true);
69709         return ret_ref;
69710 }
69711 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
69712         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
69713         int64_t ret_conv = SendError_clone_ptr(arg_conv);
69714         return ret_conv;
69715 }
69716
69717 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
69718         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
69719         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69720         *ret_copy = SendError_clone(orig_conv);
69721         uint64_t ret_ref = tag_ptr(ret_copy, true);
69722         return ret_ref;
69723 }
69724
69725 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
69726         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
69727         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69728         *ret_copy = SendError_secp256k1(a_conv);
69729         uint64_t ret_ref = tag_ptr(ret_copy, true);
69730         return ret_ref;
69731 }
69732
69733 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
69734         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69735         *ret_copy = SendError_too_big_packet();
69736         uint64_t ret_ref = tag_ptr(ret_copy, true);
69737         return ret_ref;
69738 }
69739
69740 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
69741         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69742         *ret_copy = SendError_too_few_blinded_hops();
69743         uint64_t ret_ref = tag_ptr(ret_copy, true);
69744         return ret_ref;
69745 }
69746
69747 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop(int8_tArray a) {
69748         LDKPublicKey a_ref;
69749         CHECK(a->arr_len == 33);
69750         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
69751         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69752         *ret_copy = SendError_invalid_first_hop(a_ref);
69753         uint64_t ret_ref = tag_ptr(ret_copy, true);
69754         return ret_ref;
69755 }
69756
69757 uint64_t  __attribute__((export_name("TS_SendError_path_not_found"))) TS_SendError_path_not_found() {
69758         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69759         *ret_copy = SendError_path_not_found();
69760         uint64_t ret_ref = tag_ptr(ret_copy, true);
69761         return ret_ref;
69762 }
69763
69764 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
69765         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69766         *ret_copy = SendError_invalid_message();
69767         uint64_t ret_ref = tag_ptr(ret_copy, true);
69768         return ret_ref;
69769 }
69770
69771 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
69772         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69773         *ret_copy = SendError_buffer_full();
69774         uint64_t ret_ref = tag_ptr(ret_copy, true);
69775         return ret_ref;
69776 }
69777
69778 uint64_t  __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
69779         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69780         *ret_copy = SendError_get_node_id_failed();
69781         uint64_t ret_ref = tag_ptr(ret_copy, true);
69782         return ret_ref;
69783 }
69784
69785 uint64_t  __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
69786         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69787         *ret_copy = SendError_blinded_path_advance_failed();
69788         uint64_t ret_ref = tag_ptr(ret_copy, true);
69789         return ret_ref;
69790 }
69791
69792 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
69793         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
69794         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
69795         jboolean ret_conv = SendError_eq(a_conv, b_conv);
69796         return ret_conv;
69797 }
69798
69799 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
69800         if (!ptr_is_owned(this_ptr)) return;
69801         void* this_ptr_ptr = untag_ptr(this_ptr);
69802         CHECK_ACCESS(this_ptr_ptr);
69803         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
69804         FREE(untag_ptr(this_ptr));
69805         CustomOnionMessageHandler_free(this_ptr_conv);
69806 }
69807
69808 void  __attribute__((export_name("TS_PeeledOnion_free"))) TS_PeeledOnion_free(uint64_t this_ptr) {
69809         if (!ptr_is_owned(this_ptr)) return;
69810         void* this_ptr_ptr = untag_ptr(this_ptr);
69811         CHECK_ACCESS(this_ptr_ptr);
69812         LDKPeeledOnion this_ptr_conv = *(LDKPeeledOnion*)(this_ptr_ptr);
69813         FREE(untag_ptr(this_ptr));
69814         PeeledOnion_free(this_ptr_conv);
69815 }
69816
69817 static inline uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg) {
69818         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
69819         *ret_copy = PeeledOnion_clone(arg);
69820         uint64_t ret_ref = tag_ptr(ret_copy, true);
69821         return ret_ref;
69822 }
69823 int64_t  __attribute__((export_name("TS_PeeledOnion_clone_ptr"))) TS_PeeledOnion_clone_ptr(uint64_t arg) {
69824         LDKPeeledOnion* arg_conv = (LDKPeeledOnion*)untag_ptr(arg);
69825         int64_t ret_conv = PeeledOnion_clone_ptr(arg_conv);
69826         return ret_conv;
69827 }
69828
69829 uint64_t  __attribute__((export_name("TS_PeeledOnion_clone"))) TS_PeeledOnion_clone(uint64_t orig) {
69830         LDKPeeledOnion* orig_conv = (LDKPeeledOnion*)untag_ptr(orig);
69831         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
69832         *ret_copy = PeeledOnion_clone(orig_conv);
69833         uint64_t ret_ref = tag_ptr(ret_copy, true);
69834         return ret_ref;
69835 }
69836
69837 uint64_t  __attribute__((export_name("TS_PeeledOnion_forward"))) TS_PeeledOnion_forward(int8_tArray a, uint64_t b) {
69838         LDKPublicKey a_ref;
69839         CHECK(a->arr_len == 33);
69840         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
69841         LDKOnionMessage b_conv;
69842         b_conv.inner = untag_ptr(b);
69843         b_conv.is_owned = ptr_is_owned(b);
69844         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69845         b_conv = OnionMessage_clone(&b_conv);
69846         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
69847         *ret_copy = PeeledOnion_forward(a_ref, b_conv);
69848         uint64_t ret_ref = tag_ptr(ret_copy, true);
69849         return ret_ref;
69850 }
69851
69852 uint64_t  __attribute__((export_name("TS_PeeledOnion_receive"))) TS_PeeledOnion_receive(uint64_t a, int8_tArray b, uint64_t c) {
69853         void* a_ptr = untag_ptr(a);
69854         CHECK_ACCESS(a_ptr);
69855         LDKParsedOnionMessageContents a_conv = *(LDKParsedOnionMessageContents*)(a_ptr);
69856         a_conv = ParsedOnionMessageContents_clone((LDKParsedOnionMessageContents*)untag_ptr(a));
69857         LDKThirtyTwoBytes b_ref;
69858         CHECK(b->arr_len == 32);
69859         memcpy(b_ref.data, b->elems, 32); FREE(b);
69860         LDKBlindedPath c_conv;
69861         c_conv.inner = untag_ptr(c);
69862         c_conv.is_owned = ptr_is_owned(c);
69863         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
69864         c_conv = BlindedPath_clone(&c_conv);
69865         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
69866         *ret_copy = PeeledOnion_receive(a_conv, b_ref, c_conv);
69867         uint64_t ret_ref = tag_ptr(ret_copy, true);
69868         return ret_ref;
69869 }
69870
69871 uint64_t  __attribute__((export_name("TS_create_onion_message"))) TS_create_onion_message(uint64_t entropy_source, uint64_t node_signer, uint64_t path, uint64_t contents, uint64_t reply_path) {
69872         void* entropy_source_ptr = untag_ptr(entropy_source);
69873         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
69874         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
69875         void* node_signer_ptr = untag_ptr(node_signer);
69876         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
69877         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
69878         LDKOnionMessagePath path_conv;
69879         path_conv.inner = untag_ptr(path);
69880         path_conv.is_owned = ptr_is_owned(path);
69881         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
69882         path_conv = OnionMessagePath_clone(&path_conv);
69883         void* contents_ptr = untag_ptr(contents);
69884         CHECK_ACCESS(contents_ptr);
69885         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
69886         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
69887                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69888                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
69889         }
69890         LDKBlindedPath reply_path_conv;
69891         reply_path_conv.inner = untag_ptr(reply_path);
69892         reply_path_conv.is_owned = ptr_is_owned(reply_path);
69893         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
69894         reply_path_conv = BlindedPath_clone(&reply_path_conv);
69895         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
69896         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, path_conv, contents_conv, reply_path_conv);
69897         return tag_ptr(ret_conv, true);
69898 }
69899
69900 uint64_t  __attribute__((export_name("TS_peel_onion_message"))) TS_peel_onion_message(uint64_t msg, uint64_t node_signer, uint64_t logger, uint64_t custom_handler) {
69901         LDKOnionMessage msg_conv;
69902         msg_conv.inner = untag_ptr(msg);
69903         msg_conv.is_owned = ptr_is_owned(msg);
69904         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69905         msg_conv.is_owned = false;
69906         void* node_signer_ptr = untag_ptr(node_signer);
69907         CHECK_ACCESS(node_signer_ptr);
69908         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69909         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69910                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69911                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69912         }
69913         void* logger_ptr = untag_ptr(logger);
69914         CHECK_ACCESS(logger_ptr);
69915         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69916         if (logger_conv.free == LDKLogger_JCalls_free) {
69917                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69918                 LDKLogger_JCalls_cloned(&logger_conv);
69919         }
69920         void* custom_handler_ptr = untag_ptr(custom_handler);
69921         CHECK_ACCESS(custom_handler_ptr);
69922         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
69923         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
69924                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69925                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
69926         }
69927         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
69928         *ret_conv = peel_onion_message(&msg_conv, node_signer_conv, logger_conv, custom_handler_conv);
69929         return tag_ptr(ret_conv, true);
69930 }
69931
69932 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) {
69933         void* entropy_source_ptr = untag_ptr(entropy_source);
69934         CHECK_ACCESS(entropy_source_ptr);
69935         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69936         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69937                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69938                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69939         }
69940         void* node_signer_ptr = untag_ptr(node_signer);
69941         CHECK_ACCESS(node_signer_ptr);
69942         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69943         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69944                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69945                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69946         }
69947         void* logger_ptr = untag_ptr(logger);
69948         CHECK_ACCESS(logger_ptr);
69949         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69950         if (logger_conv.free == LDKLogger_JCalls_free) {
69951                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69952                 LDKLogger_JCalls_cloned(&logger_conv);
69953         }
69954         void* message_router_ptr = untag_ptr(message_router);
69955         CHECK_ACCESS(message_router_ptr);
69956         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
69957         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
69958                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69959                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
69960         }
69961         void* offers_handler_ptr = untag_ptr(offers_handler);
69962         CHECK_ACCESS(offers_handler_ptr);
69963         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
69964         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
69965                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69966                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
69967         }
69968         void* custom_handler_ptr = untag_ptr(custom_handler);
69969         CHECK_ACCESS(custom_handler_ptr);
69970         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
69971         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
69972                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69973                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
69974         }
69975         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
69976         uint64_t ret_ref = 0;
69977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69979         return ret_ref;
69980 }
69981
69982 uint64_t  __attribute__((export_name("TS_OnionMessenger_send_onion_message"))) TS_OnionMessenger_send_onion_message(uint64_t this_arg, uint64_t contents, uint64_t destination, uint64_t reply_path) {
69983         LDKOnionMessenger this_arg_conv;
69984         this_arg_conv.inner = untag_ptr(this_arg);
69985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69987         this_arg_conv.is_owned = false;
69988         void* contents_ptr = untag_ptr(contents);
69989         CHECK_ACCESS(contents_ptr);
69990         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
69991         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
69992                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69993                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
69994         }
69995         void* destination_ptr = untag_ptr(destination);
69996         CHECK_ACCESS(destination_ptr);
69997         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
69998         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
69999         LDKBlindedPath reply_path_conv;
70000         reply_path_conv.inner = untag_ptr(reply_path);
70001         reply_path_conv.is_owned = ptr_is_owned(reply_path);
70002         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
70003         reply_path_conv = BlindedPath_clone(&reply_path_conv);
70004         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
70005         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, contents_conv, destination_conv, reply_path_conv);
70006         return tag_ptr(ret_conv, true);
70007 }
70008
70009 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
70010         LDKOnionMessenger this_arg_conv;
70011         this_arg_conv.inner = untag_ptr(this_arg);
70012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70014         this_arg_conv.is_owned = false;
70015         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
70016         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
70017         return tag_ptr(ret_ret, true);
70018 }
70019
70020 void  __attribute__((export_name("TS_OffersMessageHandler_free"))) TS_OffersMessageHandler_free(uint64_t this_ptr) {
70021         if (!ptr_is_owned(this_ptr)) return;
70022         void* this_ptr_ptr = untag_ptr(this_ptr);
70023         CHECK_ACCESS(this_ptr_ptr);
70024         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
70025         FREE(untag_ptr(this_ptr));
70026         OffersMessageHandler_free(this_ptr_conv);
70027 }
70028
70029 void  __attribute__((export_name("TS_OffersMessage_free"))) TS_OffersMessage_free(uint64_t this_ptr) {
70030         if (!ptr_is_owned(this_ptr)) return;
70031         void* this_ptr_ptr = untag_ptr(this_ptr);
70032         CHECK_ACCESS(this_ptr_ptr);
70033         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
70034         FREE(untag_ptr(this_ptr));
70035         OffersMessage_free(this_ptr_conv);
70036 }
70037
70038 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
70039         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70040         *ret_copy = OffersMessage_clone(arg);
70041         uint64_t ret_ref = tag_ptr(ret_copy, true);
70042         return ret_ref;
70043 }
70044 int64_t  __attribute__((export_name("TS_OffersMessage_clone_ptr"))) TS_OffersMessage_clone_ptr(uint64_t arg) {
70045         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
70046         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
70047         return ret_conv;
70048 }
70049
70050 uint64_t  __attribute__((export_name("TS_OffersMessage_clone"))) TS_OffersMessage_clone(uint64_t orig) {
70051         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
70052         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70053         *ret_copy = OffersMessage_clone(orig_conv);
70054         uint64_t ret_ref = tag_ptr(ret_copy, true);
70055         return ret_ref;
70056 }
70057
70058 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_request"))) TS_OffersMessage_invoice_request(uint64_t a) {
70059         LDKInvoiceRequest a_conv;
70060         a_conv.inner = untag_ptr(a);
70061         a_conv.is_owned = ptr_is_owned(a);
70062         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70063         a_conv = InvoiceRequest_clone(&a_conv);
70064         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70065         *ret_copy = OffersMessage_invoice_request(a_conv);
70066         uint64_t ret_ref = tag_ptr(ret_copy, true);
70067         return ret_ref;
70068 }
70069
70070 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice"))) TS_OffersMessage_invoice(uint64_t a) {
70071         LDKBolt12Invoice a_conv;
70072         a_conv.inner = untag_ptr(a);
70073         a_conv.is_owned = ptr_is_owned(a);
70074         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70075         a_conv = Bolt12Invoice_clone(&a_conv);
70076         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70077         *ret_copy = OffersMessage_invoice(a_conv);
70078         uint64_t ret_ref = tag_ptr(ret_copy, true);
70079         return ret_ref;
70080 }
70081
70082 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_error"))) TS_OffersMessage_invoice_error(uint64_t a) {
70083         LDKInvoiceError a_conv;
70084         a_conv.inner = untag_ptr(a);
70085         a_conv.is_owned = ptr_is_owned(a);
70086         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70087         a_conv = InvoiceError_clone(&a_conv);
70088         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70089         *ret_copy = OffersMessage_invoice_error(a_conv);
70090         uint64_t ret_ref = tag_ptr(ret_copy, true);
70091         return ret_ref;
70092 }
70093
70094 jboolean  __attribute__((export_name("TS_OffersMessage_is_known_type"))) TS_OffersMessage_is_known_type(int64_t tlv_type) {
70095         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
70096         return ret_conv;
70097 }
70098
70099 uint64_t  __attribute__((export_name("TS_OffersMessage_as_OnionMessageContents"))) TS_OffersMessage_as_OnionMessageContents(uint64_t this_arg) {
70100         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
70101         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
70102         *ret_ret = OffersMessage_as_OnionMessageContents(this_arg_conv);
70103         return tag_ptr(ret_ret, true);
70104 }
70105
70106 int8_tArray  __attribute__((export_name("TS_OffersMessage_write"))) TS_OffersMessage_write(uint64_t obj) {
70107         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
70108         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
70109         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70110         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70111         CVec_u8Z_free(ret_var);
70112         return ret_arr;
70113 }
70114
70115 uint64_t  __attribute__((export_name("TS_OffersMessage_read"))) TS_OffersMessage_read(int8_tArray ser, int64_t arg_a, uint64_t arg_b) {
70116         LDKu8slice ser_ref;
70117         ser_ref.datalen = ser->arr_len;
70118         ser_ref.data = ser->elems;
70119         void* arg_b_ptr = untag_ptr(arg_b);
70120         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
70121         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
70122         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
70123         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
70124         FREE(ser);
70125         return tag_ptr(ret_conv, true);
70126 }
70127
70128 void  __attribute__((export_name("TS_Packet_free"))) TS_Packet_free(uint64_t this_obj) {
70129         LDKPacket this_obj_conv;
70130         this_obj_conv.inner = untag_ptr(this_obj);
70131         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70133         Packet_free(this_obj_conv);
70134 }
70135
70136 int8_t  __attribute__((export_name("TS_Packet_get_version"))) TS_Packet_get_version(uint64_t this_ptr) {
70137         LDKPacket this_ptr_conv;
70138         this_ptr_conv.inner = untag_ptr(this_ptr);
70139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70141         this_ptr_conv.is_owned = false;
70142         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
70143         return ret_conv;
70144 }
70145
70146 void  __attribute__((export_name("TS_Packet_set_version"))) TS_Packet_set_version(uint64_t this_ptr, int8_t val) {
70147         LDKPacket this_ptr_conv;
70148         this_ptr_conv.inner = untag_ptr(this_ptr);
70149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70151         this_ptr_conv.is_owned = false;
70152         Packet_set_version(&this_ptr_conv, val);
70153 }
70154
70155 int8_tArray  __attribute__((export_name("TS_Packet_get_public_key"))) TS_Packet_get_public_key(uint64_t this_ptr) {
70156         LDKPacket this_ptr_conv;
70157         this_ptr_conv.inner = untag_ptr(this_ptr);
70158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70160         this_ptr_conv.is_owned = false;
70161         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70162         memcpy(ret_arr->elems, Packet_get_public_key(&this_ptr_conv).compressed_form, 33);
70163         return ret_arr;
70164 }
70165
70166 void  __attribute__((export_name("TS_Packet_set_public_key"))) TS_Packet_set_public_key(uint64_t this_ptr, int8_tArray val) {
70167         LDKPacket this_ptr_conv;
70168         this_ptr_conv.inner = untag_ptr(this_ptr);
70169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70171         this_ptr_conv.is_owned = false;
70172         LDKPublicKey val_ref;
70173         CHECK(val->arr_len == 33);
70174         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70175         Packet_set_public_key(&this_ptr_conv, val_ref);
70176 }
70177
70178 int8_tArray  __attribute__((export_name("TS_Packet_get_hop_data"))) TS_Packet_get_hop_data(uint64_t this_ptr) {
70179         LDKPacket this_ptr_conv;
70180         this_ptr_conv.inner = untag_ptr(this_ptr);
70181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70183         this_ptr_conv.is_owned = false;
70184         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
70185         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70186         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70187         CVec_u8Z_free(ret_var);
70188         return ret_arr;
70189 }
70190
70191 void  __attribute__((export_name("TS_Packet_set_hop_data"))) TS_Packet_set_hop_data(uint64_t this_ptr, int8_tArray val) {
70192         LDKPacket this_ptr_conv;
70193         this_ptr_conv.inner = untag_ptr(this_ptr);
70194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70196         this_ptr_conv.is_owned = false;
70197         LDKCVec_u8Z val_ref;
70198         val_ref.datalen = val->arr_len;
70199         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
70200         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
70201         Packet_set_hop_data(&this_ptr_conv, val_ref);
70202 }
70203
70204 int8_tArray  __attribute__((export_name("TS_Packet_get_hmac"))) TS_Packet_get_hmac(uint64_t this_ptr) {
70205         LDKPacket this_ptr_conv;
70206         this_ptr_conv.inner = untag_ptr(this_ptr);
70207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70209         this_ptr_conv.is_owned = false;
70210         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
70211         memcpy(ret_arr->elems, *Packet_get_hmac(&this_ptr_conv), 32);
70212         return ret_arr;
70213 }
70214
70215 void  __attribute__((export_name("TS_Packet_set_hmac"))) TS_Packet_set_hmac(uint64_t this_ptr, int8_tArray val) {
70216         LDKPacket this_ptr_conv;
70217         this_ptr_conv.inner = untag_ptr(this_ptr);
70218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70220         this_ptr_conv.is_owned = false;
70221         LDKThirtyTwoBytes val_ref;
70222         CHECK(val->arr_len == 32);
70223         memcpy(val_ref.data, val->elems, 32); FREE(val);
70224         Packet_set_hmac(&this_ptr_conv, val_ref);
70225 }
70226
70227 uint64_t  __attribute__((export_name("TS_Packet_new"))) TS_Packet_new(int8_t version_arg, int8_tArray public_key_arg, int8_tArray hop_data_arg, int8_tArray hmac_arg) {
70228         LDKPublicKey public_key_arg_ref;
70229         CHECK(public_key_arg->arr_len == 33);
70230         memcpy(public_key_arg_ref.compressed_form, public_key_arg->elems, 33); FREE(public_key_arg);
70231         LDKCVec_u8Z hop_data_arg_ref;
70232         hop_data_arg_ref.datalen = hop_data_arg->arr_len;
70233         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
70234         memcpy(hop_data_arg_ref.data, hop_data_arg->elems, hop_data_arg_ref.datalen); FREE(hop_data_arg);
70235         LDKThirtyTwoBytes hmac_arg_ref;
70236         CHECK(hmac_arg->arr_len == 32);
70237         memcpy(hmac_arg_ref.data, hmac_arg->elems, 32); FREE(hmac_arg);
70238         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
70239         uint64_t ret_ref = 0;
70240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70242         return ret_ref;
70243 }
70244
70245 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
70246         LDKPacket ret_var = Packet_clone(arg);
70247         uint64_t ret_ref = 0;
70248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70250         return ret_ref;
70251 }
70252 int64_t  __attribute__((export_name("TS_Packet_clone_ptr"))) TS_Packet_clone_ptr(uint64_t arg) {
70253         LDKPacket arg_conv;
70254         arg_conv.inner = untag_ptr(arg);
70255         arg_conv.is_owned = ptr_is_owned(arg);
70256         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70257         arg_conv.is_owned = false;
70258         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
70259         return ret_conv;
70260 }
70261
70262 uint64_t  __attribute__((export_name("TS_Packet_clone"))) TS_Packet_clone(uint64_t orig) {
70263         LDKPacket orig_conv;
70264         orig_conv.inner = untag_ptr(orig);
70265         orig_conv.is_owned = ptr_is_owned(orig);
70266         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70267         orig_conv.is_owned = false;
70268         LDKPacket ret_var = Packet_clone(&orig_conv);
70269         uint64_t ret_ref = 0;
70270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70272         return ret_ref;
70273 }
70274
70275 int64_t  __attribute__((export_name("TS_Packet_hash"))) TS_Packet_hash(uint64_t o) {
70276         LDKPacket o_conv;
70277         o_conv.inner = untag_ptr(o);
70278         o_conv.is_owned = ptr_is_owned(o);
70279         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70280         o_conv.is_owned = false;
70281         int64_t ret_conv = Packet_hash(&o_conv);
70282         return ret_conv;
70283 }
70284
70285 jboolean  __attribute__((export_name("TS_Packet_eq"))) TS_Packet_eq(uint64_t a, uint64_t b) {
70286         LDKPacket a_conv;
70287         a_conv.inner = untag_ptr(a);
70288         a_conv.is_owned = ptr_is_owned(a);
70289         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70290         a_conv.is_owned = false;
70291         LDKPacket b_conv;
70292         b_conv.inner = untag_ptr(b);
70293         b_conv.is_owned = ptr_is_owned(b);
70294         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70295         b_conv.is_owned = false;
70296         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
70297         return ret_conv;
70298 }
70299
70300 int8_tArray  __attribute__((export_name("TS_Packet_write"))) TS_Packet_write(uint64_t obj) {
70301         LDKPacket obj_conv;
70302         obj_conv.inner = untag_ptr(obj);
70303         obj_conv.is_owned = ptr_is_owned(obj);
70304         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70305         obj_conv.is_owned = false;
70306         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
70307         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70308         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70309         CVec_u8Z_free(ret_var);
70310         return ret_arr;
70311 }
70312
70313 void  __attribute__((export_name("TS_ParsedOnionMessageContents_free"))) TS_ParsedOnionMessageContents_free(uint64_t this_ptr) {
70314         if (!ptr_is_owned(this_ptr)) return;
70315         void* this_ptr_ptr = untag_ptr(this_ptr);
70316         CHECK_ACCESS(this_ptr_ptr);
70317         LDKParsedOnionMessageContents this_ptr_conv = *(LDKParsedOnionMessageContents*)(this_ptr_ptr);
70318         FREE(untag_ptr(this_ptr));
70319         ParsedOnionMessageContents_free(this_ptr_conv);
70320 }
70321
70322 static inline uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg) {
70323         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
70324         *ret_copy = ParsedOnionMessageContents_clone(arg);
70325         uint64_t ret_ref = tag_ptr(ret_copy, true);
70326         return ret_ref;
70327 }
70328 int64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_clone_ptr"))) TS_ParsedOnionMessageContents_clone_ptr(uint64_t arg) {
70329         LDKParsedOnionMessageContents* arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(arg);
70330         int64_t ret_conv = ParsedOnionMessageContents_clone_ptr(arg_conv);
70331         return ret_conv;
70332 }
70333
70334 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_clone"))) TS_ParsedOnionMessageContents_clone(uint64_t orig) {
70335         LDKParsedOnionMessageContents* orig_conv = (LDKParsedOnionMessageContents*)untag_ptr(orig);
70336         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
70337         *ret_copy = ParsedOnionMessageContents_clone(orig_conv);
70338         uint64_t ret_ref = tag_ptr(ret_copy, true);
70339         return ret_ref;
70340 }
70341
70342 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_offers"))) TS_ParsedOnionMessageContents_offers(uint64_t a) {
70343         void* a_ptr = untag_ptr(a);
70344         CHECK_ACCESS(a_ptr);
70345         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
70346         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
70347         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
70348         *ret_copy = ParsedOnionMessageContents_offers(a_conv);
70349         uint64_t ret_ref = tag_ptr(ret_copy, true);
70350         return ret_ref;
70351 }
70352
70353 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_custom"))) TS_ParsedOnionMessageContents_custom(uint64_t a) {
70354         void* a_ptr = untag_ptr(a);
70355         CHECK_ACCESS(a_ptr);
70356         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
70357         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
70358                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70359                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
70360         }
70361         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
70362         *ret_copy = ParsedOnionMessageContents_custom(a_conv);
70363         uint64_t ret_ref = tag_ptr(ret_copy, true);
70364         return ret_ref;
70365 }
70366
70367 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_as_OnionMessageContents"))) TS_ParsedOnionMessageContents_as_OnionMessageContents(uint64_t this_arg) {
70368         LDKParsedOnionMessageContents* this_arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(this_arg);
70369         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
70370         *ret_ret = ParsedOnionMessageContents_as_OnionMessageContents(this_arg_conv);
70371         return tag_ptr(ret_ret, true);
70372 }
70373
70374 int8_tArray  __attribute__((export_name("TS_ParsedOnionMessageContents_write"))) TS_ParsedOnionMessageContents_write(uint64_t obj) {
70375         LDKParsedOnionMessageContents* obj_conv = (LDKParsedOnionMessageContents*)untag_ptr(obj);
70376         LDKCVec_u8Z ret_var = ParsedOnionMessageContents_write(obj_conv);
70377         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70378         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70379         CVec_u8Z_free(ret_var);
70380         return ret_arr;
70381 }
70382
70383 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
70384         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
70385         *ret_ret = OnionMessageContents_clone(arg);
70386         return tag_ptr(ret_ret, true);
70387 }
70388 int64_t  __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
70389         void* arg_ptr = untag_ptr(arg);
70390         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
70391         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)arg_ptr;
70392         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
70393         return ret_conv;
70394 }
70395
70396 uint64_t  __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
70397         void* orig_ptr = untag_ptr(orig);
70398         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
70399         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)orig_ptr;
70400         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
70401         *ret_ret = OnionMessageContents_clone(orig_conv);
70402         return tag_ptr(ret_ret, true);
70403 }
70404
70405 void  __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
70406         if (!ptr_is_owned(this_ptr)) return;
70407         void* this_ptr_ptr = untag_ptr(this_ptr);
70408         CHECK_ACCESS(this_ptr_ptr);
70409         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
70410         FREE(untag_ptr(this_ptr));
70411         OnionMessageContents_free(this_ptr_conv);
70412 }
70413
70414 void  __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
70415         LDKBlindedPath this_obj_conv;
70416         this_obj_conv.inner = untag_ptr(this_obj);
70417         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70419         BlindedPath_free(this_obj_conv);
70420 }
70421
70422 int8_tArray  __attribute__((export_name("TS_BlindedPath_get_introduction_node_id"))) TS_BlindedPath_get_introduction_node_id(uint64_t this_ptr) {
70423         LDKBlindedPath this_ptr_conv;
70424         this_ptr_conv.inner = untag_ptr(this_ptr);
70425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70427         this_ptr_conv.is_owned = false;
70428         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70429         memcpy(ret_arr->elems, BlindedPath_get_introduction_node_id(&this_ptr_conv).compressed_form, 33);
70430         return ret_arr;
70431 }
70432
70433 void  __attribute__((export_name("TS_BlindedPath_set_introduction_node_id"))) TS_BlindedPath_set_introduction_node_id(uint64_t this_ptr, int8_tArray val) {
70434         LDKBlindedPath this_ptr_conv;
70435         this_ptr_conv.inner = untag_ptr(this_ptr);
70436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70438         this_ptr_conv.is_owned = false;
70439         LDKPublicKey val_ref;
70440         CHECK(val->arr_len == 33);
70441         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70442         BlindedPath_set_introduction_node_id(&this_ptr_conv, val_ref);
70443 }
70444
70445 int8_tArray  __attribute__((export_name("TS_BlindedPath_get_blinding_point"))) TS_BlindedPath_get_blinding_point(uint64_t this_ptr) {
70446         LDKBlindedPath this_ptr_conv;
70447         this_ptr_conv.inner = untag_ptr(this_ptr);
70448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70450         this_ptr_conv.is_owned = false;
70451         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70452         memcpy(ret_arr->elems, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form, 33);
70453         return ret_arr;
70454 }
70455
70456 void  __attribute__((export_name("TS_BlindedPath_set_blinding_point"))) TS_BlindedPath_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
70457         LDKBlindedPath this_ptr_conv;
70458         this_ptr_conv.inner = untag_ptr(this_ptr);
70459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70461         this_ptr_conv.is_owned = false;
70462         LDKPublicKey val_ref;
70463         CHECK(val->arr_len == 33);
70464         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70465         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
70466 }
70467
70468 uint64_tArray  __attribute__((export_name("TS_BlindedPath_get_blinded_hops"))) TS_BlindedPath_get_blinded_hops(uint64_t this_ptr) {
70469         LDKBlindedPath this_ptr_conv;
70470         this_ptr_conv.inner = untag_ptr(this_ptr);
70471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70473         this_ptr_conv.is_owned = false;
70474         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
70475         uint64_tArray ret_arr = NULL;
70476         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
70477         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
70478         for (size_t m = 0; m < ret_var.datalen; m++) {
70479                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
70480                 uint64_t ret_conv_12_ref = 0;
70481                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
70482                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
70483                 ret_arr_ptr[m] = ret_conv_12_ref;
70484         }
70485         
70486         FREE(ret_var.data);
70487         return ret_arr;
70488 }
70489
70490 void  __attribute__((export_name("TS_BlindedPath_set_blinded_hops"))) TS_BlindedPath_set_blinded_hops(uint64_t this_ptr, uint64_tArray val) {
70491         LDKBlindedPath this_ptr_conv;
70492         this_ptr_conv.inner = untag_ptr(this_ptr);
70493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70495         this_ptr_conv.is_owned = false;
70496         LDKCVec_BlindedHopZ val_constr;
70497         val_constr.datalen = val->arr_len;
70498         if (val_constr.datalen > 0)
70499                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
70500         else
70501                 val_constr.data = NULL;
70502         uint64_t* val_vals = val->elems;
70503         for (size_t m = 0; m < val_constr.datalen; m++) {
70504                 uint64_t val_conv_12 = val_vals[m];
70505                 LDKBlindedHop val_conv_12_conv;
70506                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
70507                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
70508                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
70509                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
70510                 val_constr.data[m] = val_conv_12_conv;
70511         }
70512         FREE(val);
70513         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
70514 }
70515
70516 uint64_t  __attribute__((export_name("TS_BlindedPath_new"))) TS_BlindedPath_new(int8_tArray introduction_node_id_arg, int8_tArray blinding_point_arg, uint64_tArray blinded_hops_arg) {
70517         LDKPublicKey introduction_node_id_arg_ref;
70518         CHECK(introduction_node_id_arg->arr_len == 33);
70519         memcpy(introduction_node_id_arg_ref.compressed_form, introduction_node_id_arg->elems, 33); FREE(introduction_node_id_arg);
70520         LDKPublicKey blinding_point_arg_ref;
70521         CHECK(blinding_point_arg->arr_len == 33);
70522         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
70523         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
70524         blinded_hops_arg_constr.datalen = blinded_hops_arg->arr_len;
70525         if (blinded_hops_arg_constr.datalen > 0)
70526                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
70527         else
70528                 blinded_hops_arg_constr.data = NULL;
70529         uint64_t* blinded_hops_arg_vals = blinded_hops_arg->elems;
70530         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
70531                 uint64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
70532                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
70533                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
70534                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
70535                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
70536                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
70537                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
70538         }
70539         FREE(blinded_hops_arg);
70540         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_id_arg_ref, blinding_point_arg_ref, blinded_hops_arg_constr);
70541         uint64_t ret_ref = 0;
70542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70544         return ret_ref;
70545 }
70546
70547 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
70548         LDKBlindedPath ret_var = BlindedPath_clone(arg);
70549         uint64_t ret_ref = 0;
70550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70552         return ret_ref;
70553 }
70554 int64_t  __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
70555         LDKBlindedPath arg_conv;
70556         arg_conv.inner = untag_ptr(arg);
70557         arg_conv.is_owned = ptr_is_owned(arg);
70558         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70559         arg_conv.is_owned = false;
70560         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
70561         return ret_conv;
70562 }
70563
70564 uint64_t  __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
70565         LDKBlindedPath orig_conv;
70566         orig_conv.inner = untag_ptr(orig);
70567         orig_conv.is_owned = ptr_is_owned(orig);
70568         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70569         orig_conv.is_owned = false;
70570         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
70571         uint64_t ret_ref = 0;
70572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70574         return ret_ref;
70575 }
70576
70577 int64_t  __attribute__((export_name("TS_BlindedPath_hash"))) TS_BlindedPath_hash(uint64_t o) {
70578         LDKBlindedPath o_conv;
70579         o_conv.inner = untag_ptr(o);
70580         o_conv.is_owned = ptr_is_owned(o);
70581         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70582         o_conv.is_owned = false;
70583         int64_t ret_conv = BlindedPath_hash(&o_conv);
70584         return ret_conv;
70585 }
70586
70587 jboolean  __attribute__((export_name("TS_BlindedPath_eq"))) TS_BlindedPath_eq(uint64_t a, uint64_t b) {
70588         LDKBlindedPath a_conv;
70589         a_conv.inner = untag_ptr(a);
70590         a_conv.is_owned = ptr_is_owned(a);
70591         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70592         a_conv.is_owned = false;
70593         LDKBlindedPath b_conv;
70594         b_conv.inner = untag_ptr(b);
70595         b_conv.is_owned = ptr_is_owned(b);
70596         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70597         b_conv.is_owned = false;
70598         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
70599         return ret_conv;
70600 }
70601
70602 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
70603         LDKBlindedHop this_obj_conv;
70604         this_obj_conv.inner = untag_ptr(this_obj);
70605         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70607         BlindedHop_free(this_obj_conv);
70608 }
70609
70610 int8_tArray  __attribute__((export_name("TS_BlindedHop_get_blinded_node_id"))) TS_BlindedHop_get_blinded_node_id(uint64_t this_ptr) {
70611         LDKBlindedHop this_ptr_conv;
70612         this_ptr_conv.inner = untag_ptr(this_ptr);
70613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70615         this_ptr_conv.is_owned = false;
70616         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70617         memcpy(ret_arr->elems, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form, 33);
70618         return ret_arr;
70619 }
70620
70621 void  __attribute__((export_name("TS_BlindedHop_set_blinded_node_id"))) TS_BlindedHop_set_blinded_node_id(uint64_t this_ptr, int8_tArray val) {
70622         LDKBlindedHop this_ptr_conv;
70623         this_ptr_conv.inner = untag_ptr(this_ptr);
70624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70626         this_ptr_conv.is_owned = false;
70627         LDKPublicKey val_ref;
70628         CHECK(val->arr_len == 33);
70629         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70630         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
70631 }
70632
70633 int8_tArray  __attribute__((export_name("TS_BlindedHop_get_encrypted_payload"))) TS_BlindedHop_get_encrypted_payload(uint64_t this_ptr) {
70634         LDKBlindedHop this_ptr_conv;
70635         this_ptr_conv.inner = untag_ptr(this_ptr);
70636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70638         this_ptr_conv.is_owned = false;
70639         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
70640         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70641         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70642         CVec_u8Z_free(ret_var);
70643         return ret_arr;
70644 }
70645
70646 void  __attribute__((export_name("TS_BlindedHop_set_encrypted_payload"))) TS_BlindedHop_set_encrypted_payload(uint64_t this_ptr, int8_tArray val) {
70647         LDKBlindedHop this_ptr_conv;
70648         this_ptr_conv.inner = untag_ptr(this_ptr);
70649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70651         this_ptr_conv.is_owned = false;
70652         LDKCVec_u8Z val_ref;
70653         val_ref.datalen = val->arr_len;
70654         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
70655         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
70656         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
70657 }
70658
70659 uint64_t  __attribute__((export_name("TS_BlindedHop_new"))) TS_BlindedHop_new(int8_tArray blinded_node_id_arg, int8_tArray encrypted_payload_arg) {
70660         LDKPublicKey blinded_node_id_arg_ref;
70661         CHECK(blinded_node_id_arg->arr_len == 33);
70662         memcpy(blinded_node_id_arg_ref.compressed_form, blinded_node_id_arg->elems, 33); FREE(blinded_node_id_arg);
70663         LDKCVec_u8Z encrypted_payload_arg_ref;
70664         encrypted_payload_arg_ref.datalen = encrypted_payload_arg->arr_len;
70665         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
70666         memcpy(encrypted_payload_arg_ref.data, encrypted_payload_arg->elems, encrypted_payload_arg_ref.datalen); FREE(encrypted_payload_arg);
70667         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
70668         uint64_t ret_ref = 0;
70669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70671         return ret_ref;
70672 }
70673
70674 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
70675         LDKBlindedHop ret_var = BlindedHop_clone(arg);
70676         uint64_t ret_ref = 0;
70677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70679         return ret_ref;
70680 }
70681 int64_t  __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
70682         LDKBlindedHop arg_conv;
70683         arg_conv.inner = untag_ptr(arg);
70684         arg_conv.is_owned = ptr_is_owned(arg);
70685         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70686         arg_conv.is_owned = false;
70687         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
70688         return ret_conv;
70689 }
70690
70691 uint64_t  __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
70692         LDKBlindedHop orig_conv;
70693         orig_conv.inner = untag_ptr(orig);
70694         orig_conv.is_owned = ptr_is_owned(orig);
70695         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70696         orig_conv.is_owned = false;
70697         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
70698         uint64_t ret_ref = 0;
70699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70701         return ret_ref;
70702 }
70703
70704 int64_t  __attribute__((export_name("TS_BlindedHop_hash"))) TS_BlindedHop_hash(uint64_t o) {
70705         LDKBlindedHop o_conv;
70706         o_conv.inner = untag_ptr(o);
70707         o_conv.is_owned = ptr_is_owned(o);
70708         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70709         o_conv.is_owned = false;
70710         int64_t ret_conv = BlindedHop_hash(&o_conv);
70711         return ret_conv;
70712 }
70713
70714 jboolean  __attribute__((export_name("TS_BlindedHop_eq"))) TS_BlindedHop_eq(uint64_t a, uint64_t b) {
70715         LDKBlindedHop a_conv;
70716         a_conv.inner = untag_ptr(a);
70717         a_conv.is_owned = ptr_is_owned(a);
70718         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70719         a_conv.is_owned = false;
70720         LDKBlindedHop b_conv;
70721         b_conv.inner = untag_ptr(b);
70722         b_conv.is_owned = ptr_is_owned(b);
70723         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70724         b_conv.is_owned = false;
70725         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
70726         return ret_conv;
70727 }
70728
70729 uint64_t  __attribute__((export_name("TS_BlindedPath_one_hop_for_message"))) TS_BlindedPath_one_hop_for_message(int8_tArray recipient_node_id, uint64_t entropy_source) {
70730         LDKPublicKey recipient_node_id_ref;
70731         CHECK(recipient_node_id->arr_len == 33);
70732         memcpy(recipient_node_id_ref.compressed_form, recipient_node_id->elems, 33); FREE(recipient_node_id);
70733         void* entropy_source_ptr = untag_ptr(entropy_source);
70734         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
70735         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
70736         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
70737         *ret_conv = BlindedPath_one_hop_for_message(recipient_node_id_ref, entropy_source_conv);
70738         return tag_ptr(ret_conv, true);
70739 }
70740
70741 uint64_t  __attribute__((export_name("TS_BlindedPath_new_for_message"))) TS_BlindedPath_new_for_message(ptrArray node_pks, uint64_t entropy_source) {
70742         LDKCVec_PublicKeyZ node_pks_constr;
70743         node_pks_constr.datalen = node_pks->arr_len;
70744         if (node_pks_constr.datalen > 0)
70745                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
70746         else
70747                 node_pks_constr.data = NULL;
70748         int8_tArray* node_pks_vals = (void*) node_pks->elems;
70749         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
70750                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
70751                 LDKPublicKey node_pks_conv_12_ref;
70752                 CHECK(node_pks_conv_12->arr_len == 33);
70753                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
70754                 node_pks_constr.data[m] = node_pks_conv_12_ref;
70755         }
70756         FREE(node_pks);
70757         void* entropy_source_ptr = untag_ptr(entropy_source);
70758         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
70759         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
70760         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
70761         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
70762         return tag_ptr(ret_conv, true);
70763 }
70764
70765 uint64_t  __attribute__((export_name("TS_BlindedPath_one_hop_for_payment"))) TS_BlindedPath_one_hop_for_payment(int8_tArray payee_node_id, uint64_t payee_tlvs, uint64_t entropy_source) {
70766         LDKPublicKey payee_node_id_ref;
70767         CHECK(payee_node_id->arr_len == 33);
70768         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
70769         LDKReceiveTlvs payee_tlvs_conv;
70770         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
70771         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
70772         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
70773         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
70774         void* entropy_source_ptr = untag_ptr(entropy_source);
70775         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
70776         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
70777         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
70778         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, entropy_source_conv);
70779         return tag_ptr(ret_conv, true);
70780 }
70781
70782 uint64_t  __attribute__((export_name("TS_BlindedPath_new_for_payment"))) TS_BlindedPath_new_for_payment(uint64_tArray intermediate_nodes, int8_tArray payee_node_id, uint64_t payee_tlvs, int64_t htlc_maximum_msat, uint64_t entropy_source) {
70783         LDKCVec_ForwardNodeZ intermediate_nodes_constr;
70784         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
70785         if (intermediate_nodes_constr.datalen > 0)
70786                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
70787         else
70788                 intermediate_nodes_constr.data = NULL;
70789         uint64_t* intermediate_nodes_vals = intermediate_nodes->elems;
70790         for (size_t n = 0; n < intermediate_nodes_constr.datalen; n++) {
70791                 uint64_t intermediate_nodes_conv_13 = intermediate_nodes_vals[n];
70792                 LDKForwardNode intermediate_nodes_conv_13_conv;
70793                 intermediate_nodes_conv_13_conv.inner = untag_ptr(intermediate_nodes_conv_13);
70794                 intermediate_nodes_conv_13_conv.is_owned = ptr_is_owned(intermediate_nodes_conv_13);
70795                 CHECK_INNER_FIELD_ACCESS_OR_NULL(intermediate_nodes_conv_13_conv);
70796                 intermediate_nodes_conv_13_conv = ForwardNode_clone(&intermediate_nodes_conv_13_conv);
70797                 intermediate_nodes_constr.data[n] = intermediate_nodes_conv_13_conv;
70798         }
70799         FREE(intermediate_nodes);
70800         LDKPublicKey payee_node_id_ref;
70801         CHECK(payee_node_id->arr_len == 33);
70802         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
70803         LDKReceiveTlvs payee_tlvs_conv;
70804         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
70805         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
70806         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
70807         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
70808         void* entropy_source_ptr = untag_ptr(entropy_source);
70809         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
70810         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
70811         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
70812         *ret_conv = BlindedPath_new_for_payment(intermediate_nodes_constr, payee_node_id_ref, payee_tlvs_conv, htlc_maximum_msat, entropy_source_conv);
70813         return tag_ptr(ret_conv, true);
70814 }
70815
70816 int8_tArray  __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
70817         LDKBlindedPath obj_conv;
70818         obj_conv.inner = untag_ptr(obj);
70819         obj_conv.is_owned = ptr_is_owned(obj);
70820         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70821         obj_conv.is_owned = false;
70822         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
70823         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70824         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70825         CVec_u8Z_free(ret_var);
70826         return ret_arr;
70827 }
70828
70829 uint64_t  __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
70830         LDKu8slice ser_ref;
70831         ser_ref.datalen = ser->arr_len;
70832         ser_ref.data = ser->elems;
70833         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
70834         *ret_conv = BlindedPath_read(ser_ref);
70835         FREE(ser);
70836         return tag_ptr(ret_conv, true);
70837 }
70838
70839 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
70840         LDKBlindedHop obj_conv;
70841         obj_conv.inner = untag_ptr(obj);
70842         obj_conv.is_owned = ptr_is_owned(obj);
70843         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70844         obj_conv.is_owned = false;
70845         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
70846         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70847         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70848         CVec_u8Z_free(ret_var);
70849         return ret_arr;
70850 }
70851
70852 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
70853         LDKu8slice ser_ref;
70854         ser_ref.datalen = ser->arr_len;
70855         ser_ref.data = ser->elems;
70856         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
70857         *ret_conv = BlindedHop_read(ser_ref);
70858         FREE(ser);
70859         return tag_ptr(ret_conv, true);
70860 }
70861
70862 void  __attribute__((export_name("TS_ForwardNode_free"))) TS_ForwardNode_free(uint64_t this_obj) {
70863         LDKForwardNode this_obj_conv;
70864         this_obj_conv.inner = untag_ptr(this_obj);
70865         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70867         ForwardNode_free(this_obj_conv);
70868 }
70869
70870 uint64_t  __attribute__((export_name("TS_ForwardNode_get_tlvs"))) TS_ForwardNode_get_tlvs(uint64_t this_ptr) {
70871         LDKForwardNode this_ptr_conv;
70872         this_ptr_conv.inner = untag_ptr(this_ptr);
70873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70875         this_ptr_conv.is_owned = false;
70876         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
70877         uint64_t ret_ref = 0;
70878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70880         return ret_ref;
70881 }
70882
70883 void  __attribute__((export_name("TS_ForwardNode_set_tlvs"))) TS_ForwardNode_set_tlvs(uint64_t this_ptr, uint64_t val) {
70884         LDKForwardNode this_ptr_conv;
70885         this_ptr_conv.inner = untag_ptr(this_ptr);
70886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70888         this_ptr_conv.is_owned = false;
70889         LDKForwardTlvs val_conv;
70890         val_conv.inner = untag_ptr(val);
70891         val_conv.is_owned = ptr_is_owned(val);
70892         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70893         val_conv = ForwardTlvs_clone(&val_conv);
70894         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
70895 }
70896
70897 int8_tArray  __attribute__((export_name("TS_ForwardNode_get_node_id"))) TS_ForwardNode_get_node_id(uint64_t this_ptr) {
70898         LDKForwardNode this_ptr_conv;
70899         this_ptr_conv.inner = untag_ptr(this_ptr);
70900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70902         this_ptr_conv.is_owned = false;
70903         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70904         memcpy(ret_arr->elems, ForwardNode_get_node_id(&this_ptr_conv).compressed_form, 33);
70905         return ret_arr;
70906 }
70907
70908 void  __attribute__((export_name("TS_ForwardNode_set_node_id"))) TS_ForwardNode_set_node_id(uint64_t this_ptr, int8_tArray val) {
70909         LDKForwardNode this_ptr_conv;
70910         this_ptr_conv.inner = untag_ptr(this_ptr);
70911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70913         this_ptr_conv.is_owned = false;
70914         LDKPublicKey val_ref;
70915         CHECK(val->arr_len == 33);
70916         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70917         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
70918 }
70919
70920 int64_t  __attribute__((export_name("TS_ForwardNode_get_htlc_maximum_msat"))) TS_ForwardNode_get_htlc_maximum_msat(uint64_t this_ptr) {
70921         LDKForwardNode this_ptr_conv;
70922         this_ptr_conv.inner = untag_ptr(this_ptr);
70923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70925         this_ptr_conv.is_owned = false;
70926         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
70927         return ret_conv;
70928 }
70929
70930 void  __attribute__((export_name("TS_ForwardNode_set_htlc_maximum_msat"))) TS_ForwardNode_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
70931         LDKForwardNode this_ptr_conv;
70932         this_ptr_conv.inner = untag_ptr(this_ptr);
70933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70935         this_ptr_conv.is_owned = false;
70936         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
70937 }
70938
70939 uint64_t  __attribute__((export_name("TS_ForwardNode_new"))) TS_ForwardNode_new(uint64_t tlvs_arg, int8_tArray node_id_arg, int64_t htlc_maximum_msat_arg) {
70940         LDKForwardTlvs tlvs_arg_conv;
70941         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
70942         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
70943         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
70944         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
70945         LDKPublicKey node_id_arg_ref;
70946         CHECK(node_id_arg->arr_len == 33);
70947         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
70948         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
70949         uint64_t ret_ref = 0;
70950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70952         return ret_ref;
70953 }
70954
70955 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
70956         LDKForwardNode ret_var = ForwardNode_clone(arg);
70957         uint64_t ret_ref = 0;
70958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70960         return ret_ref;
70961 }
70962 int64_t  __attribute__((export_name("TS_ForwardNode_clone_ptr"))) TS_ForwardNode_clone_ptr(uint64_t arg) {
70963         LDKForwardNode arg_conv;
70964         arg_conv.inner = untag_ptr(arg);
70965         arg_conv.is_owned = ptr_is_owned(arg);
70966         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70967         arg_conv.is_owned = false;
70968         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
70969         return ret_conv;
70970 }
70971
70972 uint64_t  __attribute__((export_name("TS_ForwardNode_clone"))) TS_ForwardNode_clone(uint64_t orig) {
70973         LDKForwardNode orig_conv;
70974         orig_conv.inner = untag_ptr(orig);
70975         orig_conv.is_owned = ptr_is_owned(orig);
70976         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70977         orig_conv.is_owned = false;
70978         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
70979         uint64_t ret_ref = 0;
70980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70982         return ret_ref;
70983 }
70984
70985 void  __attribute__((export_name("TS_ForwardTlvs_free"))) TS_ForwardTlvs_free(uint64_t this_obj) {
70986         LDKForwardTlvs this_obj_conv;
70987         this_obj_conv.inner = untag_ptr(this_obj);
70988         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70990         ForwardTlvs_free(this_obj_conv);
70991 }
70992
70993 int64_t  __attribute__((export_name("TS_ForwardTlvs_get_short_channel_id"))) TS_ForwardTlvs_get_short_channel_id(uint64_t this_ptr) {
70994         LDKForwardTlvs this_ptr_conv;
70995         this_ptr_conv.inner = untag_ptr(this_ptr);
70996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70998         this_ptr_conv.is_owned = false;
70999         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
71000         return ret_conv;
71001 }
71002
71003 void  __attribute__((export_name("TS_ForwardTlvs_set_short_channel_id"))) TS_ForwardTlvs_set_short_channel_id(uint64_t this_ptr, int64_t val) {
71004         LDKForwardTlvs this_ptr_conv;
71005         this_ptr_conv.inner = untag_ptr(this_ptr);
71006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71008         this_ptr_conv.is_owned = false;
71009         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
71010 }
71011
71012 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_payment_relay"))) TS_ForwardTlvs_get_payment_relay(uint64_t this_ptr) {
71013         LDKForwardTlvs this_ptr_conv;
71014         this_ptr_conv.inner = untag_ptr(this_ptr);
71015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71017         this_ptr_conv.is_owned = false;
71018         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
71019         uint64_t ret_ref = 0;
71020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71022         return ret_ref;
71023 }
71024
71025 void  __attribute__((export_name("TS_ForwardTlvs_set_payment_relay"))) TS_ForwardTlvs_set_payment_relay(uint64_t this_ptr, uint64_t val) {
71026         LDKForwardTlvs this_ptr_conv;
71027         this_ptr_conv.inner = untag_ptr(this_ptr);
71028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71030         this_ptr_conv.is_owned = false;
71031         LDKPaymentRelay val_conv;
71032         val_conv.inner = untag_ptr(val);
71033         val_conv.is_owned = ptr_is_owned(val);
71034         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71035         val_conv = PaymentRelay_clone(&val_conv);
71036         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
71037 }
71038
71039 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_payment_constraints"))) TS_ForwardTlvs_get_payment_constraints(uint64_t this_ptr) {
71040         LDKForwardTlvs this_ptr_conv;
71041         this_ptr_conv.inner = untag_ptr(this_ptr);
71042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71044         this_ptr_conv.is_owned = false;
71045         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
71046         uint64_t ret_ref = 0;
71047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71049         return ret_ref;
71050 }
71051
71052 void  __attribute__((export_name("TS_ForwardTlvs_set_payment_constraints"))) TS_ForwardTlvs_set_payment_constraints(uint64_t this_ptr, uint64_t val) {
71053         LDKForwardTlvs this_ptr_conv;
71054         this_ptr_conv.inner = untag_ptr(this_ptr);
71055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71057         this_ptr_conv.is_owned = false;
71058         LDKPaymentConstraints val_conv;
71059         val_conv.inner = untag_ptr(val);
71060         val_conv.is_owned = ptr_is_owned(val);
71061         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71062         val_conv = PaymentConstraints_clone(&val_conv);
71063         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
71064 }
71065
71066 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_features"))) TS_ForwardTlvs_get_features(uint64_t this_ptr) {
71067         LDKForwardTlvs this_ptr_conv;
71068         this_ptr_conv.inner = untag_ptr(this_ptr);
71069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71071         this_ptr_conv.is_owned = false;
71072         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
71073         uint64_t ret_ref = 0;
71074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71076         return ret_ref;
71077 }
71078
71079 void  __attribute__((export_name("TS_ForwardTlvs_set_features"))) TS_ForwardTlvs_set_features(uint64_t this_ptr, uint64_t val) {
71080         LDKForwardTlvs this_ptr_conv;
71081         this_ptr_conv.inner = untag_ptr(this_ptr);
71082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71084         this_ptr_conv.is_owned = false;
71085         LDKBlindedHopFeatures val_conv;
71086         val_conv.inner = untag_ptr(val);
71087         val_conv.is_owned = ptr_is_owned(val);
71088         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71089         val_conv = BlindedHopFeatures_clone(&val_conv);
71090         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
71091 }
71092
71093 uint64_t  __attribute__((export_name("TS_ForwardTlvs_new"))) TS_ForwardTlvs_new(int64_t short_channel_id_arg, uint64_t payment_relay_arg, uint64_t payment_constraints_arg, uint64_t features_arg) {
71094         LDKPaymentRelay payment_relay_arg_conv;
71095         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
71096         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
71097         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
71098         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
71099         LDKPaymentConstraints payment_constraints_arg_conv;
71100         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
71101         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
71102         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
71103         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
71104         LDKBlindedHopFeatures features_arg_conv;
71105         features_arg_conv.inner = untag_ptr(features_arg);
71106         features_arg_conv.is_owned = ptr_is_owned(features_arg);
71107         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
71108         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
71109         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
71110         uint64_t ret_ref = 0;
71111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71113         return ret_ref;
71114 }
71115
71116 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
71117         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
71118         uint64_t ret_ref = 0;
71119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71121         return ret_ref;
71122 }
71123 int64_t  __attribute__((export_name("TS_ForwardTlvs_clone_ptr"))) TS_ForwardTlvs_clone_ptr(uint64_t arg) {
71124         LDKForwardTlvs arg_conv;
71125         arg_conv.inner = untag_ptr(arg);
71126         arg_conv.is_owned = ptr_is_owned(arg);
71127         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71128         arg_conv.is_owned = false;
71129         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
71130         return ret_conv;
71131 }
71132
71133 uint64_t  __attribute__((export_name("TS_ForwardTlvs_clone"))) TS_ForwardTlvs_clone(uint64_t orig) {
71134         LDKForwardTlvs orig_conv;
71135         orig_conv.inner = untag_ptr(orig);
71136         orig_conv.is_owned = ptr_is_owned(orig);
71137         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71138         orig_conv.is_owned = false;
71139         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
71140         uint64_t ret_ref = 0;
71141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71143         return ret_ref;
71144 }
71145
71146 void  __attribute__((export_name("TS_ReceiveTlvs_free"))) TS_ReceiveTlvs_free(uint64_t this_obj) {
71147         LDKReceiveTlvs this_obj_conv;
71148         this_obj_conv.inner = untag_ptr(this_obj);
71149         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71151         ReceiveTlvs_free(this_obj_conv);
71152 }
71153
71154 int8_tArray  __attribute__((export_name("TS_ReceiveTlvs_get_payment_secret"))) TS_ReceiveTlvs_get_payment_secret(uint64_t this_ptr) {
71155         LDKReceiveTlvs this_ptr_conv;
71156         this_ptr_conv.inner = untag_ptr(this_ptr);
71157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71159         this_ptr_conv.is_owned = false;
71160         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
71161         memcpy(ret_arr->elems, *ReceiveTlvs_get_payment_secret(&this_ptr_conv), 32);
71162         return ret_arr;
71163 }
71164
71165 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_secret"))) TS_ReceiveTlvs_set_payment_secret(uint64_t this_ptr, int8_tArray val) {
71166         LDKReceiveTlvs this_ptr_conv;
71167         this_ptr_conv.inner = untag_ptr(this_ptr);
71168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71170         this_ptr_conv.is_owned = false;
71171         LDKThirtyTwoBytes val_ref;
71172         CHECK(val->arr_len == 32);
71173         memcpy(val_ref.data, val->elems, 32); FREE(val);
71174         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
71175 }
71176
71177 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_get_payment_constraints"))) TS_ReceiveTlvs_get_payment_constraints(uint64_t this_ptr) {
71178         LDKReceiveTlvs this_ptr_conv;
71179         this_ptr_conv.inner = untag_ptr(this_ptr);
71180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71182         this_ptr_conv.is_owned = false;
71183         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
71184         uint64_t ret_ref = 0;
71185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71187         return ret_ref;
71188 }
71189
71190 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_constraints"))) TS_ReceiveTlvs_set_payment_constraints(uint64_t this_ptr, uint64_t val) {
71191         LDKReceiveTlvs this_ptr_conv;
71192         this_ptr_conv.inner = untag_ptr(this_ptr);
71193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71195         this_ptr_conv.is_owned = false;
71196         LDKPaymentConstraints val_conv;
71197         val_conv.inner = untag_ptr(val);
71198         val_conv.is_owned = ptr_is_owned(val);
71199         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71200         val_conv = PaymentConstraints_clone(&val_conv);
71201         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
71202 }
71203
71204 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_new"))) TS_ReceiveTlvs_new(int8_tArray payment_secret_arg, uint64_t payment_constraints_arg) {
71205         LDKThirtyTwoBytes payment_secret_arg_ref;
71206         CHECK(payment_secret_arg->arr_len == 32);
71207         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
71208         LDKPaymentConstraints payment_constraints_arg_conv;
71209         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
71210         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
71211         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
71212         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
71213         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv);
71214         uint64_t ret_ref = 0;
71215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71217         return ret_ref;
71218 }
71219
71220 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
71221         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
71222         uint64_t ret_ref = 0;
71223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71225         return ret_ref;
71226 }
71227 int64_t  __attribute__((export_name("TS_ReceiveTlvs_clone_ptr"))) TS_ReceiveTlvs_clone_ptr(uint64_t arg) {
71228         LDKReceiveTlvs arg_conv;
71229         arg_conv.inner = untag_ptr(arg);
71230         arg_conv.is_owned = ptr_is_owned(arg);
71231         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71232         arg_conv.is_owned = false;
71233         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
71234         return ret_conv;
71235 }
71236
71237 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_clone"))) TS_ReceiveTlvs_clone(uint64_t orig) {
71238         LDKReceiveTlvs orig_conv;
71239         orig_conv.inner = untag_ptr(orig);
71240         orig_conv.is_owned = ptr_is_owned(orig);
71241         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71242         orig_conv.is_owned = false;
71243         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
71244         uint64_t ret_ref = 0;
71245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71247         return ret_ref;
71248 }
71249
71250 void  __attribute__((export_name("TS_PaymentRelay_free"))) TS_PaymentRelay_free(uint64_t this_obj) {
71251         LDKPaymentRelay this_obj_conv;
71252         this_obj_conv.inner = untag_ptr(this_obj);
71253         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71255         PaymentRelay_free(this_obj_conv);
71256 }
71257
71258 int16_t  __attribute__((export_name("TS_PaymentRelay_get_cltv_expiry_delta"))) TS_PaymentRelay_get_cltv_expiry_delta(uint64_t this_ptr) {
71259         LDKPaymentRelay this_ptr_conv;
71260         this_ptr_conv.inner = untag_ptr(this_ptr);
71261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71263         this_ptr_conv.is_owned = false;
71264         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
71265         return ret_conv;
71266 }
71267
71268 void  __attribute__((export_name("TS_PaymentRelay_set_cltv_expiry_delta"))) TS_PaymentRelay_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
71269         LDKPaymentRelay this_ptr_conv;
71270         this_ptr_conv.inner = untag_ptr(this_ptr);
71271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71273         this_ptr_conv.is_owned = false;
71274         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
71275 }
71276
71277 int32_t  __attribute__((export_name("TS_PaymentRelay_get_fee_proportional_millionths"))) TS_PaymentRelay_get_fee_proportional_millionths(uint64_t this_ptr) {
71278         LDKPaymentRelay this_ptr_conv;
71279         this_ptr_conv.inner = untag_ptr(this_ptr);
71280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71282         this_ptr_conv.is_owned = false;
71283         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
71284         return ret_conv;
71285 }
71286
71287 void  __attribute__((export_name("TS_PaymentRelay_set_fee_proportional_millionths"))) TS_PaymentRelay_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
71288         LDKPaymentRelay this_ptr_conv;
71289         this_ptr_conv.inner = untag_ptr(this_ptr);
71290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71292         this_ptr_conv.is_owned = false;
71293         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
71294 }
71295
71296 int32_t  __attribute__((export_name("TS_PaymentRelay_get_fee_base_msat"))) TS_PaymentRelay_get_fee_base_msat(uint64_t this_ptr) {
71297         LDKPaymentRelay this_ptr_conv;
71298         this_ptr_conv.inner = untag_ptr(this_ptr);
71299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71301         this_ptr_conv.is_owned = false;
71302         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
71303         return ret_conv;
71304 }
71305
71306 void  __attribute__((export_name("TS_PaymentRelay_set_fee_base_msat"))) TS_PaymentRelay_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
71307         LDKPaymentRelay this_ptr_conv;
71308         this_ptr_conv.inner = untag_ptr(this_ptr);
71309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71311         this_ptr_conv.is_owned = false;
71312         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
71313 }
71314
71315 uint64_t  __attribute__((export_name("TS_PaymentRelay_new"))) TS_PaymentRelay_new(int16_t cltv_expiry_delta_arg, int32_t fee_proportional_millionths_arg, int32_t fee_base_msat_arg) {
71316         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
71317         uint64_t ret_ref = 0;
71318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71320         return ret_ref;
71321 }
71322
71323 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
71324         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
71325         uint64_t ret_ref = 0;
71326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71328         return ret_ref;
71329 }
71330 int64_t  __attribute__((export_name("TS_PaymentRelay_clone_ptr"))) TS_PaymentRelay_clone_ptr(uint64_t arg) {
71331         LDKPaymentRelay arg_conv;
71332         arg_conv.inner = untag_ptr(arg);
71333         arg_conv.is_owned = ptr_is_owned(arg);
71334         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71335         arg_conv.is_owned = false;
71336         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
71337         return ret_conv;
71338 }
71339
71340 uint64_t  __attribute__((export_name("TS_PaymentRelay_clone"))) TS_PaymentRelay_clone(uint64_t orig) {
71341         LDKPaymentRelay orig_conv;
71342         orig_conv.inner = untag_ptr(orig);
71343         orig_conv.is_owned = ptr_is_owned(orig);
71344         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71345         orig_conv.is_owned = false;
71346         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
71347         uint64_t ret_ref = 0;
71348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71350         return ret_ref;
71351 }
71352
71353 void  __attribute__((export_name("TS_PaymentConstraints_free"))) TS_PaymentConstraints_free(uint64_t this_obj) {
71354         LDKPaymentConstraints this_obj_conv;
71355         this_obj_conv.inner = untag_ptr(this_obj);
71356         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71358         PaymentConstraints_free(this_obj_conv);
71359 }
71360
71361 int32_t  __attribute__((export_name("TS_PaymentConstraints_get_max_cltv_expiry"))) TS_PaymentConstraints_get_max_cltv_expiry(uint64_t this_ptr) {
71362         LDKPaymentConstraints this_ptr_conv;
71363         this_ptr_conv.inner = untag_ptr(this_ptr);
71364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71366         this_ptr_conv.is_owned = false;
71367         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
71368         return ret_conv;
71369 }
71370
71371 void  __attribute__((export_name("TS_PaymentConstraints_set_max_cltv_expiry"))) TS_PaymentConstraints_set_max_cltv_expiry(uint64_t this_ptr, int32_t val) {
71372         LDKPaymentConstraints this_ptr_conv;
71373         this_ptr_conv.inner = untag_ptr(this_ptr);
71374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71376         this_ptr_conv.is_owned = false;
71377         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
71378 }
71379
71380 int64_t  __attribute__((export_name("TS_PaymentConstraints_get_htlc_minimum_msat"))) TS_PaymentConstraints_get_htlc_minimum_msat(uint64_t this_ptr) {
71381         LDKPaymentConstraints this_ptr_conv;
71382         this_ptr_conv.inner = untag_ptr(this_ptr);
71383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71385         this_ptr_conv.is_owned = false;
71386         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
71387         return ret_conv;
71388 }
71389
71390 void  __attribute__((export_name("TS_PaymentConstraints_set_htlc_minimum_msat"))) TS_PaymentConstraints_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
71391         LDKPaymentConstraints this_ptr_conv;
71392         this_ptr_conv.inner = untag_ptr(this_ptr);
71393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71395         this_ptr_conv.is_owned = false;
71396         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
71397 }
71398
71399 uint64_t  __attribute__((export_name("TS_PaymentConstraints_new"))) TS_PaymentConstraints_new(int32_t max_cltv_expiry_arg, int64_t htlc_minimum_msat_arg) {
71400         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
71401         uint64_t ret_ref = 0;
71402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71404         return ret_ref;
71405 }
71406
71407 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
71408         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
71409         uint64_t ret_ref = 0;
71410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71412         return ret_ref;
71413 }
71414 int64_t  __attribute__((export_name("TS_PaymentConstraints_clone_ptr"))) TS_PaymentConstraints_clone_ptr(uint64_t arg) {
71415         LDKPaymentConstraints arg_conv;
71416         arg_conv.inner = untag_ptr(arg);
71417         arg_conv.is_owned = ptr_is_owned(arg);
71418         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71419         arg_conv.is_owned = false;
71420         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
71421         return ret_conv;
71422 }
71423
71424 uint64_t  __attribute__((export_name("TS_PaymentConstraints_clone"))) TS_PaymentConstraints_clone(uint64_t orig) {
71425         LDKPaymentConstraints orig_conv;
71426         orig_conv.inner = untag_ptr(orig);
71427         orig_conv.is_owned = ptr_is_owned(orig);
71428         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71429         orig_conv.is_owned = false;
71430         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
71431         uint64_t ret_ref = 0;
71432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71434         return ret_ref;
71435 }
71436
71437 int8_tArray  __attribute__((export_name("TS_ForwardTlvs_write"))) TS_ForwardTlvs_write(uint64_t obj) {
71438         LDKForwardTlvs obj_conv;
71439         obj_conv.inner = untag_ptr(obj);
71440         obj_conv.is_owned = ptr_is_owned(obj);
71441         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71442         obj_conv.is_owned = false;
71443         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
71444         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71445         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71446         CVec_u8Z_free(ret_var);
71447         return ret_arr;
71448 }
71449
71450 int8_tArray  __attribute__((export_name("TS_ReceiveTlvs_write"))) TS_ReceiveTlvs_write(uint64_t obj) {
71451         LDKReceiveTlvs obj_conv;
71452         obj_conv.inner = untag_ptr(obj);
71453         obj_conv.is_owned = ptr_is_owned(obj);
71454         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71455         obj_conv.is_owned = false;
71456         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
71457         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71458         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71459         CVec_u8Z_free(ret_var);
71460         return ret_arr;
71461 }
71462
71463 int8_tArray  __attribute__((export_name("TS_PaymentRelay_write"))) TS_PaymentRelay_write(uint64_t obj) {
71464         LDKPaymentRelay obj_conv;
71465         obj_conv.inner = untag_ptr(obj);
71466         obj_conv.is_owned = ptr_is_owned(obj);
71467         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71468         obj_conv.is_owned = false;
71469         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
71470         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71471         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71472         CVec_u8Z_free(ret_var);
71473         return ret_arr;
71474 }
71475
71476 uint64_t  __attribute__((export_name("TS_PaymentRelay_read"))) TS_PaymentRelay_read(int8_tArray ser) {
71477         LDKu8slice ser_ref;
71478         ser_ref.datalen = ser->arr_len;
71479         ser_ref.data = ser->elems;
71480         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
71481         *ret_conv = PaymentRelay_read(ser_ref);
71482         FREE(ser);
71483         return tag_ptr(ret_conv, true);
71484 }
71485
71486 int8_tArray  __attribute__((export_name("TS_PaymentConstraints_write"))) TS_PaymentConstraints_write(uint64_t obj) {
71487         LDKPaymentConstraints obj_conv;
71488         obj_conv.inner = untag_ptr(obj);
71489         obj_conv.is_owned = ptr_is_owned(obj);
71490         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71491         obj_conv.is_owned = false;
71492         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
71493         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71494         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71495         CVec_u8Z_free(ret_var);
71496         return ret_arr;
71497 }
71498
71499 uint64_t  __attribute__((export_name("TS_PaymentConstraints_read"))) TS_PaymentConstraints_read(int8_tArray ser) {
71500         LDKu8slice ser_ref;
71501         ser_ref.datalen = ser->arr_len;
71502         ser_ref.data = ser->elems;
71503         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
71504         *ret_conv = PaymentConstraints_read(ser_ref);
71505         FREE(ser);
71506         return tag_ptr(ret_conv, true);
71507 }
71508
71509 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
71510         if (!ptr_is_owned(this_ptr)) return;
71511         void* this_ptr_ptr = untag_ptr(this_ptr);
71512         CHECK_ACCESS(this_ptr_ptr);
71513         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
71514         FREE(untag_ptr(this_ptr));
71515         PaymentPurpose_free(this_ptr_conv);
71516 }
71517
71518 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
71519         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
71520         *ret_copy = PaymentPurpose_clone(arg);
71521         uint64_t ret_ref = tag_ptr(ret_copy, true);
71522         return ret_ref;
71523 }
71524 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
71525         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
71526         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
71527         return ret_conv;
71528 }
71529
71530 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
71531         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
71532         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
71533         *ret_copy = PaymentPurpose_clone(orig_conv);
71534         uint64_t ret_ref = tag_ptr(ret_copy, true);
71535         return ret_ref;
71536 }
71537
71538 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(uint64_t payment_preimage, int8_tArray payment_secret) {
71539         void* payment_preimage_ptr = untag_ptr(payment_preimage);
71540         CHECK_ACCESS(payment_preimage_ptr);
71541         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
71542         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
71543         LDKThirtyTwoBytes payment_secret_ref;
71544         CHECK(payment_secret->arr_len == 32);
71545         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
71546         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
71547         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_conv, payment_secret_ref);
71548         uint64_t ret_ref = tag_ptr(ret_copy, true);
71549         return ret_ref;
71550 }
71551
71552 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
71553         LDKThirtyTwoBytes a_ref;
71554         CHECK(a->arr_len == 32);
71555         memcpy(a_ref.data, a->elems, 32); FREE(a);
71556         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
71557         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
71558         uint64_t ret_ref = tag_ptr(ret_copy, true);
71559         return ret_ref;
71560 }
71561
71562 jboolean  __attribute__((export_name("TS_PaymentPurpose_eq"))) TS_PaymentPurpose_eq(uint64_t a, uint64_t b) {
71563         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
71564         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
71565         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
71566         return ret_conv;
71567 }
71568
71569 uint64_t  __attribute__((export_name("TS_PaymentPurpose_preimage"))) TS_PaymentPurpose_preimage(uint64_t this_arg) {
71570         LDKPaymentPurpose* this_arg_conv = (LDKPaymentPurpose*)untag_ptr(this_arg);
71571         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
71572         *ret_copy = PaymentPurpose_preimage(this_arg_conv);
71573         uint64_t ret_ref = tag_ptr(ret_copy, true);
71574         return ret_ref;
71575 }
71576
71577 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
71578         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
71579         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
71580         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71581         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71582         CVec_u8Z_free(ret_var);
71583         return ret_arr;
71584 }
71585
71586 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
71587         LDKu8slice ser_ref;
71588         ser_ref.datalen = ser->arr_len;
71589         ser_ref.data = ser->elems;
71590         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
71591         *ret_conv = PaymentPurpose_read(ser_ref);
71592         FREE(ser);
71593         return tag_ptr(ret_conv, true);
71594 }
71595
71596 void  __attribute__((export_name("TS_ClaimedHTLC_free"))) TS_ClaimedHTLC_free(uint64_t this_obj) {
71597         LDKClaimedHTLC this_obj_conv;
71598         this_obj_conv.inner = untag_ptr(this_obj);
71599         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71601         ClaimedHTLC_free(this_obj_conv);
71602 }
71603
71604 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_get_channel_id"))) TS_ClaimedHTLC_get_channel_id(uint64_t this_ptr) {
71605         LDKClaimedHTLC this_ptr_conv;
71606         this_ptr_conv.inner = untag_ptr(this_ptr);
71607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71609         this_ptr_conv.is_owned = false;
71610         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
71611         memcpy(ret_arr->elems, *ClaimedHTLC_get_channel_id(&this_ptr_conv), 32);
71612         return ret_arr;
71613 }
71614
71615 void  __attribute__((export_name("TS_ClaimedHTLC_set_channel_id"))) TS_ClaimedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
71616         LDKClaimedHTLC this_ptr_conv;
71617         this_ptr_conv.inner = untag_ptr(this_ptr);
71618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71620         this_ptr_conv.is_owned = false;
71621         LDKThirtyTwoBytes val_ref;
71622         CHECK(val->arr_len == 32);
71623         memcpy(val_ref.data, val->elems, 32); FREE(val);
71624         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_ref);
71625 }
71626
71627 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_get_user_channel_id"))) TS_ClaimedHTLC_get_user_channel_id(uint64_t this_ptr) {
71628         LDKClaimedHTLC this_ptr_conv;
71629         this_ptr_conv.inner = untag_ptr(this_ptr);
71630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71632         this_ptr_conv.is_owned = false;
71633         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
71634         memcpy(ret_arr->elems, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
71635         return ret_arr;
71636 }
71637
71638 void  __attribute__((export_name("TS_ClaimedHTLC_set_user_channel_id"))) TS_ClaimedHTLC_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
71639         LDKClaimedHTLC this_ptr_conv;
71640         this_ptr_conv.inner = untag_ptr(this_ptr);
71641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71643         this_ptr_conv.is_owned = false;
71644         LDKU128 val_ref;
71645         CHECK(val->arr_len == 16);
71646         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
71647         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
71648 }
71649
71650 int32_t  __attribute__((export_name("TS_ClaimedHTLC_get_cltv_expiry"))) TS_ClaimedHTLC_get_cltv_expiry(uint64_t this_ptr) {
71651         LDKClaimedHTLC this_ptr_conv;
71652         this_ptr_conv.inner = untag_ptr(this_ptr);
71653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71655         this_ptr_conv.is_owned = false;
71656         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
71657         return ret_conv;
71658 }
71659
71660 void  __attribute__((export_name("TS_ClaimedHTLC_set_cltv_expiry"))) TS_ClaimedHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
71661         LDKClaimedHTLC this_ptr_conv;
71662         this_ptr_conv.inner = untag_ptr(this_ptr);
71663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71665         this_ptr_conv.is_owned = false;
71666         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
71667 }
71668
71669 int64_t  __attribute__((export_name("TS_ClaimedHTLC_get_value_msat"))) TS_ClaimedHTLC_get_value_msat(uint64_t this_ptr) {
71670         LDKClaimedHTLC this_ptr_conv;
71671         this_ptr_conv.inner = untag_ptr(this_ptr);
71672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71674         this_ptr_conv.is_owned = false;
71675         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
71676         return ret_conv;
71677 }
71678
71679 void  __attribute__((export_name("TS_ClaimedHTLC_set_value_msat"))) TS_ClaimedHTLC_set_value_msat(uint64_t this_ptr, int64_t val) {
71680         LDKClaimedHTLC this_ptr_conv;
71681         this_ptr_conv.inner = untag_ptr(this_ptr);
71682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71684         this_ptr_conv.is_owned = false;
71685         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
71686 }
71687
71688 int64_t  __attribute__((export_name("TS_ClaimedHTLC_get_counterparty_skimmed_fee_msat"))) TS_ClaimedHTLC_get_counterparty_skimmed_fee_msat(uint64_t this_ptr) {
71689         LDKClaimedHTLC this_ptr_conv;
71690         this_ptr_conv.inner = untag_ptr(this_ptr);
71691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71693         this_ptr_conv.is_owned = false;
71694         int64_t ret_conv = ClaimedHTLC_get_counterparty_skimmed_fee_msat(&this_ptr_conv);
71695         return ret_conv;
71696 }
71697
71698 void  __attribute__((export_name("TS_ClaimedHTLC_set_counterparty_skimmed_fee_msat"))) TS_ClaimedHTLC_set_counterparty_skimmed_fee_msat(uint64_t this_ptr, int64_t val) {
71699         LDKClaimedHTLC this_ptr_conv;
71700         this_ptr_conv.inner = untag_ptr(this_ptr);
71701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71703         this_ptr_conv.is_owned = false;
71704         ClaimedHTLC_set_counterparty_skimmed_fee_msat(&this_ptr_conv, val);
71705 }
71706
71707 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_new"))) TS_ClaimedHTLC_new(int8_tArray channel_id_arg, int8_tArray user_channel_id_arg, int32_t cltv_expiry_arg, int64_t value_msat_arg, int64_t counterparty_skimmed_fee_msat_arg) {
71708         LDKThirtyTwoBytes channel_id_arg_ref;
71709         CHECK(channel_id_arg->arr_len == 32);
71710         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
71711         LDKU128 user_channel_id_arg_ref;
71712         CHECK(user_channel_id_arg->arr_len == 16);
71713         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
71714         LDKClaimedHTLC ret_var = ClaimedHTLC_new(channel_id_arg_ref, user_channel_id_arg_ref, cltv_expiry_arg, value_msat_arg, counterparty_skimmed_fee_msat_arg);
71715         uint64_t ret_ref = 0;
71716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71718         return ret_ref;
71719 }
71720
71721 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
71722         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
71723         uint64_t ret_ref = 0;
71724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71726         return ret_ref;
71727 }
71728 int64_t  __attribute__((export_name("TS_ClaimedHTLC_clone_ptr"))) TS_ClaimedHTLC_clone_ptr(uint64_t arg) {
71729         LDKClaimedHTLC arg_conv;
71730         arg_conv.inner = untag_ptr(arg);
71731         arg_conv.is_owned = ptr_is_owned(arg);
71732         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71733         arg_conv.is_owned = false;
71734         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
71735         return ret_conv;
71736 }
71737
71738 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_clone"))) TS_ClaimedHTLC_clone(uint64_t orig) {
71739         LDKClaimedHTLC orig_conv;
71740         orig_conv.inner = untag_ptr(orig);
71741         orig_conv.is_owned = ptr_is_owned(orig);
71742         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71743         orig_conv.is_owned = false;
71744         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
71745         uint64_t ret_ref = 0;
71746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71748         return ret_ref;
71749 }
71750
71751 jboolean  __attribute__((export_name("TS_ClaimedHTLC_eq"))) TS_ClaimedHTLC_eq(uint64_t a, uint64_t b) {
71752         LDKClaimedHTLC a_conv;
71753         a_conv.inner = untag_ptr(a);
71754         a_conv.is_owned = ptr_is_owned(a);
71755         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71756         a_conv.is_owned = false;
71757         LDKClaimedHTLC b_conv;
71758         b_conv.inner = untag_ptr(b);
71759         b_conv.is_owned = ptr_is_owned(b);
71760         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71761         b_conv.is_owned = false;
71762         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
71763         return ret_conv;
71764 }
71765
71766 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_write"))) TS_ClaimedHTLC_write(uint64_t obj) {
71767         LDKClaimedHTLC obj_conv;
71768         obj_conv.inner = untag_ptr(obj);
71769         obj_conv.is_owned = ptr_is_owned(obj);
71770         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71771         obj_conv.is_owned = false;
71772         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
71773         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71774         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71775         CVec_u8Z_free(ret_var);
71776         return ret_arr;
71777 }
71778
71779 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_read"))) TS_ClaimedHTLC_read(int8_tArray ser) {
71780         LDKu8slice ser_ref;
71781         ser_ref.datalen = ser->arr_len;
71782         ser_ref.data = ser->elems;
71783         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
71784         *ret_conv = ClaimedHTLC_read(ser_ref);
71785         FREE(ser);
71786         return tag_ptr(ret_conv, true);
71787 }
71788
71789 void  __attribute__((export_name("TS_PathFailure_free"))) TS_PathFailure_free(uint64_t this_ptr) {
71790         if (!ptr_is_owned(this_ptr)) return;
71791         void* this_ptr_ptr = untag_ptr(this_ptr);
71792         CHECK_ACCESS(this_ptr_ptr);
71793         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
71794         FREE(untag_ptr(this_ptr));
71795         PathFailure_free(this_ptr_conv);
71796 }
71797
71798 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
71799         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
71800         *ret_copy = PathFailure_clone(arg);
71801         uint64_t ret_ref = tag_ptr(ret_copy, true);
71802         return ret_ref;
71803 }
71804 int64_t  __attribute__((export_name("TS_PathFailure_clone_ptr"))) TS_PathFailure_clone_ptr(uint64_t arg) {
71805         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
71806         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
71807         return ret_conv;
71808 }
71809
71810 uint64_t  __attribute__((export_name("TS_PathFailure_clone"))) TS_PathFailure_clone(uint64_t orig) {
71811         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
71812         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
71813         *ret_copy = PathFailure_clone(orig_conv);
71814         uint64_t ret_ref = tag_ptr(ret_copy, true);
71815         return ret_ref;
71816 }
71817
71818 uint64_t  __attribute__((export_name("TS_PathFailure_initial_send"))) TS_PathFailure_initial_send(uint64_t err) {
71819         void* err_ptr = untag_ptr(err);
71820         CHECK_ACCESS(err_ptr);
71821         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
71822         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
71823         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
71824         *ret_copy = PathFailure_initial_send(err_conv);
71825         uint64_t ret_ref = tag_ptr(ret_copy, true);
71826         return ret_ref;
71827 }
71828
71829 uint64_t  __attribute__((export_name("TS_PathFailure_on_path"))) TS_PathFailure_on_path(uint64_t network_update) {
71830         void* network_update_ptr = untag_ptr(network_update);
71831         CHECK_ACCESS(network_update_ptr);
71832         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
71833         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
71834         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
71835         *ret_copy = PathFailure_on_path(network_update_conv);
71836         uint64_t ret_ref = tag_ptr(ret_copy, true);
71837         return ret_ref;
71838 }
71839
71840 jboolean  __attribute__((export_name("TS_PathFailure_eq"))) TS_PathFailure_eq(uint64_t a, uint64_t b) {
71841         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
71842         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
71843         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
71844         return ret_conv;
71845 }
71846
71847 int8_tArray  __attribute__((export_name("TS_PathFailure_write"))) TS_PathFailure_write(uint64_t obj) {
71848         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
71849         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
71850         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71851         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71852         CVec_u8Z_free(ret_var);
71853         return ret_arr;
71854 }
71855
71856 uint64_t  __attribute__((export_name("TS_PathFailure_read"))) TS_PathFailure_read(int8_tArray ser) {
71857         LDKu8slice ser_ref;
71858         ser_ref.datalen = ser->arr_len;
71859         ser_ref.data = ser->elems;
71860         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
71861         *ret_conv = PathFailure_read(ser_ref);
71862         FREE(ser);
71863         return tag_ptr(ret_conv, true);
71864 }
71865
71866 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
71867         if (!ptr_is_owned(this_ptr)) return;
71868         void* this_ptr_ptr = untag_ptr(this_ptr);
71869         CHECK_ACCESS(this_ptr_ptr);
71870         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
71871         FREE(untag_ptr(this_ptr));
71872         ClosureReason_free(this_ptr_conv);
71873 }
71874
71875 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
71876         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71877         *ret_copy = ClosureReason_clone(arg);
71878         uint64_t ret_ref = tag_ptr(ret_copy, true);
71879         return ret_ref;
71880 }
71881 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
71882         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
71883         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
71884         return ret_conv;
71885 }
71886
71887 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
71888         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
71889         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71890         *ret_copy = ClosureReason_clone(orig_conv);
71891         uint64_t ret_ref = tag_ptr(ret_copy, true);
71892         return ret_ref;
71893 }
71894
71895 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(uint64_t peer_msg) {
71896         LDKUntrustedString peer_msg_conv;
71897         peer_msg_conv.inner = untag_ptr(peer_msg);
71898         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
71899         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
71900         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
71901         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71902         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
71903         uint64_t ret_ref = tag_ptr(ret_copy, true);
71904         return ret_ref;
71905 }
71906
71907 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
71908         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71909         *ret_copy = ClosureReason_holder_force_closed();
71910         uint64_t ret_ref = tag_ptr(ret_copy, true);
71911         return ret_ref;
71912 }
71913
71914 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
71915         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71916         *ret_copy = ClosureReason_cooperative_closure();
71917         uint64_t ret_ref = tag_ptr(ret_copy, true);
71918         return ret_ref;
71919 }
71920
71921 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
71922         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71923         *ret_copy = ClosureReason_commitment_tx_confirmed();
71924         uint64_t ret_ref = tag_ptr(ret_copy, true);
71925         return ret_ref;
71926 }
71927
71928 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
71929         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71930         *ret_copy = ClosureReason_funding_timed_out();
71931         uint64_t ret_ref = tag_ptr(ret_copy, true);
71932         return ret_ref;
71933 }
71934
71935 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
71936         LDKStr err_conv = str_ref_to_owned_c(err);
71937         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71938         *ret_copy = ClosureReason_processing_error(err_conv);
71939         uint64_t ret_ref = tag_ptr(ret_copy, true);
71940         return ret_ref;
71941 }
71942
71943 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
71944         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71945         *ret_copy = ClosureReason_disconnected_peer();
71946         uint64_t ret_ref = tag_ptr(ret_copy, true);
71947         return ret_ref;
71948 }
71949
71950 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
71951         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71952         *ret_copy = ClosureReason_outdated_channel_manager();
71953         uint64_t ret_ref = tag_ptr(ret_copy, true);
71954         return ret_ref;
71955 }
71956
71957 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_coop_closed_unfunded_channel"))) TS_ClosureReason_counterparty_coop_closed_unfunded_channel() {
71958         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71959         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
71960         uint64_t ret_ref = tag_ptr(ret_copy, true);
71961         return ret_ref;
71962 }
71963
71964 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_batch_closure"))) TS_ClosureReason_funding_batch_closure() {
71965         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71966         *ret_copy = ClosureReason_funding_batch_closure();
71967         uint64_t ret_ref = tag_ptr(ret_copy, true);
71968         return ret_ref;
71969 }
71970
71971 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
71972         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
71973         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
71974         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
71975         return ret_conv;
71976 }
71977
71978 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
71979         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
71980         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
71981         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71982         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71983         CVec_u8Z_free(ret_var);
71984         return ret_arr;
71985 }
71986
71987 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
71988         LDKu8slice ser_ref;
71989         ser_ref.datalen = ser->arr_len;
71990         ser_ref.data = ser->elems;
71991         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
71992         *ret_conv = ClosureReason_read(ser_ref);
71993         FREE(ser);
71994         return tag_ptr(ret_conv, true);
71995 }
71996
71997 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
71998         if (!ptr_is_owned(this_ptr)) return;
71999         void* this_ptr_ptr = untag_ptr(this_ptr);
72000         CHECK_ACCESS(this_ptr_ptr);
72001         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
72002         FREE(untag_ptr(this_ptr));
72003         HTLCDestination_free(this_ptr_conv);
72004 }
72005
72006 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
72007         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72008         *ret_copy = HTLCDestination_clone(arg);
72009         uint64_t ret_ref = tag_ptr(ret_copy, true);
72010         return ret_ref;
72011 }
72012 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
72013         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
72014         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
72015         return ret_conv;
72016 }
72017
72018 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
72019         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
72020         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72021         *ret_copy = HTLCDestination_clone(orig_conv);
72022         uint64_t ret_ref = tag_ptr(ret_copy, true);
72023         return ret_ref;
72024 }
72025
72026 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
72027         LDKPublicKey node_id_ref;
72028         CHECK(node_id->arr_len == 33);
72029         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72030         LDKThirtyTwoBytes channel_id_ref;
72031         CHECK(channel_id->arr_len == 32);
72032         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
72033         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72034         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
72035         uint64_t ret_ref = tag_ptr(ret_copy, true);
72036         return ret_ref;
72037 }
72038
72039 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
72040         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72041         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
72042         uint64_t ret_ref = tag_ptr(ret_copy, true);
72043         return ret_ref;
72044 }
72045
72046 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
72047         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72048         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
72049         uint64_t ret_ref = tag_ptr(ret_copy, true);
72050         return ret_ref;
72051 }
72052
72053 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
72054         LDKThirtyTwoBytes payment_hash_ref;
72055         CHECK(payment_hash->arr_len == 32);
72056         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72057         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72058         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
72059         uint64_t ret_ref = tag_ptr(ret_copy, true);
72060         return ret_ref;
72061 }
72062
72063 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
72064         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
72065         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
72066         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
72067         return ret_conv;
72068 }
72069
72070 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
72071         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
72072         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
72073         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72074         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72075         CVec_u8Z_free(ret_var);
72076         return ret_arr;
72077 }
72078
72079 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
72080         LDKu8slice ser_ref;
72081         ser_ref.datalen = ser->arr_len;
72082         ser_ref.data = ser->elems;
72083         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
72084         *ret_conv = HTLCDestination_read(ser_ref);
72085         FREE(ser);
72086         return tag_ptr(ret_conv, true);
72087 }
72088
72089 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_clone"))) TS_PaymentFailureReason_clone(uint64_t orig) {
72090         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
72091         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_clone(orig_conv));
72092         return ret_conv;
72093 }
72094
72095 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_recipient_rejected"))) TS_PaymentFailureReason_recipient_rejected() {
72096         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_recipient_rejected());
72097         return ret_conv;
72098 }
72099
72100 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_user_abandoned"))) TS_PaymentFailureReason_user_abandoned() {
72101         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_user_abandoned());
72102         return ret_conv;
72103 }
72104
72105 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_retries_exhausted"))) TS_PaymentFailureReason_retries_exhausted() {
72106         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_retries_exhausted());
72107         return ret_conv;
72108 }
72109
72110 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_payment_expired"))) TS_PaymentFailureReason_payment_expired() {
72111         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_payment_expired());
72112         return ret_conv;
72113 }
72114
72115 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_route_not_found"))) TS_PaymentFailureReason_route_not_found() {
72116         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_route_not_found());
72117         return ret_conv;
72118 }
72119
72120 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_unexpected_error"))) TS_PaymentFailureReason_unexpected_error() {
72121         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_unexpected_error());
72122         return ret_conv;
72123 }
72124
72125 jboolean  __attribute__((export_name("TS_PaymentFailureReason_eq"))) TS_PaymentFailureReason_eq(uint64_t a, uint64_t b) {
72126         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
72127         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
72128         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
72129         return ret_conv;
72130 }
72131
72132 int8_tArray  __attribute__((export_name("TS_PaymentFailureReason_write"))) TS_PaymentFailureReason_write(uint64_t obj) {
72133         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
72134         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
72135         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72136         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72137         CVec_u8Z_free(ret_var);
72138         return ret_arr;
72139 }
72140
72141 uint64_t  __attribute__((export_name("TS_PaymentFailureReason_read"))) TS_PaymentFailureReason_read(int8_tArray ser) {
72142         LDKu8slice ser_ref;
72143         ser_ref.datalen = ser->arr_len;
72144         ser_ref.data = ser->elems;
72145         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
72146         *ret_conv = PaymentFailureReason_read(ser_ref);
72147         FREE(ser);
72148         return tag_ptr(ret_conv, true);
72149 }
72150
72151 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
72152         if (!ptr_is_owned(this_ptr)) return;
72153         void* this_ptr_ptr = untag_ptr(this_ptr);
72154         CHECK_ACCESS(this_ptr_ptr);
72155         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
72156         FREE(untag_ptr(this_ptr));
72157         Event_free(this_ptr_conv);
72158 }
72159
72160 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
72161         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72162         *ret_copy = Event_clone(arg);
72163         uint64_t ret_ref = tag_ptr(ret_copy, true);
72164         return ret_ref;
72165 }
72166 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
72167         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
72168         int64_t ret_conv = Event_clone_ptr(arg_conv);
72169         return ret_conv;
72170 }
72171
72172 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
72173         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
72174         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72175         *ret_copy = Event_clone(orig_conv);
72176         uint64_t ret_ref = tag_ptr(ret_copy, true);
72177         return ret_ref;
72178 }
72179
72180 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) {
72181         LDKThirtyTwoBytes temporary_channel_id_ref;
72182         CHECK(temporary_channel_id->arr_len == 32);
72183         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
72184         LDKPublicKey counterparty_node_id_ref;
72185         CHECK(counterparty_node_id->arr_len == 33);
72186         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
72187         LDKCVec_u8Z output_script_ref;
72188         output_script_ref.datalen = output_script->arr_len;
72189         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
72190         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
72191         LDKU128 user_channel_id_ref;
72192         CHECK(user_channel_id->arr_len == 16);
72193         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
72194         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72195         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
72196         uint64_t ret_ref = tag_ptr(ret_copy, true);
72197         return ret_ref;
72198 }
72199
72200 uint64_t  __attribute__((export_name("TS_Event_payment_claimable"))) TS_Event_payment_claimable(int8_tArray receiver_node_id, int8_tArray payment_hash, uint64_t onion_fields, int64_t amount_msat, int64_t counterparty_skimmed_fee_msat, uint64_t purpose, uint64_t via_channel_id, uint64_t via_user_channel_id, uint64_t claim_deadline) {
72201         LDKPublicKey receiver_node_id_ref;
72202         CHECK(receiver_node_id->arr_len == 33);
72203         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
72204         LDKThirtyTwoBytes payment_hash_ref;
72205         CHECK(payment_hash->arr_len == 32);
72206         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72207         LDKRecipientOnionFields onion_fields_conv;
72208         onion_fields_conv.inner = untag_ptr(onion_fields);
72209         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
72210         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
72211         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
72212         void* purpose_ptr = untag_ptr(purpose);
72213         CHECK_ACCESS(purpose_ptr);
72214         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
72215         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
72216         void* via_channel_id_ptr = untag_ptr(via_channel_id);
72217         CHECK_ACCESS(via_channel_id_ptr);
72218         LDKCOption_ThirtyTwoBytesZ via_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(via_channel_id_ptr);
72219         via_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(via_channel_id));
72220         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
72221         CHECK_ACCESS(via_user_channel_id_ptr);
72222         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
72223         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
72224         void* claim_deadline_ptr = untag_ptr(claim_deadline);
72225         CHECK_ACCESS(claim_deadline_ptr);
72226         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
72227         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
72228         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72229         *ret_copy = Event_payment_claimable(receiver_node_id_ref, payment_hash_ref, onion_fields_conv, amount_msat, counterparty_skimmed_fee_msat, purpose_conv, via_channel_id_conv, via_user_channel_id_conv, claim_deadline_conv);
72230         uint64_t ret_ref = tag_ptr(ret_copy, true);
72231         return ret_ref;
72232 }
72233
72234 uint64_t  __attribute__((export_name("TS_Event_payment_claimed"))) TS_Event_payment_claimed(int8_tArray receiver_node_id, int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose, uint64_tArray htlcs, uint64_t sender_intended_total_msat) {
72235         LDKPublicKey receiver_node_id_ref;
72236         CHECK(receiver_node_id->arr_len == 33);
72237         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
72238         LDKThirtyTwoBytes payment_hash_ref;
72239         CHECK(payment_hash->arr_len == 32);
72240         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72241         void* purpose_ptr = untag_ptr(purpose);
72242         CHECK_ACCESS(purpose_ptr);
72243         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
72244         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
72245         LDKCVec_ClaimedHTLCZ htlcs_constr;
72246         htlcs_constr.datalen = htlcs->arr_len;
72247         if (htlcs_constr.datalen > 0)
72248                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
72249         else
72250                 htlcs_constr.data = NULL;
72251         uint64_t* htlcs_vals = htlcs->elems;
72252         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
72253                 uint64_t htlcs_conv_13 = htlcs_vals[n];
72254                 LDKClaimedHTLC htlcs_conv_13_conv;
72255                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
72256                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
72257                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
72258                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
72259                 htlcs_constr.data[n] = htlcs_conv_13_conv;
72260         }
72261         FREE(htlcs);
72262         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
72263         CHECK_ACCESS(sender_intended_total_msat_ptr);
72264         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
72265         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
72266         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72267         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
72268         uint64_t ret_ref = tag_ptr(ret_copy, true);
72269         return ret_ref;
72270 }
72271
72272 uint64_t  __attribute__((export_name("TS_Event_connection_needed"))) TS_Event_connection_needed(int8_tArray node_id, uint64_tArray addresses) {
72273         LDKPublicKey node_id_ref;
72274         CHECK(node_id->arr_len == 33);
72275         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72276         LDKCVec_SocketAddressZ addresses_constr;
72277         addresses_constr.datalen = addresses->arr_len;
72278         if (addresses_constr.datalen > 0)
72279                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
72280         else
72281                 addresses_constr.data = NULL;
72282         uint64_t* addresses_vals = addresses->elems;
72283         for (size_t p = 0; p < addresses_constr.datalen; p++) {
72284                 uint64_t addresses_conv_15 = addresses_vals[p];
72285                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
72286                 CHECK_ACCESS(addresses_conv_15_ptr);
72287                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
72288                 addresses_constr.data[p] = addresses_conv_15_conv;
72289         }
72290         FREE(addresses);
72291         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72292         *ret_copy = Event_connection_needed(node_id_ref, addresses_constr);
72293         uint64_t ret_ref = tag_ptr(ret_copy, true);
72294         return ret_ref;
72295 }
72296
72297 uint64_t  __attribute__((export_name("TS_Event_invoice_request_failed"))) TS_Event_invoice_request_failed(int8_tArray payment_id) {
72298         LDKThirtyTwoBytes payment_id_ref;
72299         CHECK(payment_id->arr_len == 32);
72300         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72301         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72302         *ret_copy = Event_invoice_request_failed(payment_id_ref);
72303         uint64_t ret_ref = tag_ptr(ret_copy, true);
72304         return ret_ref;
72305 }
72306
72307 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) {
72308         void* payment_id_ptr = untag_ptr(payment_id);
72309         CHECK_ACCESS(payment_id_ptr);
72310         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
72311         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
72312         LDKThirtyTwoBytes payment_preimage_ref;
72313         CHECK(payment_preimage->arr_len == 32);
72314         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
72315         LDKThirtyTwoBytes payment_hash_ref;
72316         CHECK(payment_hash->arr_len == 32);
72317         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72318         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
72319         CHECK_ACCESS(fee_paid_msat_ptr);
72320         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
72321         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
72322         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72323         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
72324         uint64_t ret_ref = tag_ptr(ret_copy, true);
72325         return ret_ref;
72326 }
72327
72328 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t reason) {
72329         LDKThirtyTwoBytes payment_id_ref;
72330         CHECK(payment_id->arr_len == 32);
72331         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72332         LDKThirtyTwoBytes payment_hash_ref;
72333         CHECK(payment_hash->arr_len == 32);
72334         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72335         void* reason_ptr = untag_ptr(reason);
72336         CHECK_ACCESS(reason_ptr);
72337         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
72338         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
72339         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72340         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
72341         uint64_t ret_ref = tag_ptr(ret_copy, true);
72342         return ret_ref;
72343 }
72344
72345 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) {
72346         LDKThirtyTwoBytes payment_id_ref;
72347         CHECK(payment_id->arr_len == 32);
72348         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72349         void* payment_hash_ptr = untag_ptr(payment_hash);
72350         CHECK_ACCESS(payment_hash_ptr);
72351         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
72352         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
72353         LDKPath path_conv;
72354         path_conv.inner = untag_ptr(path);
72355         path_conv.is_owned = ptr_is_owned(path);
72356         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
72357         path_conv = Path_clone(&path_conv);
72358         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72359         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
72360         uint64_t ret_ref = tag_ptr(ret_copy, true);
72361         return ret_ref;
72362 }
72363
72364 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) {
72365         void* payment_id_ptr = untag_ptr(payment_id);
72366         CHECK_ACCESS(payment_id_ptr);
72367         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
72368         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
72369         LDKThirtyTwoBytes payment_hash_ref;
72370         CHECK(payment_hash->arr_len == 32);
72371         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72372         void* failure_ptr = untag_ptr(failure);
72373         CHECK_ACCESS(failure_ptr);
72374         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
72375         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
72376         LDKPath path_conv;
72377         path_conv.inner = untag_ptr(path);
72378         path_conv.is_owned = ptr_is_owned(path);
72379         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
72380         path_conv = Path_clone(&path_conv);
72381         void* short_channel_id_ptr = untag_ptr(short_channel_id);
72382         CHECK_ACCESS(short_channel_id_ptr);
72383         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
72384         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
72385         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72386         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
72387         uint64_t ret_ref = tag_ptr(ret_copy, true);
72388         return ret_ref;
72389 }
72390
72391 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path) {
72392         LDKThirtyTwoBytes payment_id_ref;
72393         CHECK(payment_id->arr_len == 32);
72394         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72395         LDKThirtyTwoBytes payment_hash_ref;
72396         CHECK(payment_hash->arr_len == 32);
72397         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72398         LDKPath path_conv;
72399         path_conv.inner = untag_ptr(path);
72400         path_conv.is_owned = ptr_is_owned(path);
72401         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
72402         path_conv = Path_clone(&path_conv);
72403         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72404         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
72405         uint64_t ret_ref = tag_ptr(ret_copy, true);
72406         return ret_ref;
72407 }
72408
72409 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) {
72410         LDKThirtyTwoBytes payment_id_ref;
72411         CHECK(payment_id->arr_len == 32);
72412         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72413         LDKThirtyTwoBytes payment_hash_ref;
72414         CHECK(payment_hash->arr_len == 32);
72415         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72416         LDKPath path_conv;
72417         path_conv.inner = untag_ptr(path);
72418         path_conv.is_owned = ptr_is_owned(path);
72419         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
72420         path_conv = Path_clone(&path_conv);
72421         void* short_channel_id_ptr = untag_ptr(short_channel_id);
72422         CHECK_ACCESS(short_channel_id_ptr);
72423         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
72424         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
72425         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72426         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
72427         uint64_t ret_ref = tag_ptr(ret_copy, true);
72428         return ret_ref;
72429 }
72430
72431 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
72432         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72433         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
72434         uint64_t ret_ref = tag_ptr(ret_copy, true);
72435         return ret_ref;
72436 }
72437
72438 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) {
72439         LDKThirtyTwoBytes intercept_id_ref;
72440         CHECK(intercept_id->arr_len == 32);
72441         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
72442         LDKThirtyTwoBytes payment_hash_ref;
72443         CHECK(payment_hash->arr_len == 32);
72444         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72445         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72446         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
72447         uint64_t ret_ref = tag_ptr(ret_copy, true);
72448         return ret_ref;
72449 }
72450
72451 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs, uint64_t channel_id) {
72452         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
72453         outputs_constr.datalen = outputs->arr_len;
72454         if (outputs_constr.datalen > 0)
72455                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
72456         else
72457                 outputs_constr.data = NULL;
72458         uint64_t* outputs_vals = outputs->elems;
72459         for (size_t b = 0; b < outputs_constr.datalen; b++) {
72460                 uint64_t outputs_conv_27 = outputs_vals[b];
72461                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
72462                 CHECK_ACCESS(outputs_conv_27_ptr);
72463                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
72464                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
72465                 outputs_constr.data[b] = outputs_conv_27_conv;
72466         }
72467         FREE(outputs);
72468         void* channel_id_ptr = untag_ptr(channel_id);
72469         CHECK_ACCESS(channel_id_ptr);
72470         LDKCOption_ThirtyTwoBytesZ channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_ptr);
72471         channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id));
72472         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72473         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
72474         uint64_t ret_ref = tag_ptr(ret_copy, true);
72475         return ret_ref;
72476 }
72477
72478 uint64_t  __attribute__((export_name("TS_Event_payment_forwarded"))) TS_Event_payment_forwarded(uint64_t prev_channel_id, uint64_t next_channel_id, uint64_t fee_earned_msat, jboolean claim_from_onchain_tx, uint64_t outbound_amount_forwarded_msat) {
72479         void* prev_channel_id_ptr = untag_ptr(prev_channel_id);
72480         CHECK_ACCESS(prev_channel_id_ptr);
72481         LDKCOption_ThirtyTwoBytesZ prev_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(prev_channel_id_ptr);
72482         prev_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(prev_channel_id));
72483         void* next_channel_id_ptr = untag_ptr(next_channel_id);
72484         CHECK_ACCESS(next_channel_id_ptr);
72485         LDKCOption_ThirtyTwoBytesZ next_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_channel_id_ptr);
72486         next_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_channel_id));
72487         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
72488         CHECK_ACCESS(fee_earned_msat_ptr);
72489         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
72490         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
72491         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
72492         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
72493         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
72494         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
72495         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72496         *ret_copy = Event_payment_forwarded(prev_channel_id_conv, next_channel_id_conv, fee_earned_msat_conv, claim_from_onchain_tx, outbound_amount_forwarded_msat_conv);
72497         uint64_t ret_ref = tag_ptr(ret_copy, true);
72498         return ret_ref;
72499 }
72500
72501 uint64_t  __attribute__((export_name("TS_Event_channel_pending"))) TS_Event_channel_pending(int8_tArray channel_id, int8_tArray user_channel_id, uint64_t former_temporary_channel_id, int8_tArray counterparty_node_id, uint64_t funding_txo) {
72502         LDKThirtyTwoBytes channel_id_ref;
72503         CHECK(channel_id->arr_len == 32);
72504         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
72505         LDKU128 user_channel_id_ref;
72506         CHECK(user_channel_id->arr_len == 16);
72507         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
72508         void* former_temporary_channel_id_ptr = untag_ptr(former_temporary_channel_id);
72509         CHECK_ACCESS(former_temporary_channel_id_ptr);
72510         LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(former_temporary_channel_id_ptr);
72511         former_temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(former_temporary_channel_id));
72512         LDKPublicKey counterparty_node_id_ref;
72513         CHECK(counterparty_node_id->arr_len == 33);
72514         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
72515         LDKOutPoint funding_txo_conv;
72516         funding_txo_conv.inner = untag_ptr(funding_txo);
72517         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
72518         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
72519         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
72520         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72521         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_conv, counterparty_node_id_ref, funding_txo_conv);
72522         uint64_t ret_ref = tag_ptr(ret_copy, true);
72523         return ret_ref;
72524 }
72525
72526 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) {
72527         LDKThirtyTwoBytes channel_id_ref;
72528         CHECK(channel_id->arr_len == 32);
72529         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
72530         LDKU128 user_channel_id_ref;
72531         CHECK(user_channel_id->arr_len == 16);
72532         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
72533         LDKPublicKey counterparty_node_id_ref;
72534         CHECK(counterparty_node_id->arr_len == 33);
72535         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
72536         LDKChannelTypeFeatures channel_type_conv;
72537         channel_type_conv.inner = untag_ptr(channel_type);
72538         channel_type_conv.is_owned = ptr_is_owned(channel_type);
72539         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
72540         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
72541         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72542         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
72543         uint64_t ret_ref = tag_ptr(ret_copy, true);
72544         return ret_ref;
72545 }
72546
72547 uint64_t  __attribute__((export_name("TS_Event_channel_closed"))) TS_Event_channel_closed(int8_tArray channel_id, int8_tArray user_channel_id, uint64_t reason, int8_tArray counterparty_node_id, uint64_t channel_capacity_sats, uint64_t channel_funding_txo) {
72548         LDKThirtyTwoBytes channel_id_ref;
72549         CHECK(channel_id->arr_len == 32);
72550         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
72551         LDKU128 user_channel_id_ref;
72552         CHECK(user_channel_id->arr_len == 16);
72553         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
72554         void* reason_ptr = untag_ptr(reason);
72555         CHECK_ACCESS(reason_ptr);
72556         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
72557         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
72558         LDKPublicKey counterparty_node_id_ref;
72559         CHECK(counterparty_node_id->arr_len == 33);
72560         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
72561         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
72562         CHECK_ACCESS(channel_capacity_sats_ptr);
72563         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
72564         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
72565         LDKOutPoint channel_funding_txo_conv;
72566         channel_funding_txo_conv.inner = untag_ptr(channel_funding_txo);
72567         channel_funding_txo_conv.is_owned = ptr_is_owned(channel_funding_txo);
72568         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_conv);
72569         channel_funding_txo_conv = OutPoint_clone(&channel_funding_txo_conv);
72570         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72571         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv, counterparty_node_id_ref, channel_capacity_sats_conv, channel_funding_txo_conv);
72572         uint64_t ret_ref = tag_ptr(ret_copy, true);
72573         return ret_ref;
72574 }
72575
72576 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
72577         LDKThirtyTwoBytes channel_id_ref;
72578         CHECK(channel_id->arr_len == 32);
72579         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
72580         LDKTransaction transaction_ref;
72581         transaction_ref.datalen = transaction->arr_len;
72582         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
72583         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
72584         transaction_ref.data_is_owned = true;
72585         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72586         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
72587         uint64_t ret_ref = tag_ptr(ret_copy, true);
72588         return ret_ref;
72589 }
72590
72591 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) {
72592         LDKThirtyTwoBytes temporary_channel_id_ref;
72593         CHECK(temporary_channel_id->arr_len == 32);
72594         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
72595         LDKPublicKey counterparty_node_id_ref;
72596         CHECK(counterparty_node_id->arr_len == 33);
72597         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
72598         LDKChannelTypeFeatures channel_type_conv;
72599         channel_type_conv.inner = untag_ptr(channel_type);
72600         channel_type_conv.is_owned = ptr_is_owned(channel_type);
72601         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
72602         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
72603         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72604         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
72605         uint64_t ret_ref = tag_ptr(ret_copy, true);
72606         return ret_ref;
72607 }
72608
72609 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
72610         LDKThirtyTwoBytes prev_channel_id_ref;
72611         CHECK(prev_channel_id->arr_len == 32);
72612         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
72613         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
72614         CHECK_ACCESS(failed_next_destination_ptr);
72615         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
72616         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
72617         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72618         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
72619         uint64_t ret_ref = tag_ptr(ret_copy, true);
72620         return ret_ref;
72621 }
72622
72623 uint64_t  __attribute__((export_name("TS_Event_bump_transaction"))) TS_Event_bump_transaction(uint64_t a) {
72624         void* a_ptr = untag_ptr(a);
72625         CHECK_ACCESS(a_ptr);
72626         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
72627         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
72628         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72629         *ret_copy = Event_bump_transaction(a_conv);
72630         uint64_t ret_ref = tag_ptr(ret_copy, true);
72631         return ret_ref;
72632 }
72633
72634 jboolean  __attribute__((export_name("TS_Event_eq"))) TS_Event_eq(uint64_t a, uint64_t b) {
72635         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
72636         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
72637         jboolean ret_conv = Event_eq(a_conv, b_conv);
72638         return ret_conv;
72639 }
72640
72641 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
72642         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
72643         LDKCVec_u8Z ret_var = Event_write(obj_conv);
72644         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72645         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72646         CVec_u8Z_free(ret_var);
72647         return ret_arr;
72648 }
72649
72650 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
72651         LDKu8slice ser_ref;
72652         ser_ref.datalen = ser->arr_len;
72653         ser_ref.data = ser->elems;
72654         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
72655         *ret_conv = Event_read(ser_ref);
72656         FREE(ser);
72657         return tag_ptr(ret_conv, true);
72658 }
72659
72660 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
72661         if (!ptr_is_owned(this_ptr)) return;
72662         void* this_ptr_ptr = untag_ptr(this_ptr);
72663         CHECK_ACCESS(this_ptr_ptr);
72664         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
72665         FREE(untag_ptr(this_ptr));
72666         MessageSendEvent_free(this_ptr_conv);
72667 }
72668
72669 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
72670         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72671         *ret_copy = MessageSendEvent_clone(arg);
72672         uint64_t ret_ref = tag_ptr(ret_copy, true);
72673         return ret_ref;
72674 }
72675 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
72676         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
72677         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
72678         return ret_conv;
72679 }
72680
72681 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
72682         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
72683         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72684         *ret_copy = MessageSendEvent_clone(orig_conv);
72685         uint64_t ret_ref = tag_ptr(ret_copy, true);
72686         return ret_ref;
72687 }
72688
72689 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
72690         LDKPublicKey node_id_ref;
72691         CHECK(node_id->arr_len == 33);
72692         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72693         LDKAcceptChannel msg_conv;
72694         msg_conv.inner = untag_ptr(msg);
72695         msg_conv.is_owned = ptr_is_owned(msg);
72696         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72697         msg_conv = AcceptChannel_clone(&msg_conv);
72698         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72699         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
72700         uint64_t ret_ref = tag_ptr(ret_copy, true);
72701         return ret_ref;
72702 }
72703
72704 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel_v2"))) TS_MessageSendEvent_send_accept_channel_v2(int8_tArray node_id, uint64_t msg) {
72705         LDKPublicKey node_id_ref;
72706         CHECK(node_id->arr_len == 33);
72707         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72708         LDKAcceptChannelV2 msg_conv;
72709         msg_conv.inner = untag_ptr(msg);
72710         msg_conv.is_owned = ptr_is_owned(msg);
72711         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72712         msg_conv = AcceptChannelV2_clone(&msg_conv);
72713         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72714         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
72715         uint64_t ret_ref = tag_ptr(ret_copy, true);
72716         return ret_ref;
72717 }
72718
72719 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
72720         LDKPublicKey node_id_ref;
72721         CHECK(node_id->arr_len == 33);
72722         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72723         LDKOpenChannel msg_conv;
72724         msg_conv.inner = untag_ptr(msg);
72725         msg_conv.is_owned = ptr_is_owned(msg);
72726         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72727         msg_conv = OpenChannel_clone(&msg_conv);
72728         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72729         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
72730         uint64_t ret_ref = tag_ptr(ret_copy, true);
72731         return ret_ref;
72732 }
72733
72734 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel_v2"))) TS_MessageSendEvent_send_open_channel_v2(int8_tArray node_id, uint64_t msg) {
72735         LDKPublicKey node_id_ref;
72736         CHECK(node_id->arr_len == 33);
72737         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72738         LDKOpenChannelV2 msg_conv;
72739         msg_conv.inner = untag_ptr(msg);
72740         msg_conv.is_owned = ptr_is_owned(msg);
72741         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72742         msg_conv = OpenChannelV2_clone(&msg_conv);
72743         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72744         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
72745         uint64_t ret_ref = tag_ptr(ret_copy, true);
72746         return ret_ref;
72747 }
72748
72749 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
72750         LDKPublicKey node_id_ref;
72751         CHECK(node_id->arr_len == 33);
72752         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72753         LDKFundingCreated msg_conv;
72754         msg_conv.inner = untag_ptr(msg);
72755         msg_conv.is_owned = ptr_is_owned(msg);
72756         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72757         msg_conv = FundingCreated_clone(&msg_conv);
72758         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72759         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
72760         uint64_t ret_ref = tag_ptr(ret_copy, true);
72761         return ret_ref;
72762 }
72763
72764 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
72765         LDKPublicKey node_id_ref;
72766         CHECK(node_id->arr_len == 33);
72767         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72768         LDKFundingSigned msg_conv;
72769         msg_conv.inner = untag_ptr(msg);
72770         msg_conv.is_owned = ptr_is_owned(msg);
72771         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72772         msg_conv = FundingSigned_clone(&msg_conv);
72773         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72774         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
72775         uint64_t ret_ref = tag_ptr(ret_copy, true);
72776         return ret_ref;
72777 }
72778
72779 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_stfu"))) TS_MessageSendEvent_send_stfu(int8_tArray node_id, uint64_t msg) {
72780         LDKPublicKey node_id_ref;
72781         CHECK(node_id->arr_len == 33);
72782         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72783         LDKStfu msg_conv;
72784         msg_conv.inner = untag_ptr(msg);
72785         msg_conv.is_owned = ptr_is_owned(msg);
72786         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72787         msg_conv = Stfu_clone(&msg_conv);
72788         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72789         *ret_copy = MessageSendEvent_send_stfu(node_id_ref, msg_conv);
72790         uint64_t ret_ref = tag_ptr(ret_copy, true);
72791         return ret_ref;
72792 }
72793
72794 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_splice"))) TS_MessageSendEvent_send_splice(int8_tArray node_id, uint64_t msg) {
72795         LDKPublicKey node_id_ref;
72796         CHECK(node_id->arr_len == 33);
72797         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72798         LDKSplice msg_conv;
72799         msg_conv.inner = untag_ptr(msg);
72800         msg_conv.is_owned = ptr_is_owned(msg);
72801         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72802         msg_conv = Splice_clone(&msg_conv);
72803         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72804         *ret_copy = MessageSendEvent_send_splice(node_id_ref, msg_conv);
72805         uint64_t ret_ref = tag_ptr(ret_copy, true);
72806         return ret_ref;
72807 }
72808
72809 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_splice_ack"))) TS_MessageSendEvent_send_splice_ack(int8_tArray node_id, uint64_t msg) {
72810         LDKPublicKey node_id_ref;
72811         CHECK(node_id->arr_len == 33);
72812         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72813         LDKSpliceAck msg_conv;
72814         msg_conv.inner = untag_ptr(msg);
72815         msg_conv.is_owned = ptr_is_owned(msg);
72816         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72817         msg_conv = SpliceAck_clone(&msg_conv);
72818         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72819         *ret_copy = MessageSendEvent_send_splice_ack(node_id_ref, msg_conv);
72820         uint64_t ret_ref = tag_ptr(ret_copy, true);
72821         return ret_ref;
72822 }
72823
72824 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_splice_locked"))) TS_MessageSendEvent_send_splice_locked(int8_tArray node_id, uint64_t msg) {
72825         LDKPublicKey node_id_ref;
72826         CHECK(node_id->arr_len == 33);
72827         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72828         LDKSpliceLocked msg_conv;
72829         msg_conv.inner = untag_ptr(msg);
72830         msg_conv.is_owned = ptr_is_owned(msg);
72831         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72832         msg_conv = SpliceLocked_clone(&msg_conv);
72833         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72834         *ret_copy = MessageSendEvent_send_splice_locked(node_id_ref, msg_conv);
72835         uint64_t ret_ref = tag_ptr(ret_copy, true);
72836         return ret_ref;
72837 }
72838
72839 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_input"))) TS_MessageSendEvent_send_tx_add_input(int8_tArray node_id, uint64_t msg) {
72840         LDKPublicKey node_id_ref;
72841         CHECK(node_id->arr_len == 33);
72842         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72843         LDKTxAddInput msg_conv;
72844         msg_conv.inner = untag_ptr(msg);
72845         msg_conv.is_owned = ptr_is_owned(msg);
72846         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72847         msg_conv = TxAddInput_clone(&msg_conv);
72848         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72849         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
72850         uint64_t ret_ref = tag_ptr(ret_copy, true);
72851         return ret_ref;
72852 }
72853
72854 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_output"))) TS_MessageSendEvent_send_tx_add_output(int8_tArray node_id, uint64_t msg) {
72855         LDKPublicKey node_id_ref;
72856         CHECK(node_id->arr_len == 33);
72857         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72858         LDKTxAddOutput msg_conv;
72859         msg_conv.inner = untag_ptr(msg);
72860         msg_conv.is_owned = ptr_is_owned(msg);
72861         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72862         msg_conv = TxAddOutput_clone(&msg_conv);
72863         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72864         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
72865         uint64_t ret_ref = tag_ptr(ret_copy, true);
72866         return ret_ref;
72867 }
72868
72869 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_input"))) TS_MessageSendEvent_send_tx_remove_input(int8_tArray node_id, uint64_t msg) {
72870         LDKPublicKey node_id_ref;
72871         CHECK(node_id->arr_len == 33);
72872         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72873         LDKTxRemoveInput msg_conv;
72874         msg_conv.inner = untag_ptr(msg);
72875         msg_conv.is_owned = ptr_is_owned(msg);
72876         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72877         msg_conv = TxRemoveInput_clone(&msg_conv);
72878         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72879         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
72880         uint64_t ret_ref = tag_ptr(ret_copy, true);
72881         return ret_ref;
72882 }
72883
72884 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_output"))) TS_MessageSendEvent_send_tx_remove_output(int8_tArray node_id, uint64_t msg) {
72885         LDKPublicKey node_id_ref;
72886         CHECK(node_id->arr_len == 33);
72887         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72888         LDKTxRemoveOutput msg_conv;
72889         msg_conv.inner = untag_ptr(msg);
72890         msg_conv.is_owned = ptr_is_owned(msg);
72891         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72892         msg_conv = TxRemoveOutput_clone(&msg_conv);
72893         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72894         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
72895         uint64_t ret_ref = tag_ptr(ret_copy, true);
72896         return ret_ref;
72897 }
72898
72899 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_complete"))) TS_MessageSendEvent_send_tx_complete(int8_tArray node_id, uint64_t msg) {
72900         LDKPublicKey node_id_ref;
72901         CHECK(node_id->arr_len == 33);
72902         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72903         LDKTxComplete msg_conv;
72904         msg_conv.inner = untag_ptr(msg);
72905         msg_conv.is_owned = ptr_is_owned(msg);
72906         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72907         msg_conv = TxComplete_clone(&msg_conv);
72908         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72909         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
72910         uint64_t ret_ref = tag_ptr(ret_copy, true);
72911         return ret_ref;
72912 }
72913
72914 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_signatures"))) TS_MessageSendEvent_send_tx_signatures(int8_tArray node_id, uint64_t msg) {
72915         LDKPublicKey node_id_ref;
72916         CHECK(node_id->arr_len == 33);
72917         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72918         LDKTxSignatures msg_conv;
72919         msg_conv.inner = untag_ptr(msg);
72920         msg_conv.is_owned = ptr_is_owned(msg);
72921         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72922         msg_conv = TxSignatures_clone(&msg_conv);
72923         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72924         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
72925         uint64_t ret_ref = tag_ptr(ret_copy, true);
72926         return ret_ref;
72927 }
72928
72929 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_init_rbf"))) TS_MessageSendEvent_send_tx_init_rbf(int8_tArray node_id, uint64_t msg) {
72930         LDKPublicKey node_id_ref;
72931         CHECK(node_id->arr_len == 33);
72932         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72933         LDKTxInitRbf msg_conv;
72934         msg_conv.inner = untag_ptr(msg);
72935         msg_conv.is_owned = ptr_is_owned(msg);
72936         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72937         msg_conv = TxInitRbf_clone(&msg_conv);
72938         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72939         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
72940         uint64_t ret_ref = tag_ptr(ret_copy, true);
72941         return ret_ref;
72942 }
72943
72944 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_ack_rbf"))) TS_MessageSendEvent_send_tx_ack_rbf(int8_tArray node_id, uint64_t msg) {
72945         LDKPublicKey node_id_ref;
72946         CHECK(node_id->arr_len == 33);
72947         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72948         LDKTxAckRbf msg_conv;
72949         msg_conv.inner = untag_ptr(msg);
72950         msg_conv.is_owned = ptr_is_owned(msg);
72951         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72952         msg_conv = TxAckRbf_clone(&msg_conv);
72953         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72954         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
72955         uint64_t ret_ref = tag_ptr(ret_copy, true);
72956         return ret_ref;
72957 }
72958
72959 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_abort"))) TS_MessageSendEvent_send_tx_abort(int8_tArray node_id, uint64_t msg) {
72960         LDKPublicKey node_id_ref;
72961         CHECK(node_id->arr_len == 33);
72962         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72963         LDKTxAbort msg_conv;
72964         msg_conv.inner = untag_ptr(msg);
72965         msg_conv.is_owned = ptr_is_owned(msg);
72966         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72967         msg_conv = TxAbort_clone(&msg_conv);
72968         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72969         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
72970         uint64_t ret_ref = tag_ptr(ret_copy, true);
72971         return ret_ref;
72972 }
72973
72974 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
72975         LDKPublicKey node_id_ref;
72976         CHECK(node_id->arr_len == 33);
72977         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72978         LDKChannelReady msg_conv;
72979         msg_conv.inner = untag_ptr(msg);
72980         msg_conv.is_owned = ptr_is_owned(msg);
72981         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72982         msg_conv = ChannelReady_clone(&msg_conv);
72983         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72984         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
72985         uint64_t ret_ref = tag_ptr(ret_copy, true);
72986         return ret_ref;
72987 }
72988
72989 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
72990         LDKPublicKey node_id_ref;
72991         CHECK(node_id->arr_len == 33);
72992         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72993         LDKAnnouncementSignatures msg_conv;
72994         msg_conv.inner = untag_ptr(msg);
72995         msg_conv.is_owned = ptr_is_owned(msg);
72996         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72997         msg_conv = AnnouncementSignatures_clone(&msg_conv);
72998         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72999         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
73000         uint64_t ret_ref = tag_ptr(ret_copy, true);
73001         return ret_ref;
73002 }
73003
73004 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
73005         LDKPublicKey node_id_ref;
73006         CHECK(node_id->arr_len == 33);
73007         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73008         LDKCommitmentUpdate updates_conv;
73009         updates_conv.inner = untag_ptr(updates);
73010         updates_conv.is_owned = ptr_is_owned(updates);
73011         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
73012         updates_conv = CommitmentUpdate_clone(&updates_conv);
73013         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73014         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
73015         uint64_t ret_ref = tag_ptr(ret_copy, true);
73016         return ret_ref;
73017 }
73018
73019 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
73020         LDKPublicKey node_id_ref;
73021         CHECK(node_id->arr_len == 33);
73022         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73023         LDKRevokeAndACK msg_conv;
73024         msg_conv.inner = untag_ptr(msg);
73025         msg_conv.is_owned = ptr_is_owned(msg);
73026         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73027         msg_conv = RevokeAndACK_clone(&msg_conv);
73028         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73029         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
73030         uint64_t ret_ref = tag_ptr(ret_copy, true);
73031         return ret_ref;
73032 }
73033
73034 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
73035         LDKPublicKey node_id_ref;
73036         CHECK(node_id->arr_len == 33);
73037         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73038         LDKClosingSigned msg_conv;
73039         msg_conv.inner = untag_ptr(msg);
73040         msg_conv.is_owned = ptr_is_owned(msg);
73041         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73042         msg_conv = ClosingSigned_clone(&msg_conv);
73043         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73044         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
73045         uint64_t ret_ref = tag_ptr(ret_copy, true);
73046         return ret_ref;
73047 }
73048
73049 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
73050         LDKPublicKey node_id_ref;
73051         CHECK(node_id->arr_len == 33);
73052         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73053         LDKShutdown msg_conv;
73054         msg_conv.inner = untag_ptr(msg);
73055         msg_conv.is_owned = ptr_is_owned(msg);
73056         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73057         msg_conv = Shutdown_clone(&msg_conv);
73058         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73059         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
73060         uint64_t ret_ref = tag_ptr(ret_copy, true);
73061         return ret_ref;
73062 }
73063
73064 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
73065         LDKPublicKey node_id_ref;
73066         CHECK(node_id->arr_len == 33);
73067         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73068         LDKChannelReestablish msg_conv;
73069         msg_conv.inner = untag_ptr(msg);
73070         msg_conv.is_owned = ptr_is_owned(msg);
73071         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73072         msg_conv = ChannelReestablish_clone(&msg_conv);
73073         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73074         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
73075         uint64_t ret_ref = tag_ptr(ret_copy, true);
73076         return ret_ref;
73077 }
73078
73079 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) {
73080         LDKPublicKey node_id_ref;
73081         CHECK(node_id->arr_len == 33);
73082         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73083         LDKChannelAnnouncement msg_conv;
73084         msg_conv.inner = untag_ptr(msg);
73085         msg_conv.is_owned = ptr_is_owned(msg);
73086         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73087         msg_conv = ChannelAnnouncement_clone(&msg_conv);
73088         LDKChannelUpdate update_msg_conv;
73089         update_msg_conv.inner = untag_ptr(update_msg);
73090         update_msg_conv.is_owned = ptr_is_owned(update_msg);
73091         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
73092         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
73093         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73094         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
73095         uint64_t ret_ref = tag_ptr(ret_copy, true);
73096         return ret_ref;
73097 }
73098
73099 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
73100         LDKChannelAnnouncement msg_conv;
73101         msg_conv.inner = untag_ptr(msg);
73102         msg_conv.is_owned = ptr_is_owned(msg);
73103         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73104         msg_conv = ChannelAnnouncement_clone(&msg_conv);
73105         LDKChannelUpdate update_msg_conv;
73106         update_msg_conv.inner = untag_ptr(update_msg);
73107         update_msg_conv.is_owned = ptr_is_owned(update_msg);
73108         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
73109         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
73110         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73111         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
73112         uint64_t ret_ref = tag_ptr(ret_copy, true);
73113         return ret_ref;
73114 }
73115
73116 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
73117         LDKChannelUpdate msg_conv;
73118         msg_conv.inner = untag_ptr(msg);
73119         msg_conv.is_owned = ptr_is_owned(msg);
73120         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73121         msg_conv = ChannelUpdate_clone(&msg_conv);
73122         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73123         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
73124         uint64_t ret_ref = tag_ptr(ret_copy, true);
73125         return ret_ref;
73126 }
73127
73128 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) {
73129         LDKNodeAnnouncement msg_conv;
73130         msg_conv.inner = untag_ptr(msg);
73131         msg_conv.is_owned = ptr_is_owned(msg);
73132         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73133         msg_conv = NodeAnnouncement_clone(&msg_conv);
73134         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73135         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
73136         uint64_t ret_ref = tag_ptr(ret_copy, true);
73137         return ret_ref;
73138 }
73139
73140 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
73141         LDKPublicKey node_id_ref;
73142         CHECK(node_id->arr_len == 33);
73143         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73144         LDKChannelUpdate msg_conv;
73145         msg_conv.inner = untag_ptr(msg);
73146         msg_conv.is_owned = ptr_is_owned(msg);
73147         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73148         msg_conv = ChannelUpdate_clone(&msg_conv);
73149         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73150         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
73151         uint64_t ret_ref = tag_ptr(ret_copy, true);
73152         return ret_ref;
73153 }
73154
73155 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
73156         LDKPublicKey node_id_ref;
73157         CHECK(node_id->arr_len == 33);
73158         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73159         void* action_ptr = untag_ptr(action);
73160         CHECK_ACCESS(action_ptr);
73161         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
73162         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
73163         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73164         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
73165         uint64_t ret_ref = tag_ptr(ret_copy, true);
73166         return ret_ref;
73167 }
73168
73169 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
73170         LDKPublicKey node_id_ref;
73171         CHECK(node_id->arr_len == 33);
73172         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73173         LDKQueryChannelRange msg_conv;
73174         msg_conv.inner = untag_ptr(msg);
73175         msg_conv.is_owned = ptr_is_owned(msg);
73176         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73177         msg_conv = QueryChannelRange_clone(&msg_conv);
73178         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73179         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
73180         uint64_t ret_ref = tag_ptr(ret_copy, true);
73181         return ret_ref;
73182 }
73183
73184 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
73185         LDKPublicKey node_id_ref;
73186         CHECK(node_id->arr_len == 33);
73187         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73188         LDKQueryShortChannelIds msg_conv;
73189         msg_conv.inner = untag_ptr(msg);
73190         msg_conv.is_owned = ptr_is_owned(msg);
73191         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73192         msg_conv = QueryShortChannelIds_clone(&msg_conv);
73193         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73194         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
73195         uint64_t ret_ref = tag_ptr(ret_copy, true);
73196         return ret_ref;
73197 }
73198
73199 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
73200         LDKPublicKey node_id_ref;
73201         CHECK(node_id->arr_len == 33);
73202         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73203         LDKReplyChannelRange msg_conv;
73204         msg_conv.inner = untag_ptr(msg);
73205         msg_conv.is_owned = ptr_is_owned(msg);
73206         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73207         msg_conv = ReplyChannelRange_clone(&msg_conv);
73208         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73209         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
73210         uint64_t ret_ref = tag_ptr(ret_copy, true);
73211         return ret_ref;
73212 }
73213
73214 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
73215         LDKPublicKey node_id_ref;
73216         CHECK(node_id->arr_len == 33);
73217         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73218         LDKGossipTimestampFilter msg_conv;
73219         msg_conv.inner = untag_ptr(msg);
73220         msg_conv.is_owned = ptr_is_owned(msg);
73221         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73222         msg_conv = GossipTimestampFilter_clone(&msg_conv);
73223         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73224         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
73225         uint64_t ret_ref = tag_ptr(ret_copy, true);
73226         return ret_ref;
73227 }
73228
73229 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
73230         if (!ptr_is_owned(this_ptr)) return;
73231         void* this_ptr_ptr = untag_ptr(this_ptr);
73232         CHECK_ACCESS(this_ptr_ptr);
73233         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
73234         FREE(untag_ptr(this_ptr));
73235         MessageSendEventsProvider_free(this_ptr_conv);
73236 }
73237
73238 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
73239         if (!ptr_is_owned(this_ptr)) return;
73240         void* this_ptr_ptr = untag_ptr(this_ptr);
73241         CHECK_ACCESS(this_ptr_ptr);
73242         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
73243         FREE(untag_ptr(this_ptr));
73244         EventsProvider_free(this_ptr_conv);
73245 }
73246
73247 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
73248         if (!ptr_is_owned(this_ptr)) return;
73249         void* this_ptr_ptr = untag_ptr(this_ptr);
73250         CHECK_ACCESS(this_ptr_ptr);
73251         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
73252         FREE(untag_ptr(this_ptr));
73253         EventHandler_free(this_ptr_conv);
73254 }
73255
73256 void  __attribute__((export_name("TS_AnchorDescriptor_free"))) TS_AnchorDescriptor_free(uint64_t this_obj) {
73257         LDKAnchorDescriptor this_obj_conv;
73258         this_obj_conv.inner = untag_ptr(this_obj);
73259         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73261         AnchorDescriptor_free(this_obj_conv);
73262 }
73263
73264 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_channel_derivation_parameters"))) TS_AnchorDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
73265         LDKAnchorDescriptor this_ptr_conv;
73266         this_ptr_conv.inner = untag_ptr(this_ptr);
73267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73269         this_ptr_conv.is_owned = false;
73270         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
73271         uint64_t ret_ref = 0;
73272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73274         return ret_ref;
73275 }
73276
73277 void  __attribute__((export_name("TS_AnchorDescriptor_set_channel_derivation_parameters"))) TS_AnchorDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
73278         LDKAnchorDescriptor this_ptr_conv;
73279         this_ptr_conv.inner = untag_ptr(this_ptr);
73280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73282         this_ptr_conv.is_owned = false;
73283         LDKChannelDerivationParameters val_conv;
73284         val_conv.inner = untag_ptr(val);
73285         val_conv.is_owned = ptr_is_owned(val);
73286         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73287         val_conv = ChannelDerivationParameters_clone(&val_conv);
73288         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
73289 }
73290
73291 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_outpoint"))) TS_AnchorDescriptor_get_outpoint(uint64_t this_ptr) {
73292         LDKAnchorDescriptor this_ptr_conv;
73293         this_ptr_conv.inner = untag_ptr(this_ptr);
73294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73296         this_ptr_conv.is_owned = false;
73297         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
73298         uint64_t ret_ref = 0;
73299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73301         return ret_ref;
73302 }
73303
73304 void  __attribute__((export_name("TS_AnchorDescriptor_set_outpoint"))) TS_AnchorDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
73305         LDKAnchorDescriptor this_ptr_conv;
73306         this_ptr_conv.inner = untag_ptr(this_ptr);
73307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73309         this_ptr_conv.is_owned = false;
73310         LDKOutPoint val_conv;
73311         val_conv.inner = untag_ptr(val);
73312         val_conv.is_owned = ptr_is_owned(val);
73313         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73314         val_conv = OutPoint_clone(&val_conv);
73315         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
73316 }
73317
73318 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_new"))) TS_AnchorDescriptor_new(uint64_t channel_derivation_parameters_arg, uint64_t outpoint_arg) {
73319         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
73320         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
73321         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
73322         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
73323         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
73324         LDKOutPoint outpoint_arg_conv;
73325         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
73326         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
73327         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
73328         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
73329         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
73330         uint64_t ret_ref = 0;
73331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73333         return ret_ref;
73334 }
73335
73336 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
73337         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
73338         uint64_t ret_ref = 0;
73339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73341         return ret_ref;
73342 }
73343 int64_t  __attribute__((export_name("TS_AnchorDescriptor_clone_ptr"))) TS_AnchorDescriptor_clone_ptr(uint64_t arg) {
73344         LDKAnchorDescriptor arg_conv;
73345         arg_conv.inner = untag_ptr(arg);
73346         arg_conv.is_owned = ptr_is_owned(arg);
73347         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73348         arg_conv.is_owned = false;
73349         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
73350         return ret_conv;
73351 }
73352
73353 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_clone"))) TS_AnchorDescriptor_clone(uint64_t orig) {
73354         LDKAnchorDescriptor orig_conv;
73355         orig_conv.inner = untag_ptr(orig);
73356         orig_conv.is_owned = ptr_is_owned(orig);
73357         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73358         orig_conv.is_owned = false;
73359         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
73360         uint64_t ret_ref = 0;
73361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73363         return ret_ref;
73364 }
73365
73366 jboolean  __attribute__((export_name("TS_AnchorDescriptor_eq"))) TS_AnchorDescriptor_eq(uint64_t a, uint64_t b) {
73367         LDKAnchorDescriptor a_conv;
73368         a_conv.inner = untag_ptr(a);
73369         a_conv.is_owned = ptr_is_owned(a);
73370         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73371         a_conv.is_owned = false;
73372         LDKAnchorDescriptor b_conv;
73373         b_conv.inner = untag_ptr(b);
73374         b_conv.is_owned = ptr_is_owned(b);
73375         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73376         b_conv.is_owned = false;
73377         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
73378         return ret_conv;
73379 }
73380
73381 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_previous_utxo"))) TS_AnchorDescriptor_previous_utxo(uint64_t this_arg) {
73382         LDKAnchorDescriptor this_arg_conv;
73383         this_arg_conv.inner = untag_ptr(this_arg);
73384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73386         this_arg_conv.is_owned = false;
73387         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
73388         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
73389         return tag_ptr(ret_ref, true);
73390 }
73391
73392 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_unsigned_tx_input"))) TS_AnchorDescriptor_unsigned_tx_input(uint64_t this_arg) {
73393         LDKAnchorDescriptor this_arg_conv;
73394         this_arg_conv.inner = untag_ptr(this_arg);
73395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73397         this_arg_conv.is_owned = false;
73398         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
73399         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
73400         return tag_ptr(ret_ref, true);
73401 }
73402
73403 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_witness_script"))) TS_AnchorDescriptor_witness_script(uint64_t this_arg) {
73404         LDKAnchorDescriptor this_arg_conv;
73405         this_arg_conv.inner = untag_ptr(this_arg);
73406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73408         this_arg_conv.is_owned = false;
73409         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
73410         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73411         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73412         CVec_u8Z_free(ret_var);
73413         return ret_arr;
73414 }
73415
73416 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_tx_input_witness"))) TS_AnchorDescriptor_tx_input_witness(uint64_t this_arg, int8_tArray signature) {
73417         LDKAnchorDescriptor this_arg_conv;
73418         this_arg_conv.inner = untag_ptr(this_arg);
73419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73421         this_arg_conv.is_owned = false;
73422         LDKECDSASignature signature_ref;
73423         CHECK(signature->arr_len == 64);
73424         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
73425         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
73426         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73427         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73428         Witness_free(ret_var);
73429         return ret_arr;
73430 }
73431
73432 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_derive_channel_signer"))) TS_AnchorDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
73433         LDKAnchorDescriptor this_arg_conv;
73434         this_arg_conv.inner = untag_ptr(this_arg);
73435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73437         this_arg_conv.is_owned = false;
73438         void* signer_provider_ptr = untag_ptr(signer_provider);
73439         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
73440         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
73441         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
73442         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
73443         return tag_ptr(ret_ret, true);
73444 }
73445
73446 void  __attribute__((export_name("TS_BumpTransactionEvent_free"))) TS_BumpTransactionEvent_free(uint64_t this_ptr) {
73447         if (!ptr_is_owned(this_ptr)) return;
73448         void* this_ptr_ptr = untag_ptr(this_ptr);
73449         CHECK_ACCESS(this_ptr_ptr);
73450         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
73451         FREE(untag_ptr(this_ptr));
73452         BumpTransactionEvent_free(this_ptr_conv);
73453 }
73454
73455 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
73456         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
73457         *ret_copy = BumpTransactionEvent_clone(arg);
73458         uint64_t ret_ref = tag_ptr(ret_copy, true);
73459         return ret_ref;
73460 }
73461 int64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone_ptr"))) TS_BumpTransactionEvent_clone_ptr(uint64_t arg) {
73462         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
73463         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
73464         return ret_conv;
73465 }
73466
73467 uint64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone"))) TS_BumpTransactionEvent_clone(uint64_t orig) {
73468         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
73469         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
73470         *ret_copy = BumpTransactionEvent_clone(orig_conv);
73471         uint64_t ret_ref = tag_ptr(ret_copy, true);
73472         return ret_ref;
73473 }
73474
73475 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) {
73476         LDKThirtyTwoBytes claim_id_ref;
73477         CHECK(claim_id->arr_len == 32);
73478         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
73479         LDKTransaction commitment_tx_ref;
73480         commitment_tx_ref.datalen = commitment_tx->arr_len;
73481         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
73482         memcpy(commitment_tx_ref.data, commitment_tx->elems, commitment_tx_ref.datalen); FREE(commitment_tx);
73483         commitment_tx_ref.data_is_owned = true;
73484         LDKAnchorDescriptor anchor_descriptor_conv;
73485         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
73486         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
73487         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
73488         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
73489         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
73490         pending_htlcs_constr.datalen = pending_htlcs->arr_len;
73491         if (pending_htlcs_constr.datalen > 0)
73492                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
73493         else
73494                 pending_htlcs_constr.data = NULL;
73495         uint64_t* pending_htlcs_vals = pending_htlcs->elems;
73496         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
73497                 uint64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
73498                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
73499                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
73500                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
73501                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
73502                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
73503                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
73504         }
73505         FREE(pending_htlcs);
73506         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
73507         *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);
73508         uint64_t ret_ref = tag_ptr(ret_copy, true);
73509         return ret_ref;
73510 }
73511
73512 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) {
73513         LDKThirtyTwoBytes claim_id_ref;
73514         CHECK(claim_id->arr_len == 32);
73515         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
73516         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
73517         htlc_descriptors_constr.datalen = htlc_descriptors->arr_len;
73518         if (htlc_descriptors_constr.datalen > 0)
73519                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
73520         else
73521                 htlc_descriptors_constr.data = NULL;
73522         uint64_t* htlc_descriptors_vals = htlc_descriptors->elems;
73523         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
73524                 uint64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
73525                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
73526                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
73527                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
73528                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
73529                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
73530                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
73531         }
73532         FREE(htlc_descriptors);
73533         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
73534         *ret_copy = BumpTransactionEvent_htlcresolution(claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
73535         uint64_t ret_ref = tag_ptr(ret_copy, true);
73536         return ret_ref;
73537 }
73538
73539 jboolean  __attribute__((export_name("TS_BumpTransactionEvent_eq"))) TS_BumpTransactionEvent_eq(uint64_t a, uint64_t b) {
73540         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
73541         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
73542         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
73543         return ret_conv;
73544 }
73545
73546 void  __attribute__((export_name("TS_Input_free"))) TS_Input_free(uint64_t this_obj) {
73547         LDKInput this_obj_conv;
73548         this_obj_conv.inner = untag_ptr(this_obj);
73549         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73551         Input_free(this_obj_conv);
73552 }
73553
73554 uint64_t  __attribute__((export_name("TS_Input_get_outpoint"))) TS_Input_get_outpoint(uint64_t this_ptr) {
73555         LDKInput this_ptr_conv;
73556         this_ptr_conv.inner = untag_ptr(this_ptr);
73557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73559         this_ptr_conv.is_owned = false;
73560         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
73561         uint64_t ret_ref = 0;
73562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73564         return ret_ref;
73565 }
73566
73567 void  __attribute__((export_name("TS_Input_set_outpoint"))) TS_Input_set_outpoint(uint64_t this_ptr, uint64_t val) {
73568         LDKInput this_ptr_conv;
73569         this_ptr_conv.inner = untag_ptr(this_ptr);
73570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73572         this_ptr_conv.is_owned = false;
73573         LDKOutPoint val_conv;
73574         val_conv.inner = untag_ptr(val);
73575         val_conv.is_owned = ptr_is_owned(val);
73576         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73577         val_conv = OutPoint_clone(&val_conv);
73578         Input_set_outpoint(&this_ptr_conv, val_conv);
73579 }
73580
73581 uint64_t  __attribute__((export_name("TS_Input_get_previous_utxo"))) TS_Input_get_previous_utxo(uint64_t this_ptr) {
73582         LDKInput this_ptr_conv;
73583         this_ptr_conv.inner = untag_ptr(this_ptr);
73584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73586         this_ptr_conv.is_owned = false;
73587         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
73588         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
73589         return tag_ptr(ret_ref, true);
73590 }
73591
73592 void  __attribute__((export_name("TS_Input_set_previous_utxo"))) TS_Input_set_previous_utxo(uint64_t this_ptr, uint64_t val) {
73593         LDKInput this_ptr_conv;
73594         this_ptr_conv.inner = untag_ptr(this_ptr);
73595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73597         this_ptr_conv.is_owned = false;
73598         void* val_ptr = untag_ptr(val);
73599         CHECK_ACCESS(val_ptr);
73600         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
73601         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
73602         Input_set_previous_utxo(&this_ptr_conv, val_conv);
73603 }
73604
73605 int64_t  __attribute__((export_name("TS_Input_get_satisfaction_weight"))) TS_Input_get_satisfaction_weight(uint64_t this_ptr) {
73606         LDKInput this_ptr_conv;
73607         this_ptr_conv.inner = untag_ptr(this_ptr);
73608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73610         this_ptr_conv.is_owned = false;
73611         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
73612         return ret_conv;
73613 }
73614
73615 void  __attribute__((export_name("TS_Input_set_satisfaction_weight"))) TS_Input_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
73616         LDKInput this_ptr_conv;
73617         this_ptr_conv.inner = untag_ptr(this_ptr);
73618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73620         this_ptr_conv.is_owned = false;
73621         Input_set_satisfaction_weight(&this_ptr_conv, val);
73622 }
73623
73624 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) {
73625         LDKOutPoint outpoint_arg_conv;
73626         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
73627         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
73628         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
73629         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
73630         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
73631         CHECK_ACCESS(previous_utxo_arg_ptr);
73632         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
73633         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
73634         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
73635         uint64_t ret_ref = 0;
73636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73638         return ret_ref;
73639 }
73640
73641 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
73642         LDKInput ret_var = Input_clone(arg);
73643         uint64_t ret_ref = 0;
73644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73646         return ret_ref;
73647 }
73648 int64_t  __attribute__((export_name("TS_Input_clone_ptr"))) TS_Input_clone_ptr(uint64_t arg) {
73649         LDKInput arg_conv;
73650         arg_conv.inner = untag_ptr(arg);
73651         arg_conv.is_owned = ptr_is_owned(arg);
73652         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73653         arg_conv.is_owned = false;
73654         int64_t ret_conv = Input_clone_ptr(&arg_conv);
73655         return ret_conv;
73656 }
73657
73658 uint64_t  __attribute__((export_name("TS_Input_clone"))) TS_Input_clone(uint64_t orig) {
73659         LDKInput orig_conv;
73660         orig_conv.inner = untag_ptr(orig);
73661         orig_conv.is_owned = ptr_is_owned(orig);
73662         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73663         orig_conv.is_owned = false;
73664         LDKInput ret_var = Input_clone(&orig_conv);
73665         uint64_t ret_ref = 0;
73666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73668         return ret_ref;
73669 }
73670
73671 int64_t  __attribute__((export_name("TS_Input_hash"))) TS_Input_hash(uint64_t o) {
73672         LDKInput o_conv;
73673         o_conv.inner = untag_ptr(o);
73674         o_conv.is_owned = ptr_is_owned(o);
73675         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73676         o_conv.is_owned = false;
73677         int64_t ret_conv = Input_hash(&o_conv);
73678         return ret_conv;
73679 }
73680
73681 jboolean  __attribute__((export_name("TS_Input_eq"))) TS_Input_eq(uint64_t a, uint64_t b) {
73682         LDKInput a_conv;
73683         a_conv.inner = untag_ptr(a);
73684         a_conv.is_owned = ptr_is_owned(a);
73685         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73686         a_conv.is_owned = false;
73687         LDKInput b_conv;
73688         b_conv.inner = untag_ptr(b);
73689         b_conv.is_owned = ptr_is_owned(b);
73690         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73691         b_conv.is_owned = false;
73692         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
73693         return ret_conv;
73694 }
73695
73696 void  __attribute__((export_name("TS_Utxo_free"))) TS_Utxo_free(uint64_t this_obj) {
73697         LDKUtxo this_obj_conv;
73698         this_obj_conv.inner = untag_ptr(this_obj);
73699         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73701         Utxo_free(this_obj_conv);
73702 }
73703
73704 uint64_t  __attribute__((export_name("TS_Utxo_get_outpoint"))) TS_Utxo_get_outpoint(uint64_t this_ptr) {
73705         LDKUtxo this_ptr_conv;
73706         this_ptr_conv.inner = untag_ptr(this_ptr);
73707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73709         this_ptr_conv.is_owned = false;
73710         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
73711         uint64_t ret_ref = 0;
73712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73714         return ret_ref;
73715 }
73716
73717 void  __attribute__((export_name("TS_Utxo_set_outpoint"))) TS_Utxo_set_outpoint(uint64_t this_ptr, uint64_t val) {
73718         LDKUtxo this_ptr_conv;
73719         this_ptr_conv.inner = untag_ptr(this_ptr);
73720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73722         this_ptr_conv.is_owned = false;
73723         LDKOutPoint val_conv;
73724         val_conv.inner = untag_ptr(val);
73725         val_conv.is_owned = ptr_is_owned(val);
73726         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73727         val_conv = OutPoint_clone(&val_conv);
73728         Utxo_set_outpoint(&this_ptr_conv, val_conv);
73729 }
73730
73731 uint64_t  __attribute__((export_name("TS_Utxo_get_output"))) TS_Utxo_get_output(uint64_t this_ptr) {
73732         LDKUtxo this_ptr_conv;
73733         this_ptr_conv.inner = untag_ptr(this_ptr);
73734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73736         this_ptr_conv.is_owned = false;
73737         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
73738         *ret_ref = Utxo_get_output(&this_ptr_conv);
73739         return tag_ptr(ret_ref, true);
73740 }
73741
73742 void  __attribute__((export_name("TS_Utxo_set_output"))) TS_Utxo_set_output(uint64_t this_ptr, uint64_t val) {
73743         LDKUtxo this_ptr_conv;
73744         this_ptr_conv.inner = untag_ptr(this_ptr);
73745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73747         this_ptr_conv.is_owned = false;
73748         void* val_ptr = untag_ptr(val);
73749         CHECK_ACCESS(val_ptr);
73750         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
73751         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
73752         Utxo_set_output(&this_ptr_conv, val_conv);
73753 }
73754
73755 int64_t  __attribute__((export_name("TS_Utxo_get_satisfaction_weight"))) TS_Utxo_get_satisfaction_weight(uint64_t this_ptr) {
73756         LDKUtxo this_ptr_conv;
73757         this_ptr_conv.inner = untag_ptr(this_ptr);
73758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73760         this_ptr_conv.is_owned = false;
73761         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
73762         return ret_conv;
73763 }
73764
73765 void  __attribute__((export_name("TS_Utxo_set_satisfaction_weight"))) TS_Utxo_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
73766         LDKUtxo this_ptr_conv;
73767         this_ptr_conv.inner = untag_ptr(this_ptr);
73768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73770         this_ptr_conv.is_owned = false;
73771         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
73772 }
73773
73774 uint64_t  __attribute__((export_name("TS_Utxo_new"))) TS_Utxo_new(uint64_t outpoint_arg, uint64_t output_arg, int64_t satisfaction_weight_arg) {
73775         LDKOutPoint outpoint_arg_conv;
73776         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
73777         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
73778         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
73779         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
73780         void* output_arg_ptr = untag_ptr(output_arg);
73781         CHECK_ACCESS(output_arg_ptr);
73782         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
73783         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
73784         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
73785         uint64_t ret_ref = 0;
73786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73788         return ret_ref;
73789 }
73790
73791 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
73792         LDKUtxo ret_var = Utxo_clone(arg);
73793         uint64_t ret_ref = 0;
73794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73796         return ret_ref;
73797 }
73798 int64_t  __attribute__((export_name("TS_Utxo_clone_ptr"))) TS_Utxo_clone_ptr(uint64_t arg) {
73799         LDKUtxo arg_conv;
73800         arg_conv.inner = untag_ptr(arg);
73801         arg_conv.is_owned = ptr_is_owned(arg);
73802         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73803         arg_conv.is_owned = false;
73804         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
73805         return ret_conv;
73806 }
73807
73808 uint64_t  __attribute__((export_name("TS_Utxo_clone"))) TS_Utxo_clone(uint64_t orig) {
73809         LDKUtxo orig_conv;
73810         orig_conv.inner = untag_ptr(orig);
73811         orig_conv.is_owned = ptr_is_owned(orig);
73812         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73813         orig_conv.is_owned = false;
73814         LDKUtxo ret_var = Utxo_clone(&orig_conv);
73815         uint64_t ret_ref = 0;
73816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73818         return ret_ref;
73819 }
73820
73821 int64_t  __attribute__((export_name("TS_Utxo_hash"))) TS_Utxo_hash(uint64_t o) {
73822         LDKUtxo o_conv;
73823         o_conv.inner = untag_ptr(o);
73824         o_conv.is_owned = ptr_is_owned(o);
73825         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73826         o_conv.is_owned = false;
73827         int64_t ret_conv = Utxo_hash(&o_conv);
73828         return ret_conv;
73829 }
73830
73831 jboolean  __attribute__((export_name("TS_Utxo_eq"))) TS_Utxo_eq(uint64_t a, uint64_t b) {
73832         LDKUtxo a_conv;
73833         a_conv.inner = untag_ptr(a);
73834         a_conv.is_owned = ptr_is_owned(a);
73835         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73836         a_conv.is_owned = false;
73837         LDKUtxo b_conv;
73838         b_conv.inner = untag_ptr(b);
73839         b_conv.is_owned = ptr_is_owned(b);
73840         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73841         b_conv.is_owned = false;
73842         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
73843         return ret_conv;
73844 }
73845
73846 uint64_t  __attribute__((export_name("TS_Utxo_new_p2pkh"))) TS_Utxo_new_p2pkh(uint64_t outpoint, int64_t value, int8_tArray pubkey_hash) {
73847         LDKOutPoint outpoint_conv;
73848         outpoint_conv.inner = untag_ptr(outpoint);
73849         outpoint_conv.is_owned = ptr_is_owned(outpoint);
73850         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
73851         outpoint_conv = OutPoint_clone(&outpoint_conv);
73852         uint8_t pubkey_hash_arr[20];
73853         CHECK(pubkey_hash->arr_len == 20);
73854         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
73855         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
73856         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
73857         uint64_t ret_ref = 0;
73858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73860         return ret_ref;
73861 }
73862
73863 void  __attribute__((export_name("TS_CoinSelection_free"))) TS_CoinSelection_free(uint64_t this_obj) {
73864         LDKCoinSelection this_obj_conv;
73865         this_obj_conv.inner = untag_ptr(this_obj);
73866         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73868         CoinSelection_free(this_obj_conv);
73869 }
73870
73871 uint64_tArray  __attribute__((export_name("TS_CoinSelection_get_confirmed_utxos"))) TS_CoinSelection_get_confirmed_utxos(uint64_t this_ptr) {
73872         LDKCoinSelection this_ptr_conv;
73873         this_ptr_conv.inner = untag_ptr(this_ptr);
73874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73876         this_ptr_conv.is_owned = false;
73877         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
73878         uint64_tArray ret_arr = NULL;
73879         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
73880         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
73881         for (size_t g = 0; g < ret_var.datalen; g++) {
73882                 LDKUtxo ret_conv_6_var = ret_var.data[g];
73883                 uint64_t ret_conv_6_ref = 0;
73884                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
73885                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
73886                 ret_arr_ptr[g] = ret_conv_6_ref;
73887         }
73888         
73889         FREE(ret_var.data);
73890         return ret_arr;
73891 }
73892
73893 void  __attribute__((export_name("TS_CoinSelection_set_confirmed_utxos"))) TS_CoinSelection_set_confirmed_utxos(uint64_t this_ptr, uint64_tArray val) {
73894         LDKCoinSelection this_ptr_conv;
73895         this_ptr_conv.inner = untag_ptr(this_ptr);
73896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73898         this_ptr_conv.is_owned = false;
73899         LDKCVec_UtxoZ val_constr;
73900         val_constr.datalen = val->arr_len;
73901         if (val_constr.datalen > 0)
73902                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
73903         else
73904                 val_constr.data = NULL;
73905         uint64_t* val_vals = val->elems;
73906         for (size_t g = 0; g < val_constr.datalen; g++) {
73907                 uint64_t val_conv_6 = val_vals[g];
73908                 LDKUtxo val_conv_6_conv;
73909                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
73910                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
73911                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
73912                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
73913                 val_constr.data[g] = val_conv_6_conv;
73914         }
73915         FREE(val);
73916         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
73917 }
73918
73919 uint64_t  __attribute__((export_name("TS_CoinSelection_get_change_output"))) TS_CoinSelection_get_change_output(uint64_t this_ptr) {
73920         LDKCoinSelection this_ptr_conv;
73921         this_ptr_conv.inner = untag_ptr(this_ptr);
73922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73924         this_ptr_conv.is_owned = false;
73925         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
73926         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
73927         uint64_t ret_ref = tag_ptr(ret_copy, true);
73928         return ret_ref;
73929 }
73930
73931 void  __attribute__((export_name("TS_CoinSelection_set_change_output"))) TS_CoinSelection_set_change_output(uint64_t this_ptr, uint64_t val) {
73932         LDKCoinSelection this_ptr_conv;
73933         this_ptr_conv.inner = untag_ptr(this_ptr);
73934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73936         this_ptr_conv.is_owned = false;
73937         void* val_ptr = untag_ptr(val);
73938         CHECK_ACCESS(val_ptr);
73939         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
73940         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
73941         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
73942 }
73943
73944 uint64_t  __attribute__((export_name("TS_CoinSelection_new"))) TS_CoinSelection_new(uint64_tArray confirmed_utxos_arg, uint64_t change_output_arg) {
73945         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
73946         confirmed_utxos_arg_constr.datalen = confirmed_utxos_arg->arr_len;
73947         if (confirmed_utxos_arg_constr.datalen > 0)
73948                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
73949         else
73950                 confirmed_utxos_arg_constr.data = NULL;
73951         uint64_t* confirmed_utxos_arg_vals = confirmed_utxos_arg->elems;
73952         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
73953                 uint64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
73954                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
73955                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
73956                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
73957                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
73958                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
73959                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
73960         }
73961         FREE(confirmed_utxos_arg);
73962         void* change_output_arg_ptr = untag_ptr(change_output_arg);
73963         CHECK_ACCESS(change_output_arg_ptr);
73964         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
73965         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
73966         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
73967         uint64_t ret_ref = 0;
73968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73970         return ret_ref;
73971 }
73972
73973 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
73974         LDKCoinSelection ret_var = CoinSelection_clone(arg);
73975         uint64_t ret_ref = 0;
73976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73978         return ret_ref;
73979 }
73980 int64_t  __attribute__((export_name("TS_CoinSelection_clone_ptr"))) TS_CoinSelection_clone_ptr(uint64_t arg) {
73981         LDKCoinSelection arg_conv;
73982         arg_conv.inner = untag_ptr(arg);
73983         arg_conv.is_owned = ptr_is_owned(arg);
73984         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73985         arg_conv.is_owned = false;
73986         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
73987         return ret_conv;
73988 }
73989
73990 uint64_t  __attribute__((export_name("TS_CoinSelection_clone"))) TS_CoinSelection_clone(uint64_t orig) {
73991         LDKCoinSelection orig_conv;
73992         orig_conv.inner = untag_ptr(orig);
73993         orig_conv.is_owned = ptr_is_owned(orig);
73994         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73995         orig_conv.is_owned = false;
73996         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
73997         uint64_t ret_ref = 0;
73998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74000         return ret_ref;
74001 }
74002
74003 void  __attribute__((export_name("TS_CoinSelectionSource_free"))) TS_CoinSelectionSource_free(uint64_t this_ptr) {
74004         if (!ptr_is_owned(this_ptr)) return;
74005         void* this_ptr_ptr = untag_ptr(this_ptr);
74006         CHECK_ACCESS(this_ptr_ptr);
74007         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
74008         FREE(untag_ptr(this_ptr));
74009         CoinSelectionSource_free(this_ptr_conv);
74010 }
74011
74012 void  __attribute__((export_name("TS_WalletSource_free"))) TS_WalletSource_free(uint64_t this_ptr) {
74013         if (!ptr_is_owned(this_ptr)) return;
74014         void* this_ptr_ptr = untag_ptr(this_ptr);
74015         CHECK_ACCESS(this_ptr_ptr);
74016         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
74017         FREE(untag_ptr(this_ptr));
74018         WalletSource_free(this_ptr_conv);
74019 }
74020
74021 void  __attribute__((export_name("TS_Wallet_free"))) TS_Wallet_free(uint64_t this_obj) {
74022         LDKWallet this_obj_conv;
74023         this_obj_conv.inner = untag_ptr(this_obj);
74024         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74026         Wallet_free(this_obj_conv);
74027 }
74028
74029 uint64_t  __attribute__((export_name("TS_Wallet_new"))) TS_Wallet_new(uint64_t source, uint64_t logger) {
74030         void* source_ptr = untag_ptr(source);
74031         CHECK_ACCESS(source_ptr);
74032         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
74033         if (source_conv.free == LDKWalletSource_JCalls_free) {
74034                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74035                 LDKWalletSource_JCalls_cloned(&source_conv);
74036         }
74037         void* logger_ptr = untag_ptr(logger);
74038         CHECK_ACCESS(logger_ptr);
74039         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
74040         if (logger_conv.free == LDKLogger_JCalls_free) {
74041                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74042                 LDKLogger_JCalls_cloned(&logger_conv);
74043         }
74044         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
74045         uint64_t ret_ref = 0;
74046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74048         return ret_ref;
74049 }
74050
74051 uint64_t  __attribute__((export_name("TS_Wallet_as_CoinSelectionSource"))) TS_Wallet_as_CoinSelectionSource(uint64_t this_arg) {
74052         LDKWallet this_arg_conv;
74053         this_arg_conv.inner = untag_ptr(this_arg);
74054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74056         this_arg_conv.is_owned = false;
74057         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
74058         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
74059         return tag_ptr(ret_ret, true);
74060 }
74061
74062 void  __attribute__((export_name("TS_BumpTransactionEventHandler_free"))) TS_BumpTransactionEventHandler_free(uint64_t this_obj) {
74063         LDKBumpTransactionEventHandler this_obj_conv;
74064         this_obj_conv.inner = untag_ptr(this_obj);
74065         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74067         BumpTransactionEventHandler_free(this_obj_conv);
74068 }
74069
74070 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) {
74071         void* broadcaster_ptr = untag_ptr(broadcaster);
74072         CHECK_ACCESS(broadcaster_ptr);
74073         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
74074         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
74075                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74076                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
74077         }
74078         void* utxo_source_ptr = untag_ptr(utxo_source);
74079         CHECK_ACCESS(utxo_source_ptr);
74080         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
74081         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
74082                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74083                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
74084         }
74085         void* signer_provider_ptr = untag_ptr(signer_provider);
74086         CHECK_ACCESS(signer_provider_ptr);
74087         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
74088         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
74089                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74090                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
74091         }
74092         void* logger_ptr = untag_ptr(logger);
74093         CHECK_ACCESS(logger_ptr);
74094         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
74095         if (logger_conv.free == LDKLogger_JCalls_free) {
74096                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74097                 LDKLogger_JCalls_cloned(&logger_conv);
74098         }
74099         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
74100         uint64_t ret_ref = 0;
74101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74103         return ret_ref;
74104 }
74105
74106 void  __attribute__((export_name("TS_BumpTransactionEventHandler_handle_event"))) TS_BumpTransactionEventHandler_handle_event(uint64_t this_arg, uint64_t event) {
74107         LDKBumpTransactionEventHandler this_arg_conv;
74108         this_arg_conv.inner = untag_ptr(this_arg);
74109         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74111         this_arg_conv.is_owned = false;
74112         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
74113         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
74114 }
74115
74116 void  __attribute__((export_name("TS_GossipSync_free"))) TS_GossipSync_free(uint64_t this_ptr) {
74117         if (!ptr_is_owned(this_ptr)) return;
74118         void* this_ptr_ptr = untag_ptr(this_ptr);
74119         CHECK_ACCESS(this_ptr_ptr);
74120         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
74121         FREE(untag_ptr(this_ptr));
74122         GossipSync_free(this_ptr_conv);
74123 }
74124
74125 uint64_t  __attribute__((export_name("TS_GossipSync_p2_p"))) TS_GossipSync_p2_p(uint64_t a) {
74126         LDKP2PGossipSync a_conv;
74127         a_conv.inner = untag_ptr(a);
74128         a_conv.is_owned = ptr_is_owned(a);
74129         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74130         a_conv.is_owned = false;
74131         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
74132         *ret_copy = GossipSync_p2_p(&a_conv);
74133         uint64_t ret_ref = tag_ptr(ret_copy, true);
74134         return ret_ref;
74135 }
74136
74137 uint64_t  __attribute__((export_name("TS_GossipSync_rapid"))) TS_GossipSync_rapid(uint64_t a) {
74138         LDKRapidGossipSync a_conv;
74139         a_conv.inner = untag_ptr(a);
74140         a_conv.is_owned = ptr_is_owned(a);
74141         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74142         a_conv.is_owned = false;
74143         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
74144         *ret_copy = GossipSync_rapid(&a_conv);
74145         uint64_t ret_ref = tag_ptr(ret_copy, true);
74146         return ret_ref;
74147 }
74148
74149 uint64_t  __attribute__((export_name("TS_GossipSync_none"))) TS_GossipSync_none() {
74150         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
74151         *ret_copy = GossipSync_none();
74152         uint64_t ret_ref = tag_ptr(ret_copy, true);
74153         return ret_ref;
74154 }
74155
74156 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
74157         if (!ptr_is_owned(this_ptr)) return;
74158         void* this_ptr_ptr = untag_ptr(this_ptr);
74159         CHECK_ACCESS(this_ptr_ptr);
74160         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
74161         FREE(untag_ptr(this_ptr));
74162         GraphSyncError_free(this_ptr_conv);
74163 }
74164
74165 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
74166         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
74167         *ret_copy = GraphSyncError_clone(arg);
74168         uint64_t ret_ref = tag_ptr(ret_copy, true);
74169         return ret_ref;
74170 }
74171 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
74172         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
74173         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
74174         return ret_conv;
74175 }
74176
74177 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
74178         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
74179         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
74180         *ret_copy = GraphSyncError_clone(orig_conv);
74181         uint64_t ret_ref = tag_ptr(ret_copy, true);
74182         return ret_ref;
74183 }
74184
74185 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
74186         void* a_ptr = untag_ptr(a);
74187         CHECK_ACCESS(a_ptr);
74188         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
74189         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
74190         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
74191         *ret_copy = GraphSyncError_decode_error(a_conv);
74192         uint64_t ret_ref = tag_ptr(ret_copy, true);
74193         return ret_ref;
74194 }
74195
74196 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
74197         LDKLightningError a_conv;
74198         a_conv.inner = untag_ptr(a);
74199         a_conv.is_owned = ptr_is_owned(a);
74200         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74201         a_conv = LightningError_clone(&a_conv);
74202         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
74203         *ret_copy = GraphSyncError_lightning_error(a_conv);
74204         uint64_t ret_ref = tag_ptr(ret_copy, true);
74205         return ret_ref;
74206 }
74207
74208 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
74209         LDKRapidGossipSync this_obj_conv;
74210         this_obj_conv.inner = untag_ptr(this_obj);
74211         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74213         RapidGossipSync_free(this_obj_conv);
74214 }
74215
74216 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph, uint64_t logger) {
74217         LDKNetworkGraph network_graph_conv;
74218         network_graph_conv.inner = untag_ptr(network_graph);
74219         network_graph_conv.is_owned = ptr_is_owned(network_graph);
74220         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
74221         network_graph_conv.is_owned = false;
74222         void* logger_ptr = untag_ptr(logger);
74223         CHECK_ACCESS(logger_ptr);
74224         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
74225         if (logger_conv.free == LDKLogger_JCalls_free) {
74226                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74227                 LDKLogger_JCalls_cloned(&logger_conv);
74228         }
74229         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
74230         uint64_t ret_ref = 0;
74231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74233         return ret_ref;
74234 }
74235
74236 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) {
74237         LDKRapidGossipSync this_arg_conv;
74238         this_arg_conv.inner = untag_ptr(this_arg);
74239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74241         this_arg_conv.is_owned = false;
74242         LDKu8slice update_data_ref;
74243         update_data_ref.datalen = update_data->arr_len;
74244         update_data_ref.data = update_data->elems;
74245         void* current_time_unix_ptr = untag_ptr(current_time_unix);
74246         CHECK_ACCESS(current_time_unix_ptr);
74247         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
74248         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
74249         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
74250         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
74251         FREE(update_data);
74252         return tag_ptr(ret_conv, true);
74253 }
74254
74255 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
74256         LDKRapidGossipSync this_arg_conv;
74257         this_arg_conv.inner = untag_ptr(this_arg);
74258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74260         this_arg_conv.is_owned = false;
74261         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
74262         return ret_conv;
74263 }
74264
74265 void  __attribute__((export_name("TS_Bolt11ParseError_free"))) TS_Bolt11ParseError_free(uint64_t this_ptr) {
74266         if (!ptr_is_owned(this_ptr)) return;
74267         void* this_ptr_ptr = untag_ptr(this_ptr);
74268         CHECK_ACCESS(this_ptr_ptr);
74269         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
74270         FREE(untag_ptr(this_ptr));
74271         Bolt11ParseError_free(this_ptr_conv);
74272 }
74273
74274 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
74275         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74276         *ret_copy = Bolt11ParseError_clone(arg);
74277         uint64_t ret_ref = tag_ptr(ret_copy, true);
74278         return ret_ref;
74279 }
74280 int64_t  __attribute__((export_name("TS_Bolt11ParseError_clone_ptr"))) TS_Bolt11ParseError_clone_ptr(uint64_t arg) {
74281         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
74282         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
74283         return ret_conv;
74284 }
74285
74286 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_clone"))) TS_Bolt11ParseError_clone(uint64_t orig) {
74287         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
74288         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74289         *ret_copy = Bolt11ParseError_clone(orig_conv);
74290         uint64_t ret_ref = tag_ptr(ret_copy, true);
74291         return ret_ref;
74292 }
74293
74294 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bech32_error"))) TS_Bolt11ParseError_bech32_error(uint64_t a) {
74295         void* a_ptr = untag_ptr(a);
74296         CHECK_ACCESS(a_ptr);
74297         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
74298         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
74299         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74300         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
74301         uint64_t ret_ref = tag_ptr(ret_copy, true);
74302         return ret_ref;
74303 }
74304
74305 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_parse_amount_error"))) TS_Bolt11ParseError_parse_amount_error(int32_t a) {
74306         
74307         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74308         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
74309         uint64_t ret_ref = tag_ptr(ret_copy, true);
74310         return ret_ref;
74311 }
74312
74313 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_signature"))) TS_Bolt11ParseError_malformed_signature(uint32_t a) {
74314         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
74315         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74316         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
74317         uint64_t ret_ref = tag_ptr(ret_copy, true);
74318         return ret_ref;
74319 }
74320
74321 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bad_prefix"))) TS_Bolt11ParseError_bad_prefix() {
74322         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74323         *ret_copy = Bolt11ParseError_bad_prefix();
74324         uint64_t ret_ref = tag_ptr(ret_copy, true);
74325         return ret_ref;
74326 }
74327
74328 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_currency"))) TS_Bolt11ParseError_unknown_currency() {
74329         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74330         *ret_copy = Bolt11ParseError_unknown_currency();
74331         uint64_t ret_ref = tag_ptr(ret_copy, true);
74332         return ret_ref;
74333 }
74334
74335 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_si_prefix"))) TS_Bolt11ParseError_unknown_si_prefix() {
74336         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74337         *ret_copy = Bolt11ParseError_unknown_si_prefix();
74338         uint64_t ret_ref = tag_ptr(ret_copy, true);
74339         return ret_ref;
74340 }
74341
74342 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_hrp"))) TS_Bolt11ParseError_malformed_hrp() {
74343         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74344         *ret_copy = Bolt11ParseError_malformed_hrp();
74345         uint64_t ret_ref = tag_ptr(ret_copy, true);
74346         return ret_ref;
74347 }
74348
74349 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_too_short_data_part"))) TS_Bolt11ParseError_too_short_data_part() {
74350         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74351         *ret_copy = Bolt11ParseError_too_short_data_part();
74352         uint64_t ret_ref = tag_ptr(ret_copy, true);
74353         return ret_ref;
74354 }
74355
74356 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unexpected_end_of_tagged_fields"))) TS_Bolt11ParseError_unexpected_end_of_tagged_fields() {
74357         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74358         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
74359         uint64_t ret_ref = tag_ptr(ret_copy, true);
74360         return ret_ref;
74361 }
74362
74363 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_description_decode_error"))) TS_Bolt11ParseError_description_decode_error(int32_t a) {
74364         
74365         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74366         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
74367         uint64_t ret_ref = tag_ptr(ret_copy, true);
74368         return ret_ref;
74369 }
74370
74371 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_padding_error"))) TS_Bolt11ParseError_padding_error() {
74372         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74373         *ret_copy = Bolt11ParseError_padding_error();
74374         uint64_t ret_ref = tag_ptr(ret_copy, true);
74375         return ret_ref;
74376 }
74377
74378 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_integer_overflow_error"))) TS_Bolt11ParseError_integer_overflow_error() {
74379         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74380         *ret_copy = Bolt11ParseError_integer_overflow_error();
74381         uint64_t ret_ref = tag_ptr(ret_copy, true);
74382         return ret_ref;
74383 }
74384
74385 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_seg_wit_program_length"))) TS_Bolt11ParseError_invalid_seg_wit_program_length() {
74386         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74387         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
74388         uint64_t ret_ref = tag_ptr(ret_copy, true);
74389         return ret_ref;
74390 }
74391
74392 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_pub_key_hash_length"))) TS_Bolt11ParseError_invalid_pub_key_hash_length() {
74393         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74394         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
74395         uint64_t ret_ref = tag_ptr(ret_copy, true);
74396         return ret_ref;
74397 }
74398
74399 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_script_hash_length"))) TS_Bolt11ParseError_invalid_script_hash_length() {
74400         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74401         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
74402         uint64_t ret_ref = tag_ptr(ret_copy, true);
74403         return ret_ref;
74404 }
74405
74406 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_recovery_id"))) TS_Bolt11ParseError_invalid_recovery_id() {
74407         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74408         *ret_copy = Bolt11ParseError_invalid_recovery_id();
74409         uint64_t ret_ref = tag_ptr(ret_copy, true);
74410         return ret_ref;
74411 }
74412
74413 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_slice_length"))) TS_Bolt11ParseError_invalid_slice_length(jstring a) {
74414         LDKStr a_conv = str_ref_to_owned_c(a);
74415         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74416         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
74417         uint64_t ret_ref = tag_ptr(ret_copy, true);
74418         return ret_ref;
74419 }
74420
74421 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_skip"))) TS_Bolt11ParseError_skip() {
74422         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74423         *ret_copy = Bolt11ParseError_skip();
74424         uint64_t ret_ref = tag_ptr(ret_copy, true);
74425         return ret_ref;
74426 }
74427
74428 jboolean  __attribute__((export_name("TS_Bolt11ParseError_eq"))) TS_Bolt11ParseError_eq(uint64_t a, uint64_t b) {
74429         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
74430         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
74431         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
74432         return ret_conv;
74433 }
74434
74435 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
74436         if (!ptr_is_owned(this_ptr)) return;
74437         void* this_ptr_ptr = untag_ptr(this_ptr);
74438         CHECK_ACCESS(this_ptr_ptr);
74439         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
74440         FREE(untag_ptr(this_ptr));
74441         ParseOrSemanticError_free(this_ptr_conv);
74442 }
74443
74444 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
74445         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
74446         *ret_copy = ParseOrSemanticError_clone(arg);
74447         uint64_t ret_ref = tag_ptr(ret_copy, true);
74448         return ret_ref;
74449 }
74450 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
74451         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
74452         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
74453         return ret_conv;
74454 }
74455
74456 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
74457         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
74458         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
74459         *ret_copy = ParseOrSemanticError_clone(orig_conv);
74460         uint64_t ret_ref = tag_ptr(ret_copy, true);
74461         return ret_ref;
74462 }
74463
74464 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
74465         void* a_ptr = untag_ptr(a);
74466         CHECK_ACCESS(a_ptr);
74467         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
74468         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
74469         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
74470         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
74471         uint64_t ret_ref = tag_ptr(ret_copy, true);
74472         return ret_ref;
74473 }
74474
74475 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
74476         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_js(a);
74477         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
74478         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
74479         uint64_t ret_ref = tag_ptr(ret_copy, true);
74480         return ret_ref;
74481 }
74482
74483 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
74484         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
74485         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
74486         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
74487         return ret_conv;
74488 }
74489
74490 void  __attribute__((export_name("TS_Bolt11Invoice_free"))) TS_Bolt11Invoice_free(uint64_t this_obj) {
74491         LDKBolt11Invoice this_obj_conv;
74492         this_obj_conv.inner = untag_ptr(this_obj);
74493         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74495         Bolt11Invoice_free(this_obj_conv);
74496 }
74497
74498 jboolean  __attribute__((export_name("TS_Bolt11Invoice_eq"))) TS_Bolt11Invoice_eq(uint64_t a, uint64_t b) {
74499         LDKBolt11Invoice a_conv;
74500         a_conv.inner = untag_ptr(a);
74501         a_conv.is_owned = ptr_is_owned(a);
74502         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74503         a_conv.is_owned = false;
74504         LDKBolt11Invoice b_conv;
74505         b_conv.inner = untag_ptr(b);
74506         b_conv.is_owned = ptr_is_owned(b);
74507         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74508         b_conv.is_owned = false;
74509         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
74510         return ret_conv;
74511 }
74512
74513 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
74514         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
74515         uint64_t ret_ref = 0;
74516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74518         return ret_ref;
74519 }
74520 int64_t  __attribute__((export_name("TS_Bolt11Invoice_clone_ptr"))) TS_Bolt11Invoice_clone_ptr(uint64_t arg) {
74521         LDKBolt11Invoice arg_conv;
74522         arg_conv.inner = untag_ptr(arg);
74523         arg_conv.is_owned = ptr_is_owned(arg);
74524         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74525         arg_conv.is_owned = false;
74526         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
74527         return ret_conv;
74528 }
74529
74530 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_clone"))) TS_Bolt11Invoice_clone(uint64_t orig) {
74531         LDKBolt11Invoice orig_conv;
74532         orig_conv.inner = untag_ptr(orig);
74533         orig_conv.is_owned = ptr_is_owned(orig);
74534         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74535         orig_conv.is_owned = false;
74536         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
74537         uint64_t ret_ref = 0;
74538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74540         return ret_ref;
74541 }
74542
74543 int64_t  __attribute__((export_name("TS_Bolt11Invoice_hash"))) TS_Bolt11Invoice_hash(uint64_t o) {
74544         LDKBolt11Invoice o_conv;
74545         o_conv.inner = untag_ptr(o);
74546         o_conv.is_owned = ptr_is_owned(o);
74547         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74548         o_conv.is_owned = false;
74549         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
74550         return ret_conv;
74551 }
74552
74553 void  __attribute__((export_name("TS_SignedRawBolt11Invoice_free"))) TS_SignedRawBolt11Invoice_free(uint64_t this_obj) {
74554         LDKSignedRawBolt11Invoice this_obj_conv;
74555         this_obj_conv.inner = untag_ptr(this_obj);
74556         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74558         SignedRawBolt11Invoice_free(this_obj_conv);
74559 }
74560
74561 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_eq"))) TS_SignedRawBolt11Invoice_eq(uint64_t a, uint64_t b) {
74562         LDKSignedRawBolt11Invoice a_conv;
74563         a_conv.inner = untag_ptr(a);
74564         a_conv.is_owned = ptr_is_owned(a);
74565         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74566         a_conv.is_owned = false;
74567         LDKSignedRawBolt11Invoice b_conv;
74568         b_conv.inner = untag_ptr(b);
74569         b_conv.is_owned = ptr_is_owned(b);
74570         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74571         b_conv.is_owned = false;
74572         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
74573         return ret_conv;
74574 }
74575
74576 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
74577         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
74578         uint64_t ret_ref = 0;
74579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74581         return ret_ref;
74582 }
74583 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone_ptr"))) TS_SignedRawBolt11Invoice_clone_ptr(uint64_t arg) {
74584         LDKSignedRawBolt11Invoice arg_conv;
74585         arg_conv.inner = untag_ptr(arg);
74586         arg_conv.is_owned = ptr_is_owned(arg);
74587         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74588         arg_conv.is_owned = false;
74589         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
74590         return ret_conv;
74591 }
74592
74593 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone"))) TS_SignedRawBolt11Invoice_clone(uint64_t orig) {
74594         LDKSignedRawBolt11Invoice orig_conv;
74595         orig_conv.inner = untag_ptr(orig);
74596         orig_conv.is_owned = ptr_is_owned(orig);
74597         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74598         orig_conv.is_owned = false;
74599         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
74600         uint64_t ret_ref = 0;
74601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74603         return ret_ref;
74604 }
74605
74606 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_hash"))) TS_SignedRawBolt11Invoice_hash(uint64_t o) {
74607         LDKSignedRawBolt11Invoice o_conv;
74608         o_conv.inner = untag_ptr(o);
74609         o_conv.is_owned = ptr_is_owned(o);
74610         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74611         o_conv.is_owned = false;
74612         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
74613         return ret_conv;
74614 }
74615
74616 void  __attribute__((export_name("TS_RawBolt11Invoice_free"))) TS_RawBolt11Invoice_free(uint64_t this_obj) {
74617         LDKRawBolt11Invoice this_obj_conv;
74618         this_obj_conv.inner = untag_ptr(this_obj);
74619         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74621         RawBolt11Invoice_free(this_obj_conv);
74622 }
74623
74624 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_get_data"))) TS_RawBolt11Invoice_get_data(uint64_t this_ptr) {
74625         LDKRawBolt11Invoice this_ptr_conv;
74626         this_ptr_conv.inner = untag_ptr(this_ptr);
74627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74629         this_ptr_conv.is_owned = false;
74630         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
74631         uint64_t ret_ref = 0;
74632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74634         return ret_ref;
74635 }
74636
74637 void  __attribute__((export_name("TS_RawBolt11Invoice_set_data"))) TS_RawBolt11Invoice_set_data(uint64_t this_ptr, uint64_t val) {
74638         LDKRawBolt11Invoice this_ptr_conv;
74639         this_ptr_conv.inner = untag_ptr(this_ptr);
74640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74642         this_ptr_conv.is_owned = false;
74643         LDKRawDataPart val_conv;
74644         val_conv.inner = untag_ptr(val);
74645         val_conv.is_owned = ptr_is_owned(val);
74646         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74647         val_conv = RawDataPart_clone(&val_conv);
74648         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
74649 }
74650
74651 jboolean  __attribute__((export_name("TS_RawBolt11Invoice_eq"))) TS_RawBolt11Invoice_eq(uint64_t a, uint64_t b) {
74652         LDKRawBolt11Invoice a_conv;
74653         a_conv.inner = untag_ptr(a);
74654         a_conv.is_owned = ptr_is_owned(a);
74655         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74656         a_conv.is_owned = false;
74657         LDKRawBolt11Invoice b_conv;
74658         b_conv.inner = untag_ptr(b);
74659         b_conv.is_owned = ptr_is_owned(b);
74660         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74661         b_conv.is_owned = false;
74662         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
74663         return ret_conv;
74664 }
74665
74666 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
74667         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
74668         uint64_t ret_ref = 0;
74669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74671         return ret_ref;
74672 }
74673 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone_ptr"))) TS_RawBolt11Invoice_clone_ptr(uint64_t arg) {
74674         LDKRawBolt11Invoice arg_conv;
74675         arg_conv.inner = untag_ptr(arg);
74676         arg_conv.is_owned = ptr_is_owned(arg);
74677         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74678         arg_conv.is_owned = false;
74679         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
74680         return ret_conv;
74681 }
74682
74683 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone"))) TS_RawBolt11Invoice_clone(uint64_t orig) {
74684         LDKRawBolt11Invoice orig_conv;
74685         orig_conv.inner = untag_ptr(orig);
74686         orig_conv.is_owned = ptr_is_owned(orig);
74687         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74688         orig_conv.is_owned = false;
74689         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
74690         uint64_t ret_ref = 0;
74691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74693         return ret_ref;
74694 }
74695
74696 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_hash"))) TS_RawBolt11Invoice_hash(uint64_t o) {
74697         LDKRawBolt11Invoice o_conv;
74698         o_conv.inner = untag_ptr(o);
74699         o_conv.is_owned = ptr_is_owned(o);
74700         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74701         o_conv.is_owned = false;
74702         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
74703         return ret_conv;
74704 }
74705
74706 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
74707         LDKRawDataPart this_obj_conv;
74708         this_obj_conv.inner = untag_ptr(this_obj);
74709         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74711         RawDataPart_free(this_obj_conv);
74712 }
74713
74714 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
74715         LDKRawDataPart this_ptr_conv;
74716         this_ptr_conv.inner = untag_ptr(this_ptr);
74717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74719         this_ptr_conv.is_owned = false;
74720         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
74721         uint64_t ret_ref = 0;
74722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74724         return ret_ref;
74725 }
74726
74727 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
74728         LDKRawDataPart this_ptr_conv;
74729         this_ptr_conv.inner = untag_ptr(this_ptr);
74730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74732         this_ptr_conv.is_owned = false;
74733         LDKPositiveTimestamp val_conv;
74734         val_conv.inner = untag_ptr(val);
74735         val_conv.is_owned = ptr_is_owned(val);
74736         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74737         val_conv = PositiveTimestamp_clone(&val_conv);
74738         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
74739 }
74740
74741 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
74742         LDKRawDataPart a_conv;
74743         a_conv.inner = untag_ptr(a);
74744         a_conv.is_owned = ptr_is_owned(a);
74745         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74746         a_conv.is_owned = false;
74747         LDKRawDataPart b_conv;
74748         b_conv.inner = untag_ptr(b);
74749         b_conv.is_owned = ptr_is_owned(b);
74750         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74751         b_conv.is_owned = false;
74752         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
74753         return ret_conv;
74754 }
74755
74756 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
74757         LDKRawDataPart ret_var = RawDataPart_clone(arg);
74758         uint64_t ret_ref = 0;
74759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74761         return ret_ref;
74762 }
74763 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
74764         LDKRawDataPart arg_conv;
74765         arg_conv.inner = untag_ptr(arg);
74766         arg_conv.is_owned = ptr_is_owned(arg);
74767         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74768         arg_conv.is_owned = false;
74769         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
74770         return ret_conv;
74771 }
74772
74773 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
74774         LDKRawDataPart orig_conv;
74775         orig_conv.inner = untag_ptr(orig);
74776         orig_conv.is_owned = ptr_is_owned(orig);
74777         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74778         orig_conv.is_owned = false;
74779         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
74780         uint64_t ret_ref = 0;
74781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74783         return ret_ref;
74784 }
74785
74786 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
74787         LDKRawDataPart o_conv;
74788         o_conv.inner = untag_ptr(o);
74789         o_conv.is_owned = ptr_is_owned(o);
74790         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74791         o_conv.is_owned = false;
74792         int64_t ret_conv = RawDataPart_hash(&o_conv);
74793         return ret_conv;
74794 }
74795
74796 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
74797         LDKPositiveTimestamp this_obj_conv;
74798         this_obj_conv.inner = untag_ptr(this_obj);
74799         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74801         PositiveTimestamp_free(this_obj_conv);
74802 }
74803
74804 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
74805         LDKPositiveTimestamp a_conv;
74806         a_conv.inner = untag_ptr(a);
74807         a_conv.is_owned = ptr_is_owned(a);
74808         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74809         a_conv.is_owned = false;
74810         LDKPositiveTimestamp b_conv;
74811         b_conv.inner = untag_ptr(b);
74812         b_conv.is_owned = ptr_is_owned(b);
74813         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74814         b_conv.is_owned = false;
74815         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
74816         return ret_conv;
74817 }
74818
74819 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
74820         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
74821         uint64_t ret_ref = 0;
74822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74824         return ret_ref;
74825 }
74826 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
74827         LDKPositiveTimestamp arg_conv;
74828         arg_conv.inner = untag_ptr(arg);
74829         arg_conv.is_owned = ptr_is_owned(arg);
74830         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74831         arg_conv.is_owned = false;
74832         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
74833         return ret_conv;
74834 }
74835
74836 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
74837         LDKPositiveTimestamp orig_conv;
74838         orig_conv.inner = untag_ptr(orig);
74839         orig_conv.is_owned = ptr_is_owned(orig);
74840         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74841         orig_conv.is_owned = false;
74842         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
74843         uint64_t ret_ref = 0;
74844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74846         return ret_ref;
74847 }
74848
74849 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
74850         LDKPositiveTimestamp o_conv;
74851         o_conv.inner = untag_ptr(o);
74852         o_conv.is_owned = ptr_is_owned(o);
74853         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74854         o_conv.is_owned = false;
74855         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
74856         return ret_conv;
74857 }
74858
74859 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
74860         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
74861         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
74862         return ret_conv;
74863 }
74864
74865 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
74866         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
74867         return ret_conv;
74868 }
74869
74870 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
74871         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
74872         return ret_conv;
74873 }
74874
74875 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
74876         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
74877         return ret_conv;
74878 }
74879
74880 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
74881         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
74882         return ret_conv;
74883 }
74884
74885 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
74886         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
74887         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
74888         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
74889         return ret_conv;
74890 }
74891
74892 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
74893         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
74894         int64_t ret_conv = SiPrefix_hash(o_conv);
74895         return ret_conv;
74896 }
74897
74898 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
74899         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
74900         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
74901         return ret_conv;
74902 }
74903
74904 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
74905         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
74906         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
74907         return ret_conv;
74908 }
74909
74910 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
74911         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
74912         return ret_conv;
74913 }
74914
74915 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
74916         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
74917         return ret_conv;
74918 }
74919
74920 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
74921         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
74922         return ret_conv;
74923 }
74924
74925 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
74926         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
74927         return ret_conv;
74928 }
74929
74930 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
74931         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
74932         return ret_conv;
74933 }
74934
74935 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
74936         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
74937         int64_t ret_conv = Currency_hash(o_conv);
74938         return ret_conv;
74939 }
74940
74941 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
74942         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
74943         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
74944         jboolean ret_conv = Currency_eq(a_conv, b_conv);
74945         return ret_conv;
74946 }
74947
74948 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
74949         LDKSha256 this_obj_conv;
74950         this_obj_conv.inner = untag_ptr(this_obj);
74951         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74953         Sha256_free(this_obj_conv);
74954 }
74955
74956 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
74957         LDKSha256 ret_var = Sha256_clone(arg);
74958         uint64_t ret_ref = 0;
74959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74961         return ret_ref;
74962 }
74963 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
74964         LDKSha256 arg_conv;
74965         arg_conv.inner = untag_ptr(arg);
74966         arg_conv.is_owned = ptr_is_owned(arg);
74967         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74968         arg_conv.is_owned = false;
74969         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
74970         return ret_conv;
74971 }
74972
74973 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
74974         LDKSha256 orig_conv;
74975         orig_conv.inner = untag_ptr(orig);
74976         orig_conv.is_owned = ptr_is_owned(orig);
74977         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74978         orig_conv.is_owned = false;
74979         LDKSha256 ret_var = Sha256_clone(&orig_conv);
74980         uint64_t ret_ref = 0;
74981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74983         return ret_ref;
74984 }
74985
74986 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
74987         LDKSha256 o_conv;
74988         o_conv.inner = untag_ptr(o);
74989         o_conv.is_owned = ptr_is_owned(o);
74990         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74991         o_conv.is_owned = false;
74992         int64_t ret_conv = Sha256_hash(&o_conv);
74993         return ret_conv;
74994 }
74995
74996 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
74997         LDKSha256 a_conv;
74998         a_conv.inner = untag_ptr(a);
74999         a_conv.is_owned = ptr_is_owned(a);
75000         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75001         a_conv.is_owned = false;
75002         LDKSha256 b_conv;
75003         b_conv.inner = untag_ptr(b);
75004         b_conv.is_owned = ptr_is_owned(b);
75005         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75006         b_conv.is_owned = false;
75007         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
75008         return ret_conv;
75009 }
75010
75011 uint64_t  __attribute__((export_name("TS_Sha256_from_bytes"))) TS_Sha256_from_bytes(int8_tArray bytes) {
75012         uint8_t bytes_arr[32];
75013         CHECK(bytes->arr_len == 32);
75014         memcpy(bytes_arr, bytes->elems, 32); FREE(bytes);
75015         uint8_t (*bytes_ref)[32] = &bytes_arr;
75016         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
75017         uint64_t ret_ref = 0;
75018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75020         return ret_ref;
75021 }
75022
75023 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
75024         LDKDescription this_obj_conv;
75025         this_obj_conv.inner = untag_ptr(this_obj);
75026         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75028         Description_free(this_obj_conv);
75029 }
75030
75031 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
75032         LDKDescription ret_var = Description_clone(arg);
75033         uint64_t ret_ref = 0;
75034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75036         return ret_ref;
75037 }
75038 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
75039         LDKDescription arg_conv;
75040         arg_conv.inner = untag_ptr(arg);
75041         arg_conv.is_owned = ptr_is_owned(arg);
75042         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75043         arg_conv.is_owned = false;
75044         int64_t ret_conv = Description_clone_ptr(&arg_conv);
75045         return ret_conv;
75046 }
75047
75048 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
75049         LDKDescription orig_conv;
75050         orig_conv.inner = untag_ptr(orig);
75051         orig_conv.is_owned = ptr_is_owned(orig);
75052         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75053         orig_conv.is_owned = false;
75054         LDKDescription ret_var = Description_clone(&orig_conv);
75055         uint64_t ret_ref = 0;
75056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75058         return ret_ref;
75059 }
75060
75061 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
75062         LDKDescription o_conv;
75063         o_conv.inner = untag_ptr(o);
75064         o_conv.is_owned = ptr_is_owned(o);
75065         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75066         o_conv.is_owned = false;
75067         int64_t ret_conv = Description_hash(&o_conv);
75068         return ret_conv;
75069 }
75070
75071 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
75072         LDKDescription a_conv;
75073         a_conv.inner = untag_ptr(a);
75074         a_conv.is_owned = ptr_is_owned(a);
75075         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75076         a_conv.is_owned = false;
75077         LDKDescription b_conv;
75078         b_conv.inner = untag_ptr(b);
75079         b_conv.is_owned = ptr_is_owned(b);
75080         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75081         b_conv.is_owned = false;
75082         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
75083         return ret_conv;
75084 }
75085
75086 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
75087         LDKPayeePubKey this_obj_conv;
75088         this_obj_conv.inner = untag_ptr(this_obj);
75089         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75091         PayeePubKey_free(this_obj_conv);
75092 }
75093
75094 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
75095         LDKPayeePubKey this_ptr_conv;
75096         this_ptr_conv.inner = untag_ptr(this_ptr);
75097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75099         this_ptr_conv.is_owned = false;
75100         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
75101         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
75102         return ret_arr;
75103 }
75104
75105 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
75106         LDKPayeePubKey this_ptr_conv;
75107         this_ptr_conv.inner = untag_ptr(this_ptr);
75108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75110         this_ptr_conv.is_owned = false;
75111         LDKPublicKey val_ref;
75112         CHECK(val->arr_len == 33);
75113         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
75114         PayeePubKey_set_a(&this_ptr_conv, val_ref);
75115 }
75116
75117 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
75118         LDKPublicKey a_arg_ref;
75119         CHECK(a_arg->arr_len == 33);
75120         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
75121         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
75122         uint64_t ret_ref = 0;
75123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75125         return ret_ref;
75126 }
75127
75128 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
75129         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
75130         uint64_t ret_ref = 0;
75131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75133         return ret_ref;
75134 }
75135 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
75136         LDKPayeePubKey arg_conv;
75137         arg_conv.inner = untag_ptr(arg);
75138         arg_conv.is_owned = ptr_is_owned(arg);
75139         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75140         arg_conv.is_owned = false;
75141         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
75142         return ret_conv;
75143 }
75144
75145 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
75146         LDKPayeePubKey orig_conv;
75147         orig_conv.inner = untag_ptr(orig);
75148         orig_conv.is_owned = ptr_is_owned(orig);
75149         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75150         orig_conv.is_owned = false;
75151         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
75152         uint64_t ret_ref = 0;
75153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75155         return ret_ref;
75156 }
75157
75158 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
75159         LDKPayeePubKey o_conv;
75160         o_conv.inner = untag_ptr(o);
75161         o_conv.is_owned = ptr_is_owned(o);
75162         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75163         o_conv.is_owned = false;
75164         int64_t ret_conv = PayeePubKey_hash(&o_conv);
75165         return ret_conv;
75166 }
75167
75168 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
75169         LDKPayeePubKey a_conv;
75170         a_conv.inner = untag_ptr(a);
75171         a_conv.is_owned = ptr_is_owned(a);
75172         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75173         a_conv.is_owned = false;
75174         LDKPayeePubKey b_conv;
75175         b_conv.inner = untag_ptr(b);
75176         b_conv.is_owned = ptr_is_owned(b);
75177         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75178         b_conv.is_owned = false;
75179         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
75180         return ret_conv;
75181 }
75182
75183 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
75184         LDKExpiryTime this_obj_conv;
75185         this_obj_conv.inner = untag_ptr(this_obj);
75186         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75188         ExpiryTime_free(this_obj_conv);
75189 }
75190
75191 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
75192         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
75193         uint64_t ret_ref = 0;
75194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75196         return ret_ref;
75197 }
75198 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
75199         LDKExpiryTime arg_conv;
75200         arg_conv.inner = untag_ptr(arg);
75201         arg_conv.is_owned = ptr_is_owned(arg);
75202         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75203         arg_conv.is_owned = false;
75204         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
75205         return ret_conv;
75206 }
75207
75208 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
75209         LDKExpiryTime orig_conv;
75210         orig_conv.inner = untag_ptr(orig);
75211         orig_conv.is_owned = ptr_is_owned(orig);
75212         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75213         orig_conv.is_owned = false;
75214         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
75215         uint64_t ret_ref = 0;
75216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75218         return ret_ref;
75219 }
75220
75221 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
75222         LDKExpiryTime o_conv;
75223         o_conv.inner = untag_ptr(o);
75224         o_conv.is_owned = ptr_is_owned(o);
75225         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75226         o_conv.is_owned = false;
75227         int64_t ret_conv = ExpiryTime_hash(&o_conv);
75228         return ret_conv;
75229 }
75230
75231 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
75232         LDKExpiryTime a_conv;
75233         a_conv.inner = untag_ptr(a);
75234         a_conv.is_owned = ptr_is_owned(a);
75235         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75236         a_conv.is_owned = false;
75237         LDKExpiryTime b_conv;
75238         b_conv.inner = untag_ptr(b);
75239         b_conv.is_owned = ptr_is_owned(b);
75240         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75241         b_conv.is_owned = false;
75242         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
75243         return ret_conv;
75244 }
75245
75246 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_free"))) TS_MinFinalCltvExpiryDelta_free(uint64_t this_obj) {
75247         LDKMinFinalCltvExpiryDelta this_obj_conv;
75248         this_obj_conv.inner = untag_ptr(this_obj);
75249         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75251         MinFinalCltvExpiryDelta_free(this_obj_conv);
75252 }
75253
75254 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_get_a"))) TS_MinFinalCltvExpiryDelta_get_a(uint64_t this_ptr) {
75255         LDKMinFinalCltvExpiryDelta this_ptr_conv;
75256         this_ptr_conv.inner = untag_ptr(this_ptr);
75257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75259         this_ptr_conv.is_owned = false;
75260         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
75261         return ret_conv;
75262 }
75263
75264 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_set_a"))) TS_MinFinalCltvExpiryDelta_set_a(uint64_t this_ptr, int64_t val) {
75265         LDKMinFinalCltvExpiryDelta this_ptr_conv;
75266         this_ptr_conv.inner = untag_ptr(this_ptr);
75267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75269         this_ptr_conv.is_owned = false;
75270         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
75271 }
75272
75273 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_new"))) TS_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
75274         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
75275         uint64_t ret_ref = 0;
75276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75278         return ret_ref;
75279 }
75280
75281 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
75282         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
75283         uint64_t ret_ref = 0;
75284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75286         return ret_ref;
75287 }
75288 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone_ptr"))) TS_MinFinalCltvExpiryDelta_clone_ptr(uint64_t arg) {
75289         LDKMinFinalCltvExpiryDelta arg_conv;
75290         arg_conv.inner = untag_ptr(arg);
75291         arg_conv.is_owned = ptr_is_owned(arg);
75292         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75293         arg_conv.is_owned = false;
75294         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
75295         return ret_conv;
75296 }
75297
75298 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone"))) TS_MinFinalCltvExpiryDelta_clone(uint64_t orig) {
75299         LDKMinFinalCltvExpiryDelta orig_conv;
75300         orig_conv.inner = untag_ptr(orig);
75301         orig_conv.is_owned = ptr_is_owned(orig);
75302         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75303         orig_conv.is_owned = false;
75304         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
75305         uint64_t ret_ref = 0;
75306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75308         return ret_ref;
75309 }
75310
75311 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_hash"))) TS_MinFinalCltvExpiryDelta_hash(uint64_t o) {
75312         LDKMinFinalCltvExpiryDelta o_conv;
75313         o_conv.inner = untag_ptr(o);
75314         o_conv.is_owned = ptr_is_owned(o);
75315         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75316         o_conv.is_owned = false;
75317         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
75318         return ret_conv;
75319 }
75320
75321 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_eq"))) TS_MinFinalCltvExpiryDelta_eq(uint64_t a, uint64_t b) {
75322         LDKMinFinalCltvExpiryDelta a_conv;
75323         a_conv.inner = untag_ptr(a);
75324         a_conv.is_owned = ptr_is_owned(a);
75325         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75326         a_conv.is_owned = false;
75327         LDKMinFinalCltvExpiryDelta b_conv;
75328         b_conv.inner = untag_ptr(b);
75329         b_conv.is_owned = ptr_is_owned(b);
75330         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75331         b_conv.is_owned = false;
75332         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
75333         return ret_conv;
75334 }
75335
75336 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
75337         if (!ptr_is_owned(this_ptr)) return;
75338         void* this_ptr_ptr = untag_ptr(this_ptr);
75339         CHECK_ACCESS(this_ptr_ptr);
75340         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
75341         FREE(untag_ptr(this_ptr));
75342         Fallback_free(this_ptr_conv);
75343 }
75344
75345 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
75346         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75347         *ret_copy = Fallback_clone(arg);
75348         uint64_t ret_ref = tag_ptr(ret_copy, true);
75349         return ret_ref;
75350 }
75351 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
75352         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
75353         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
75354         return ret_conv;
75355 }
75356
75357 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
75358         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
75359         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75360         *ret_copy = Fallback_clone(orig_conv);
75361         uint64_t ret_ref = tag_ptr(ret_copy, true);
75362         return ret_ref;
75363 }
75364
75365 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
75366         
75367         LDKCVec_u8Z program_ref;
75368         program_ref.datalen = program->arr_len;
75369         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
75370         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
75371         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75372         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
75373         uint64_t ret_ref = tag_ptr(ret_copy, true);
75374         return ret_ref;
75375 }
75376
75377 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
75378         LDKTwentyBytes a_ref;
75379         CHECK(a->arr_len == 20);
75380         memcpy(a_ref.data, a->elems, 20); FREE(a);
75381         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75382         *ret_copy = Fallback_pub_key_hash(a_ref);
75383         uint64_t ret_ref = tag_ptr(ret_copy, true);
75384         return ret_ref;
75385 }
75386
75387 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
75388         LDKTwentyBytes a_ref;
75389         CHECK(a->arr_len == 20);
75390         memcpy(a_ref.data, a->elems, 20); FREE(a);
75391         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75392         *ret_copy = Fallback_script_hash(a_ref);
75393         uint64_t ret_ref = tag_ptr(ret_copy, true);
75394         return ret_ref;
75395 }
75396
75397 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
75398         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
75399         int64_t ret_conv = Fallback_hash(o_conv);
75400         return ret_conv;
75401 }
75402
75403 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
75404         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
75405         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
75406         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
75407         return ret_conv;
75408 }
75409
75410 void  __attribute__((export_name("TS_Bolt11InvoiceSignature_free"))) TS_Bolt11InvoiceSignature_free(uint64_t this_obj) {
75411         LDKBolt11InvoiceSignature this_obj_conv;
75412         this_obj_conv.inner = untag_ptr(this_obj);
75413         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75415         Bolt11InvoiceSignature_free(this_obj_conv);
75416 }
75417
75418 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
75419         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
75420         uint64_t ret_ref = 0;
75421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75423         return ret_ref;
75424 }
75425 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone_ptr"))) TS_Bolt11InvoiceSignature_clone_ptr(uint64_t arg) {
75426         LDKBolt11InvoiceSignature arg_conv;
75427         arg_conv.inner = untag_ptr(arg);
75428         arg_conv.is_owned = ptr_is_owned(arg);
75429         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75430         arg_conv.is_owned = false;
75431         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
75432         return ret_conv;
75433 }
75434
75435 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone"))) TS_Bolt11InvoiceSignature_clone(uint64_t orig) {
75436         LDKBolt11InvoiceSignature orig_conv;
75437         orig_conv.inner = untag_ptr(orig);
75438         orig_conv.is_owned = ptr_is_owned(orig);
75439         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75440         orig_conv.is_owned = false;
75441         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
75442         uint64_t ret_ref = 0;
75443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75445         return ret_ref;
75446 }
75447
75448 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_hash"))) TS_Bolt11InvoiceSignature_hash(uint64_t o) {
75449         LDKBolt11InvoiceSignature o_conv;
75450         o_conv.inner = untag_ptr(o);
75451         o_conv.is_owned = ptr_is_owned(o);
75452         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75453         o_conv.is_owned = false;
75454         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
75455         return ret_conv;
75456 }
75457
75458 jboolean  __attribute__((export_name("TS_Bolt11InvoiceSignature_eq"))) TS_Bolt11InvoiceSignature_eq(uint64_t a, uint64_t b) {
75459         LDKBolt11InvoiceSignature a_conv;
75460         a_conv.inner = untag_ptr(a);
75461         a_conv.is_owned = ptr_is_owned(a);
75462         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75463         a_conv.is_owned = false;
75464         LDKBolt11InvoiceSignature b_conv;
75465         b_conv.inner = untag_ptr(b);
75466         b_conv.is_owned = ptr_is_owned(b);
75467         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75468         b_conv.is_owned = false;
75469         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
75470         return ret_conv;
75471 }
75472
75473 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
75474         LDKPrivateRoute this_obj_conv;
75475         this_obj_conv.inner = untag_ptr(this_obj);
75476         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75478         PrivateRoute_free(this_obj_conv);
75479 }
75480
75481 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
75482         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
75483         uint64_t ret_ref = 0;
75484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75486         return ret_ref;
75487 }
75488 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
75489         LDKPrivateRoute arg_conv;
75490         arg_conv.inner = untag_ptr(arg);
75491         arg_conv.is_owned = ptr_is_owned(arg);
75492         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75493         arg_conv.is_owned = false;
75494         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
75495         return ret_conv;
75496 }
75497
75498 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
75499         LDKPrivateRoute orig_conv;
75500         orig_conv.inner = untag_ptr(orig);
75501         orig_conv.is_owned = ptr_is_owned(orig);
75502         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75503         orig_conv.is_owned = false;
75504         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
75505         uint64_t ret_ref = 0;
75506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75508         return ret_ref;
75509 }
75510
75511 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
75512         LDKPrivateRoute o_conv;
75513         o_conv.inner = untag_ptr(o);
75514         o_conv.is_owned = ptr_is_owned(o);
75515         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75516         o_conv.is_owned = false;
75517         int64_t ret_conv = PrivateRoute_hash(&o_conv);
75518         return ret_conv;
75519 }
75520
75521 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
75522         LDKPrivateRoute a_conv;
75523         a_conv.inner = untag_ptr(a);
75524         a_conv.is_owned = ptr_is_owned(a);
75525         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75526         a_conv.is_owned = false;
75527         LDKPrivateRoute b_conv;
75528         b_conv.inner = untag_ptr(b);
75529         b_conv.is_owned = ptr_is_owned(b);
75530         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75531         b_conv.is_owned = false;
75532         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
75533         return ret_conv;
75534 }
75535
75536 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_into_parts"))) TS_SignedRawBolt11Invoice_into_parts(uint64_t this_arg) {
75537         LDKSignedRawBolt11Invoice this_arg_conv;
75538         this_arg_conv.inner = untag_ptr(this_arg);
75539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75541         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
75542         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
75543         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
75544         return tag_ptr(ret_conv, true);
75545 }
75546
75547 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_raw_invoice"))) TS_SignedRawBolt11Invoice_raw_invoice(uint64_t this_arg) {
75548         LDKSignedRawBolt11Invoice this_arg_conv;
75549         this_arg_conv.inner = untag_ptr(this_arg);
75550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75552         this_arg_conv.is_owned = false;
75553         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
75554         uint64_t ret_ref = 0;
75555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75557         return ret_ref;
75558 }
75559
75560 int8_tArray  __attribute__((export_name("TS_SignedRawBolt11Invoice_signable_hash"))) TS_SignedRawBolt11Invoice_signable_hash(uint64_t this_arg) {
75561         LDKSignedRawBolt11Invoice this_arg_conv;
75562         this_arg_conv.inner = untag_ptr(this_arg);
75563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75565         this_arg_conv.is_owned = false;
75566         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75567         memcpy(ret_arr->elems, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv), 32);
75568         return ret_arr;
75569 }
75570
75571 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_signature"))) TS_SignedRawBolt11Invoice_signature(uint64_t this_arg) {
75572         LDKSignedRawBolt11Invoice this_arg_conv;
75573         this_arg_conv.inner = untag_ptr(this_arg);
75574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75576         this_arg_conv.is_owned = false;
75577         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
75578         uint64_t ret_ref = 0;
75579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75581         return ret_ref;
75582 }
75583
75584 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_recover_payee_pub_key"))) TS_SignedRawBolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
75585         LDKSignedRawBolt11Invoice this_arg_conv;
75586         this_arg_conv.inner = untag_ptr(this_arg);
75587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75589         this_arg_conv.is_owned = false;
75590         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
75591         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
75592         return tag_ptr(ret_conv, true);
75593 }
75594
75595 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_check_signature"))) TS_SignedRawBolt11Invoice_check_signature(uint64_t this_arg) {
75596         LDKSignedRawBolt11Invoice this_arg_conv;
75597         this_arg_conv.inner = untag_ptr(this_arg);
75598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75600         this_arg_conv.is_owned = false;
75601         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
75602         return ret_conv;
75603 }
75604
75605 int8_tArray  __attribute__((export_name("TS_RawBolt11Invoice_signable_hash"))) TS_RawBolt11Invoice_signable_hash(uint64_t this_arg) {
75606         LDKRawBolt11Invoice this_arg_conv;
75607         this_arg_conv.inner = untag_ptr(this_arg);
75608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75610         this_arg_conv.is_owned = false;
75611         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75612         memcpy(ret_arr->elems, RawBolt11Invoice_signable_hash(&this_arg_conv).data, 32);
75613         return ret_arr;
75614 }
75615
75616 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_hash"))) TS_RawBolt11Invoice_payment_hash(uint64_t this_arg) {
75617         LDKRawBolt11Invoice this_arg_conv;
75618         this_arg_conv.inner = untag_ptr(this_arg);
75619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75621         this_arg_conv.is_owned = false;
75622         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
75623         uint64_t ret_ref = 0;
75624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75626         return ret_ref;
75627 }
75628
75629 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description"))) TS_RawBolt11Invoice_description(uint64_t this_arg) {
75630         LDKRawBolt11Invoice this_arg_conv;
75631         this_arg_conv.inner = untag_ptr(this_arg);
75632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75634         this_arg_conv.is_owned = false;
75635         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
75636         uint64_t ret_ref = 0;
75637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75639         return ret_ref;
75640 }
75641
75642 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payee_pub_key"))) TS_RawBolt11Invoice_payee_pub_key(uint64_t this_arg) {
75643         LDKRawBolt11Invoice this_arg_conv;
75644         this_arg_conv.inner = untag_ptr(this_arg);
75645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75647         this_arg_conv.is_owned = false;
75648         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
75649         uint64_t ret_ref = 0;
75650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75652         return ret_ref;
75653 }
75654
75655 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description_hash"))) TS_RawBolt11Invoice_description_hash(uint64_t this_arg) {
75656         LDKRawBolt11Invoice this_arg_conv;
75657         this_arg_conv.inner = untag_ptr(this_arg);
75658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75660         this_arg_conv.is_owned = false;
75661         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
75662         uint64_t ret_ref = 0;
75663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75665         return ret_ref;
75666 }
75667
75668 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_expiry_time"))) TS_RawBolt11Invoice_expiry_time(uint64_t this_arg) {
75669         LDKRawBolt11Invoice this_arg_conv;
75670         this_arg_conv.inner = untag_ptr(this_arg);
75671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75673         this_arg_conv.is_owned = false;
75674         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
75675         uint64_t ret_ref = 0;
75676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75678         return ret_ref;
75679 }
75680
75681 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_min_final_cltv_expiry_delta"))) TS_RawBolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
75682         LDKRawBolt11Invoice this_arg_conv;
75683         this_arg_conv.inner = untag_ptr(this_arg);
75684         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75686         this_arg_conv.is_owned = false;
75687         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
75688         uint64_t ret_ref = 0;
75689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75691         return ret_ref;
75692 }
75693
75694 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_secret"))) TS_RawBolt11Invoice_payment_secret(uint64_t this_arg) {
75695         LDKRawBolt11Invoice this_arg_conv;
75696         this_arg_conv.inner = untag_ptr(this_arg);
75697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75699         this_arg_conv.is_owned = false;
75700         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
75701         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
75702         uint64_t ret_ref = tag_ptr(ret_copy, true);
75703         return ret_ref;
75704 }
75705
75706 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_metadata"))) TS_RawBolt11Invoice_payment_metadata(uint64_t this_arg) {
75707         LDKRawBolt11Invoice this_arg_conv;
75708         this_arg_conv.inner = untag_ptr(this_arg);
75709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75711         this_arg_conv.is_owned = false;
75712         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
75713         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
75714         uint64_t ret_ref = tag_ptr(ret_copy, true);
75715         return ret_ref;
75716 }
75717
75718 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_features"))) TS_RawBolt11Invoice_features(uint64_t this_arg) {
75719         LDKRawBolt11Invoice this_arg_conv;
75720         this_arg_conv.inner = untag_ptr(this_arg);
75721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75723         this_arg_conv.is_owned = false;
75724         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
75725         uint64_t ret_ref = 0;
75726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75728         return ret_ref;
75729 }
75730
75731 uint64_tArray  __attribute__((export_name("TS_RawBolt11Invoice_private_routes"))) TS_RawBolt11Invoice_private_routes(uint64_t this_arg) {
75732         LDKRawBolt11Invoice this_arg_conv;
75733         this_arg_conv.inner = untag_ptr(this_arg);
75734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75736         this_arg_conv.is_owned = false;
75737         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
75738         uint64_tArray ret_arr = NULL;
75739         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
75740         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
75741         for (size_t o = 0; o < ret_var.datalen; o++) {
75742                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
75743                 uint64_t ret_conv_14_ref = 0;
75744                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
75745                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
75746                 ret_arr_ptr[o] = ret_conv_14_ref;
75747         }
75748         
75749         FREE(ret_var.data);
75750         return ret_arr;
75751 }
75752
75753 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_amount_pico_btc"))) TS_RawBolt11Invoice_amount_pico_btc(uint64_t this_arg) {
75754         LDKRawBolt11Invoice this_arg_conv;
75755         this_arg_conv.inner = untag_ptr(this_arg);
75756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75758         this_arg_conv.is_owned = false;
75759         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
75760         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
75761         uint64_t ret_ref = tag_ptr(ret_copy, true);
75762         return ret_ref;
75763 }
75764
75765 uint32_t  __attribute__((export_name("TS_RawBolt11Invoice_currency"))) TS_RawBolt11Invoice_currency(uint64_t this_arg) {
75766         LDKRawBolt11Invoice this_arg_conv;
75767         this_arg_conv.inner = untag_ptr(this_arg);
75768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75770         this_arg_conv.is_owned = false;
75771         uint32_t ret_conv = LDKCurrency_to_js(RawBolt11Invoice_currency(&this_arg_conv));
75772         return ret_conv;
75773 }
75774
75775 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
75776         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
75777         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
75778         return tag_ptr(ret_conv, true);
75779 }
75780
75781 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
75782         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
75783         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
75784         return tag_ptr(ret_conv, true);
75785 }
75786
75787 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
75788         LDKPositiveTimestamp this_arg_conv;
75789         this_arg_conv.inner = untag_ptr(this_arg);
75790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75792         this_arg_conv.is_owned = false;
75793         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
75794         return ret_conv;
75795 }
75796
75797 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
75798         LDKPositiveTimestamp this_arg_conv;
75799         this_arg_conv.inner = untag_ptr(this_arg);
75800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75802         this_arg_conv.is_owned = false;
75803         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
75804         return ret_conv;
75805 }
75806
75807 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_signable_hash"))) TS_Bolt11Invoice_signable_hash(uint64_t this_arg) {
75808         LDKBolt11Invoice this_arg_conv;
75809         this_arg_conv.inner = untag_ptr(this_arg);
75810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75812         this_arg_conv.is_owned = false;
75813         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75814         memcpy(ret_arr->elems, Bolt11Invoice_signable_hash(&this_arg_conv).data, 32);
75815         return ret_arr;
75816 }
75817
75818 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_into_signed_raw"))) TS_Bolt11Invoice_into_signed_raw(uint64_t this_arg) {
75819         LDKBolt11Invoice this_arg_conv;
75820         this_arg_conv.inner = untag_ptr(this_arg);
75821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75823         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
75824         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
75825         uint64_t ret_ref = 0;
75826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75828         return ret_ref;
75829 }
75830
75831 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_check_signature"))) TS_Bolt11Invoice_check_signature(uint64_t this_arg) {
75832         LDKBolt11Invoice this_arg_conv;
75833         this_arg_conv.inner = untag_ptr(this_arg);
75834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75836         this_arg_conv.is_owned = false;
75837         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
75838         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
75839         return tag_ptr(ret_conv, true);
75840 }
75841
75842 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_signed"))) TS_Bolt11Invoice_from_signed(uint64_t signed_invoice) {
75843         LDKSignedRawBolt11Invoice signed_invoice_conv;
75844         signed_invoice_conv.inner = untag_ptr(signed_invoice);
75845         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
75846         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
75847         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
75848         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
75849         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
75850         return tag_ptr(ret_conv, true);
75851 }
75852
75853 int64_t  __attribute__((export_name("TS_Bolt11Invoice_duration_since_epoch"))) TS_Bolt11Invoice_duration_since_epoch(uint64_t this_arg) {
75854         LDKBolt11Invoice this_arg_conv;
75855         this_arg_conv.inner = untag_ptr(this_arg);
75856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75858         this_arg_conv.is_owned = false;
75859         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
75860         return ret_conv;
75861 }
75862
75863 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_hash"))) TS_Bolt11Invoice_payment_hash(uint64_t this_arg) {
75864         LDKBolt11Invoice this_arg_conv;
75865         this_arg_conv.inner = untag_ptr(this_arg);
75866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75868         this_arg_conv.is_owned = false;
75869         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75870         memcpy(ret_arr->elems, *Bolt11Invoice_payment_hash(&this_arg_conv), 32);
75871         return ret_arr;
75872 }
75873
75874 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payee_pub_key"))) TS_Bolt11Invoice_payee_pub_key(uint64_t this_arg) {
75875         LDKBolt11Invoice this_arg_conv;
75876         this_arg_conv.inner = untag_ptr(this_arg);
75877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75879         this_arg_conv.is_owned = false;
75880         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
75881         memcpy(ret_arr->elems, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
75882         return ret_arr;
75883 }
75884
75885 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_secret"))) TS_Bolt11Invoice_payment_secret(uint64_t this_arg) {
75886         LDKBolt11Invoice this_arg_conv;
75887         this_arg_conv.inner = untag_ptr(this_arg);
75888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75890         this_arg_conv.is_owned = false;
75891         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75892         memcpy(ret_arr->elems, *Bolt11Invoice_payment_secret(&this_arg_conv), 32);
75893         return ret_arr;
75894 }
75895
75896 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_payment_metadata"))) TS_Bolt11Invoice_payment_metadata(uint64_t this_arg) {
75897         LDKBolt11Invoice this_arg_conv;
75898         this_arg_conv.inner = untag_ptr(this_arg);
75899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75901         this_arg_conv.is_owned = false;
75902         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
75903         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
75904         uint64_t ret_ref = tag_ptr(ret_copy, true);
75905         return ret_ref;
75906 }
75907
75908 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_features"))) TS_Bolt11Invoice_features(uint64_t this_arg) {
75909         LDKBolt11Invoice this_arg_conv;
75910         this_arg_conv.inner = untag_ptr(this_arg);
75911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75913         this_arg_conv.is_owned = false;
75914         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
75915         uint64_t ret_ref = 0;
75916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75918         return ret_ref;
75919 }
75920
75921 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_recover_payee_pub_key"))) TS_Bolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
75922         LDKBolt11Invoice this_arg_conv;
75923         this_arg_conv.inner = untag_ptr(this_arg);
75924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75926         this_arg_conv.is_owned = false;
75927         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
75928         memcpy(ret_arr->elems, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
75929         return ret_arr;
75930 }
75931
75932 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_expires_at"))) TS_Bolt11Invoice_expires_at(uint64_t this_arg) {
75933         LDKBolt11Invoice this_arg_conv;
75934         this_arg_conv.inner = untag_ptr(this_arg);
75935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75937         this_arg_conv.is_owned = false;
75938         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
75939         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
75940         uint64_t ret_ref = tag_ptr(ret_copy, true);
75941         return ret_ref;
75942 }
75943
75944 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiry_time"))) TS_Bolt11Invoice_expiry_time(uint64_t this_arg) {
75945         LDKBolt11Invoice this_arg_conv;
75946         this_arg_conv.inner = untag_ptr(this_arg);
75947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75949         this_arg_conv.is_owned = false;
75950         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
75951         return ret_conv;
75952 }
75953
75954 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiration_remaining_from_epoch"))) TS_Bolt11Invoice_expiration_remaining_from_epoch(uint64_t this_arg, int64_t time) {
75955         LDKBolt11Invoice this_arg_conv;
75956         this_arg_conv.inner = untag_ptr(this_arg);
75957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75959         this_arg_conv.is_owned = false;
75960         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
75961         return ret_conv;
75962 }
75963
75964 jboolean  __attribute__((export_name("TS_Bolt11Invoice_would_expire"))) TS_Bolt11Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
75965         LDKBolt11Invoice this_arg_conv;
75966         this_arg_conv.inner = untag_ptr(this_arg);
75967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75969         this_arg_conv.is_owned = false;
75970         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
75971         return ret_conv;
75972 }
75973
75974 int64_t  __attribute__((export_name("TS_Bolt11Invoice_min_final_cltv_expiry_delta"))) TS_Bolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
75975         LDKBolt11Invoice this_arg_conv;
75976         this_arg_conv.inner = untag_ptr(this_arg);
75977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75979         this_arg_conv.is_owned = false;
75980         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
75981         return ret_conv;
75982 }
75983
75984 ptrArray  __attribute__((export_name("TS_Bolt11Invoice_fallback_addresses"))) TS_Bolt11Invoice_fallback_addresses(uint64_t this_arg) {
75985         LDKBolt11Invoice this_arg_conv;
75986         this_arg_conv.inner = untag_ptr(this_arg);
75987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75989         this_arg_conv.is_owned = false;
75990         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
75991         ptrArray ret_arr = NULL;
75992         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
75993         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
75994         for (size_t i = 0; i < ret_var.datalen; i++) {
75995                 LDKStr ret_conv_8_str = ret_var.data[i];
75996                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
75997                 Str_free(ret_conv_8_str);
75998                 ret_arr_ptr[i] = ret_conv_8_conv;
75999         }
76000         
76001         FREE(ret_var.data);
76002         return ret_arr;
76003 }
76004
76005 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_private_routes"))) TS_Bolt11Invoice_private_routes(uint64_t this_arg) {
76006         LDKBolt11Invoice this_arg_conv;
76007         this_arg_conv.inner = untag_ptr(this_arg);
76008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76010         this_arg_conv.is_owned = false;
76011         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
76012         uint64_tArray ret_arr = NULL;
76013         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
76014         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
76015         for (size_t o = 0; o < ret_var.datalen; o++) {
76016                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
76017                 uint64_t ret_conv_14_ref = 0;
76018                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
76019                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
76020                 ret_arr_ptr[o] = ret_conv_14_ref;
76021         }
76022         
76023         FREE(ret_var.data);
76024         return ret_arr;
76025 }
76026
76027 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_route_hints"))) TS_Bolt11Invoice_route_hints(uint64_t this_arg) {
76028         LDKBolt11Invoice this_arg_conv;
76029         this_arg_conv.inner = untag_ptr(this_arg);
76030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76032         this_arg_conv.is_owned = false;
76033         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
76034         uint64_tArray ret_arr = NULL;
76035         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
76036         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
76037         for (size_t l = 0; l < ret_var.datalen; l++) {
76038                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
76039                 uint64_t ret_conv_11_ref = 0;
76040                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
76041                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
76042                 ret_arr_ptr[l] = ret_conv_11_ref;
76043         }
76044         
76045         FREE(ret_var.data);
76046         return ret_arr;
76047 }
76048
76049 uint32_t  __attribute__((export_name("TS_Bolt11Invoice_currency"))) TS_Bolt11Invoice_currency(uint64_t this_arg) {
76050         LDKBolt11Invoice this_arg_conv;
76051         this_arg_conv.inner = untag_ptr(this_arg);
76052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76054         this_arg_conv.is_owned = false;
76055         uint32_t ret_conv = LDKCurrency_to_js(Bolt11Invoice_currency(&this_arg_conv));
76056         return ret_conv;
76057 }
76058
76059 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_amount_milli_satoshis"))) TS_Bolt11Invoice_amount_milli_satoshis(uint64_t this_arg) {
76060         LDKBolt11Invoice this_arg_conv;
76061         this_arg_conv.inner = untag_ptr(this_arg);
76062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76064         this_arg_conv.is_owned = false;
76065         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
76066         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
76067         uint64_t ret_ref = tag_ptr(ret_copy, true);
76068         return ret_ref;
76069 }
76070
76071 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
76072         LDKStr description_conv = str_ref_to_owned_c(description);
76073         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
76074         *ret_conv = Description_new(description_conv);
76075         return tag_ptr(ret_conv, true);
76076 }
76077
76078 uint64_t  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
76079         LDKDescription this_arg_conv;
76080         this_arg_conv.inner = untag_ptr(this_arg);
76081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76083         this_arg_conv = Description_clone(&this_arg_conv);
76084         LDKUntrustedString ret_var = Description_into_inner(this_arg_conv);
76085         uint64_t ret_ref = 0;
76086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76088         return ret_ref;
76089 }
76090
76091 jstring  __attribute__((export_name("TS_Description_to_str"))) TS_Description_to_str(uint64_t o) {
76092         LDKDescription o_conv;
76093         o_conv.inner = untag_ptr(o);
76094         o_conv.is_owned = ptr_is_owned(o);
76095         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76096         o_conv.is_owned = false;
76097         LDKStr ret_str = Description_to_str(&o_conv);
76098         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76099         Str_free(ret_str);
76100         return ret_conv;
76101 }
76102
76103 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
76104         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
76105         uint64_t ret_ref = 0;
76106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76108         return ret_ref;
76109 }
76110
76111 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
76112         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
76113         uint64_t ret_ref = 0;
76114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76116         return ret_ref;
76117 }
76118
76119 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
76120         LDKExpiryTime this_arg_conv;
76121         this_arg_conv.inner = untag_ptr(this_arg);
76122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76124         this_arg_conv.is_owned = false;
76125         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
76126         return ret_conv;
76127 }
76128
76129 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
76130         LDKExpiryTime this_arg_conv;
76131         this_arg_conv.inner = untag_ptr(this_arg);
76132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76134         this_arg_conv.is_owned = false;
76135         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
76136         return ret_conv;
76137 }
76138
76139 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
76140         LDKRouteHint hops_conv;
76141         hops_conv.inner = untag_ptr(hops);
76142         hops_conv.is_owned = ptr_is_owned(hops);
76143         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
76144         hops_conv = RouteHint_clone(&hops_conv);
76145         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
76146         *ret_conv = PrivateRoute_new(hops_conv);
76147         return tag_ptr(ret_conv, true);
76148 }
76149
76150 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
76151         LDKPrivateRoute this_arg_conv;
76152         this_arg_conv.inner = untag_ptr(this_arg);
76153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76155         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
76156         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
76157         uint64_t ret_ref = 0;
76158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76160         return ret_ref;
76161 }
76162
76163 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
76164         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
76165         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
76166         return ret_conv;
76167 }
76168
76169 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
76170         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
76171         return ret_conv;
76172 }
76173
76174 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
76175         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
76176         return ret_conv;
76177 }
76178
76179 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
76180         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
76181         return ret_conv;
76182 }
76183
76184 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
76185         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
76186         return ret_conv;
76187 }
76188
76189 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
76190         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
76191         return ret_conv;
76192 }
76193
76194 uint32_t  __attribute__((export_name("TS_CreationError_min_final_cltv_expiry_delta_too_short"))) TS_CreationError_min_final_cltv_expiry_delta_too_short() {
76195         uint32_t ret_conv = LDKCreationError_to_js(CreationError_min_final_cltv_expiry_delta_too_short());
76196         return ret_conv;
76197 }
76198
76199 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
76200         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
76201         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
76202         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
76203         return ret_conv;
76204 }
76205
76206 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
76207         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
76208         LDKStr ret_str = CreationError_to_str(o_conv);
76209         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76210         Str_free(ret_str);
76211         return ret_conv;
76212 }
76213
76214 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_clone"))) TS_Bolt11SemanticError_clone(uint64_t orig) {
76215         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
76216         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_clone(orig_conv));
76217         return ret_conv;
76218 }
76219
76220 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_hash"))) TS_Bolt11SemanticError_no_payment_hash() {
76221         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_hash());
76222         return ret_conv;
76223 }
76224
76225 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_hashes"))) TS_Bolt11SemanticError_multiple_payment_hashes() {
76226         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_hashes());
76227         return ret_conv;
76228 }
76229
76230 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_description"))) TS_Bolt11SemanticError_no_description() {
76231         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_description());
76232         return ret_conv;
76233 }
76234
76235 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_descriptions"))) TS_Bolt11SemanticError_multiple_descriptions() {
76236         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_descriptions());
76237         return ret_conv;
76238 }
76239
76240 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_secret"))) TS_Bolt11SemanticError_no_payment_secret() {
76241         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_secret());
76242         return ret_conv;
76243 }
76244
76245 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_secrets"))) TS_Bolt11SemanticError_multiple_payment_secrets() {
76246         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_secrets());
76247         return ret_conv;
76248 }
76249
76250 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_features"))) TS_Bolt11SemanticError_invalid_features() {
76251         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_features());
76252         return ret_conv;
76253 }
76254
76255 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_recovery_id"))) TS_Bolt11SemanticError_invalid_recovery_id() {
76256         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_recovery_id());
76257         return ret_conv;
76258 }
76259
76260 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_signature"))) TS_Bolt11SemanticError_invalid_signature() {
76261         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_signature());
76262         return ret_conv;
76263 }
76264
76265 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_imprecise_amount"))) TS_Bolt11SemanticError_imprecise_amount() {
76266         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_imprecise_amount());
76267         return ret_conv;
76268 }
76269
76270 jboolean  __attribute__((export_name("TS_Bolt11SemanticError_eq"))) TS_Bolt11SemanticError_eq(uint64_t a, uint64_t b) {
76271         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
76272         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
76273         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
76274         return ret_conv;
76275 }
76276
76277 jstring  __attribute__((export_name("TS_Bolt11SemanticError_to_str"))) TS_Bolt11SemanticError_to_str(uint64_t o) {
76278         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
76279         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
76280         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76281         Str_free(ret_str);
76282         return ret_conv;
76283 }
76284
76285 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
76286         if (!ptr_is_owned(this_ptr)) return;
76287         void* this_ptr_ptr = untag_ptr(this_ptr);
76288         CHECK_ACCESS(this_ptr_ptr);
76289         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
76290         FREE(untag_ptr(this_ptr));
76291         SignOrCreationError_free(this_ptr_conv);
76292 }
76293
76294 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
76295         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
76296         *ret_copy = SignOrCreationError_clone(arg);
76297         uint64_t ret_ref = tag_ptr(ret_copy, true);
76298         return ret_ref;
76299 }
76300 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
76301         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
76302         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
76303         return ret_conv;
76304 }
76305
76306 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
76307         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
76308         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
76309         *ret_copy = SignOrCreationError_clone(orig_conv);
76310         uint64_t ret_ref = tag_ptr(ret_copy, true);
76311         return ret_ref;
76312 }
76313
76314 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
76315         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
76316         *ret_copy = SignOrCreationError_sign_error();
76317         uint64_t ret_ref = tag_ptr(ret_copy, true);
76318         return ret_ref;
76319 }
76320
76321 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
76322         LDKCreationError a_conv = LDKCreationError_from_js(a);
76323         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
76324         *ret_copy = SignOrCreationError_creation_error(a_conv);
76325         uint64_t ret_ref = tag_ptr(ret_copy, true);
76326         return ret_ref;
76327 }
76328
76329 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
76330         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
76331         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
76332         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
76333         return ret_conv;
76334 }
76335
76336 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
76337         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
76338         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
76339         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76340         Str_free(ret_str);
76341         return ret_conv;
76342 }
76343
76344 uint64_t  __attribute__((export_name("TS_payment_parameters_from_zero_amount_invoice"))) TS_payment_parameters_from_zero_amount_invoice(uint64_t invoice, int64_t amount_msat) {
76345         LDKBolt11Invoice invoice_conv;
76346         invoice_conv.inner = untag_ptr(invoice);
76347         invoice_conv.is_owned = ptr_is_owned(invoice);
76348         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
76349         invoice_conv.is_owned = false;
76350         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
76351         *ret_conv = payment_parameters_from_zero_amount_invoice(&invoice_conv, amount_msat);
76352         return tag_ptr(ret_conv, true);
76353 }
76354
76355 uint64_t  __attribute__((export_name("TS_payment_parameters_from_invoice"))) TS_payment_parameters_from_invoice(uint64_t invoice) {
76356         LDKBolt11Invoice invoice_conv;
76357         invoice_conv.inner = untag_ptr(invoice);
76358         invoice_conv.is_owned = ptr_is_owned(invoice);
76359         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
76360         invoice_conv.is_owned = false;
76361         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
76362         *ret_conv = payment_parameters_from_invoice(&invoice_conv);
76363         return tag_ptr(ret_conv, true);
76364 }
76365
76366 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) {
76367         void* amt_msat_ptr = untag_ptr(amt_msat);
76368         CHECK_ACCESS(amt_msat_ptr);
76369         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76370         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76371         void* payment_hash_ptr = untag_ptr(payment_hash);
76372         CHECK_ACCESS(payment_hash_ptr);
76373         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
76374         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
76375         LDKStr description_conv = str_ref_to_owned_c(description);
76376         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
76377         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
76378         if (phantom_route_hints_constr.datalen > 0)
76379                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
76380         else
76381                 phantom_route_hints_constr.data = NULL;
76382         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
76383         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
76384                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
76385                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
76386                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
76387                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
76388                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
76389                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
76390                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
76391         }
76392         FREE(phantom_route_hints);
76393         void* entropy_source_ptr = untag_ptr(entropy_source);
76394         CHECK_ACCESS(entropy_source_ptr);
76395         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
76396         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
76397                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76398                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
76399         }
76400         void* node_signer_ptr = untag_ptr(node_signer);
76401         CHECK_ACCESS(node_signer_ptr);
76402         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76403         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76404                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76405                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76406         }
76407         void* logger_ptr = untag_ptr(logger);
76408         CHECK_ACCESS(logger_ptr);
76409         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76410         if (logger_conv.free == LDKLogger_JCalls_free) {
76411                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76412                 LDKLogger_JCalls_cloned(&logger_conv);
76413         }
76414         LDKCurrency network_conv = LDKCurrency_from_js(network);
76415         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76416         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76417         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76418         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76419         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76420         *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);
76421         return tag_ptr(ret_conv, true);
76422 }
76423
76424 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) {
76425         void* amt_msat_ptr = untag_ptr(amt_msat);
76426         CHECK_ACCESS(amt_msat_ptr);
76427         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76428         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76429         void* payment_hash_ptr = untag_ptr(payment_hash);
76430         CHECK_ACCESS(payment_hash_ptr);
76431         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
76432         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
76433         LDKSha256 description_hash_conv;
76434         description_hash_conv.inner = untag_ptr(description_hash);
76435         description_hash_conv.is_owned = ptr_is_owned(description_hash);
76436         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
76437         description_hash_conv = Sha256_clone(&description_hash_conv);
76438         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
76439         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
76440         if (phantom_route_hints_constr.datalen > 0)
76441                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
76442         else
76443                 phantom_route_hints_constr.data = NULL;
76444         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
76445         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
76446                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
76447                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
76448                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
76449                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
76450                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
76451                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
76452                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
76453         }
76454         FREE(phantom_route_hints);
76455         void* entropy_source_ptr = untag_ptr(entropy_source);
76456         CHECK_ACCESS(entropy_source_ptr);
76457         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
76458         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
76459                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76460                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
76461         }
76462         void* node_signer_ptr = untag_ptr(node_signer);
76463         CHECK_ACCESS(node_signer_ptr);
76464         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76465         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76466                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76467                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76468         }
76469         void* logger_ptr = untag_ptr(logger);
76470         CHECK_ACCESS(logger_ptr);
76471         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76472         if (logger_conv.free == LDKLogger_JCalls_free) {
76473                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76474                 LDKLogger_JCalls_cloned(&logger_conv);
76475         }
76476         LDKCurrency network_conv = LDKCurrency_from_js(network);
76477         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76478         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76479         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76480         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76481         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76482         *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);
76483         return tag_ptr(ret_conv, true);
76484 }
76485
76486 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) {
76487         LDKChannelManager channelmanager_conv;
76488         channelmanager_conv.inner = untag_ptr(channelmanager);
76489         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
76490         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
76491         channelmanager_conv.is_owned = false;
76492         void* node_signer_ptr = untag_ptr(node_signer);
76493         CHECK_ACCESS(node_signer_ptr);
76494         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76495         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76496                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76497                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76498         }
76499         void* logger_ptr = untag_ptr(logger);
76500         CHECK_ACCESS(logger_ptr);
76501         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76502         if (logger_conv.free == LDKLogger_JCalls_free) {
76503                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76504                 LDKLogger_JCalls_cloned(&logger_conv);
76505         }
76506         LDKCurrency network_conv = LDKCurrency_from_js(network);
76507         void* amt_msat_ptr = untag_ptr(amt_msat);
76508         CHECK_ACCESS(amt_msat_ptr);
76509         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76510         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76511         LDKSha256 description_hash_conv;
76512         description_hash_conv.inner = untag_ptr(description_hash);
76513         description_hash_conv.is_owned = ptr_is_owned(description_hash);
76514         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
76515         description_hash_conv = Sha256_clone(&description_hash_conv);
76516         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76517         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76518         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76519         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76520         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76521         *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);
76522         return tag_ptr(ret_conv, true);
76523 }
76524
76525 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) {
76526         LDKChannelManager channelmanager_conv;
76527         channelmanager_conv.inner = untag_ptr(channelmanager);
76528         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
76529         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
76530         channelmanager_conv.is_owned = false;
76531         void* node_signer_ptr = untag_ptr(node_signer);
76532         CHECK_ACCESS(node_signer_ptr);
76533         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76534         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76535                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76536                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76537         }
76538         void* logger_ptr = untag_ptr(logger);
76539         CHECK_ACCESS(logger_ptr);
76540         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76541         if (logger_conv.free == LDKLogger_JCalls_free) {
76542                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76543                 LDKLogger_JCalls_cloned(&logger_conv);
76544         }
76545         LDKCurrency network_conv = LDKCurrency_from_js(network);
76546         void* amt_msat_ptr = untag_ptr(amt_msat);
76547         CHECK_ACCESS(amt_msat_ptr);
76548         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76549         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76550         LDKStr description_conv = str_ref_to_owned_c(description);
76551         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76552         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76553         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76554         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76555         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76556         *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);
76557         return tag_ptr(ret_conv, true);
76558 }
76559
76560 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) {
76561         LDKChannelManager channelmanager_conv;
76562         channelmanager_conv.inner = untag_ptr(channelmanager);
76563         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
76564         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
76565         channelmanager_conv.is_owned = false;
76566         void* node_signer_ptr = untag_ptr(node_signer);
76567         CHECK_ACCESS(node_signer_ptr);
76568         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76569         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76570                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76571                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76572         }
76573         void* logger_ptr = untag_ptr(logger);
76574         CHECK_ACCESS(logger_ptr);
76575         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76576         if (logger_conv.free == LDKLogger_JCalls_free) {
76577                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76578                 LDKLogger_JCalls_cloned(&logger_conv);
76579         }
76580         LDKCurrency network_conv = LDKCurrency_from_js(network);
76581         void* amt_msat_ptr = untag_ptr(amt_msat);
76582         CHECK_ACCESS(amt_msat_ptr);
76583         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76584         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76585         LDKStr description_conv = str_ref_to_owned_c(description);
76586         LDKThirtyTwoBytes payment_hash_ref;
76587         CHECK(payment_hash->arr_len == 32);
76588         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
76589         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76590         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76591         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76592         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76593         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76594         *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);
76595         return tag_ptr(ret_conv, true);
76596 }
76597
76598 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
76599         LDKStr s_conv = str_ref_to_owned_c(s);
76600         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
76601         *ret_conv = SiPrefix_from_str(s_conv);
76602         return tag_ptr(ret_conv, true);
76603 }
76604
76605 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_str"))) TS_Bolt11Invoice_from_str(jstring s) {
76606         LDKStr s_conv = str_ref_to_owned_c(s);
76607         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
76608         *ret_conv = Bolt11Invoice_from_str(s_conv);
76609         return tag_ptr(ret_conv, true);
76610 }
76611
76612 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_from_str"))) TS_SignedRawBolt11Invoice_from_str(jstring s) {
76613         LDKStr s_conv = str_ref_to_owned_c(s);
76614         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
76615         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
76616         return tag_ptr(ret_conv, true);
76617 }
76618
76619 jstring  __attribute__((export_name("TS_Bolt11ParseError_to_str"))) TS_Bolt11ParseError_to_str(uint64_t o) {
76620         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
76621         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
76622         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76623         Str_free(ret_str);
76624         return ret_conv;
76625 }
76626
76627 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
76628         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
76629         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
76630         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76631         Str_free(ret_str);
76632         return ret_conv;
76633 }
76634
76635 jstring  __attribute__((export_name("TS_Bolt11Invoice_to_str"))) TS_Bolt11Invoice_to_str(uint64_t o) {
76636         LDKBolt11Invoice o_conv;
76637         o_conv.inner = untag_ptr(o);
76638         o_conv.is_owned = ptr_is_owned(o);
76639         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76640         o_conv.is_owned = false;
76641         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
76642         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76643         Str_free(ret_str);
76644         return ret_conv;
76645 }
76646
76647 jstring  __attribute__((export_name("TS_SignedRawBolt11Invoice_to_str"))) TS_SignedRawBolt11Invoice_to_str(uint64_t o) {
76648         LDKSignedRawBolt11Invoice o_conv;
76649         o_conv.inner = untag_ptr(o);
76650         o_conv.is_owned = ptr_is_owned(o);
76651         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76652         o_conv.is_owned = false;
76653         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
76654         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76655         Str_free(ret_str);
76656         return ret_conv;
76657 }
76658
76659 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
76660         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
76661         LDKStr ret_str = Currency_to_str(o_conv);
76662         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76663         Str_free(ret_str);
76664         return ret_conv;
76665 }
76666
76667 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
76668         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
76669         LDKStr ret_str = SiPrefix_to_str(o_conv);
76670         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
76671         Str_free(ret_str);
76672         return ret_conv;
76673 }
76674